Why does "ScrollWindow" produce a blank area?

Ask for help, how to use AHK_H, etc.
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Why does "ScrollWindow" produce a blank area?

14 Sep 2017, 17:12

Although you can adjust the coordinates to avoid the blank, but there is no other way to avoid this blank?

Code: Select all

	GuiCreate()

	hwnd:=CreateWindowEx(0,"AutoHotkeyGui","sf",0X80000000,A_ScreenWidth*0.2,A_ScreenHeight*0.2,A_ScreenWidth*0.4,h:=A_ScreenHeight*0.4,0,0,0,0)

	loop
	{
		CreateWindowEx(0,"static","" A_Index,0X40000000|0x10000000|0X800000,0,40*A_Index,A_ScreenWidth*0.4,30,hwnd,0,0,0)

		if (40*A_Index+30)>=h
		{
			idx:=A_Index
			Break
		}
	}

	showWindow(hwnd,4)
	OnMessage(0x020A, "tt") 
return
tt(w,l,s,h){
	global
	h:=40*idx+30+200
	ScrollWindow(hwnd,0,-200,0,0)
	UpdateWindow(hwnd)
	loop
	{
		idx++
		CreateWindowEx(0,"static","" r:=idx,0X40000000|0x10000000|0X800000,0,40*r,A_ScreenWidth*0.4,30,hwnd,0,0,0)
		if (40*r+30)>=h
		{
			idx:=r
			Break
		}
	}
}
Image
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Why does "ScrollWindow" produce a blank area?

14 Sep 2017, 17:53

Code: Select all

	GuiCreate()

	hwnd:=CreateWindowEx(0,"AutoHotkeyGui","sf",0X80000000,A_ScreenWidth*0.2,A_ScreenHeight*0.2,A_ScreenWidth*0.4,h:=A_ScreenHeight*0.4,0,0,0,0)

	loop
	{
		CreateWindowEx(0,"static","" A_Index,0X40000000|0x10000000|0X800000,0,40*A_Index,A_ScreenWidth*0.4,30,hwnd,0,0,0)

		if (40*A_Index+30)>=h
		{
			idx:=A_Index
			Break
		}
	}

	showWindow(hwnd,4)
	OnMessage(0x020A, "tt") 
return
tt(w,l,s,h){
	global
	h:=40*idx+30+200
	ScrollWindow(hwnd,0,-200,0,0)
	UpdateWindow(hwnd)
	loop
	{
		r:=++idx
		CreateWindowEx(0,"static","" r,0X40000000|0x10000000|0X800000,0,40*(A_Index+4),A_ScreenWidth*0.4,30,hwnd,0,0,0)
		if (40*r+30)>=h
		{
			idx:=r
			Break
		}
	}
}
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: Why does "ScrollWindow" produce a blank area?

14 Sep 2017, 19:57

thank you.
This is still the adjustment of coordinates, there is no other way to avoid blank?

Code: Select all

	GuiCreate()

	hwnd:=CreateWindowEx(0,"AutoHotkeyGui","sf",0X80000000,A_ScreenWidth*0.2,A_ScreenHeight*0.2,A_ScreenWidth*0.4,h:=A_ScreenHeight*0.4,0,0,0,0)

	loop
	{
		CreateWindowEx(0,"static","" A_Index,0X40000000|0x10000000|0X800000,0,40*A_Index,A_ScreenWidth*0.4,30,hwnd,0,0,0)

		if (40*A_Index+30)>=h
		{
			idx:=A_Index
			Break
		}
	}

	showWindow(hwnd,4)
	OnMessage(0x020A, "tt") 
return
tt(w,l,s,h){
	global
	hh:=80
	h:=40*idx+30+hh
	ScrollWindow(hwnd,0,-hh,0,0)
	UpdateWindow(hwnd)
	loop
	{
		r:=++idx
		CreateWindowEx(0,"static","" r,0X40000000|0x10000000|0X800000,0,40*(A_Index+4),A_ScreenWidth*0.4,30,hwnd,0,0,0)
		if (40*r+30)>=h
		{
			idx:=r
			Break
		}
	}
}
return
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Why does "ScrollWindow" produce a blank area?

15 Sep 2017, 01:40

If you are using wrong coordinates, there will be blank!

Code: Select all

	GuiCreate()

	hwnd:=CreateWindowEx(0,"AutoHotkeyGui","sf",0X80000000,A_ScreenWidth*0.2,A_ScreenHeight*0.2,A_ScreenWidth*0.4,h:=A_ScreenHeight*0.4,0,0,0,0)

	loop
	{
		CreateWindowEx(0,"static","" A_Index,0X40000000|0x10000000|0X800000,0,40*A_Index,A_ScreenWidth*0.4,30,hwnd,0,0,0)

		if (40*A_Index+30)>=h
		{
			idx:=A_Index
			Break
		}
	}

	showWindow(hwnd,4)
	OnMessage(0x020A, "tt") 
return
tt(w,l,s,h){
	global
	hh:=80
	h:=40*idx+30+hh
	ScrollWindow(hwnd,0,-hh,0,0)
	UpdateWindow(hwnd)
	loop
	{
		r:=++idx
		CreateWindowEx(0,"static","" r,0X40000000|0x10000000|0X800000,0,40*(A_Index+4),A_ScreenWidth*0.4,30,hwnd,0,0,0)
		if (40*r+30)>=h
		{
			idx:=r
			Break
		}
	}
	ScrollWindow(hwnd,0,hh,0,0) ;here we scroll back and you can see that coordinates were wrong
}
return
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: Why does "ScrollWindow" produce a blank area?

15 Sep 2017, 09:37

Yes, we can calculate the rolling distance to correct the blank, but I can not understand the coordinates of these deformities, because "rolling blank", this thing itself is unreasonable.
What do i mean is that we can not eliminate the "blank" from the root cause?

Code: Select all

	GuiCreate()

	hwnd:=CreateWindowEx(0,"AutoHotkeyGui","sf",0X80000000,A_ScreenWidth*0.2,A_ScreenHeight*0.2,A_ScreenWidth*0.4,h:=A_ScreenHeight*0.4,0,0,0,0)

	loop
	{
		CreateWindowEx(0,"static","" A_Index,0X40000000|0x10000000|0X800000,0,40*A_Index,A_ScreenWidth*0.4,30,hwnd,0,0,0)

		if (40*A_Index+30)>=h
		{
			idx:=A_Index
			Break
		}
	}

	showWindow(hwnd,4)
Offset:=0
	OnMessage(0x020A, "tt") 
return
tt(w,l,s,h){

	global
	Offset+=	hh:=80
	h:=40*idx+30+hh
	ScrollWindow(hwnd,0,-hh,0,0)
	UpdateWindow(hwnd)
	loop
	{
		r:=++idx
		CreateWindowEx(0,"static","" r,0X40000000|0x10000000|0X800000,0,40*R-Offset,A_ScreenWidth*0.4,30,hwnd,0,0,0)
		if (40*r+30)>=h
		{
			idx:=r
			Break
		}
	}
;	ScrollWindow(hwnd,0,hh,0,0) ;here we scroll back and you can see that coordinates were wrong
}
-----------------

"ScrollWindowEx" seems to have a "delete blank" command. Would you use it?

Code: Select all

int ScrollWindowEx(
  _In_        HWND   hWnd,
  _In_        int    dx,
  _In_        int    dy,
  _In_  const RECT   *prcScroll,
  _In_  const RECT   *prcClip,
  _In_        HRGN   hrgnUpdate,
  _Out_       LPRECT prcUpdate,
  _In_        UINT   flags
);
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Why does "ScrollWindow" produce a blank area?

16 Sep 2017, 03:09

The coordinates are where control is to be created, if you don't want to calculate, you would need to scroll a page, the you always start at the beginning.
Does this explain it better?

Code: Select all

	GuiCreate()

	hwnd:=CreateWindowEx(0,"AutoHotkeyGui","sf",0X80000000,A_ScreenWidth*0.2,A_ScreenHeight*0.2,A_ScreenWidth*0.4,h:=A_ScreenHeight*0.4,0,0,0,0)

	loop
	{
		CreateWindowEx(0,"static","" A_Index,0X40000000|0x10000000|0X800000,0,40*A_Index,A_ScreenWidth*0.4,30,hwnd,0,0,0)

		if (40*A_Index+30)>=h
		{
			idx:=A_Index
			Break
		}
	}

	showWindow(hwnd,4)
Offset:=0
	OnMessage(0x020A, "tt") 
return
tt(w,l,s,h){

	global
	Offset+=	hh:=A_ScreenHeight*0.4
	h:=40*idx+30+hh
	ScrollWindow(hwnd,0,-hh,0,0)
	UpdateWindow(hwnd)
	Sleep 3000
	loop
	{
		r:=++idx
		CreateWindowEx(0,"static","" r,0X40000000|0x10000000|0X800000,0,40*A_Index,A_ScreenWidth*0.4,30,hwnd,0,0,0)
		if (40*r+30)>=h
		{
			idx:=r
			Break
		}
	}
;	ScrollWindow(hwnd,0,hh,0,0) ;here we scroll back and you can see that coordinates were wrong
}
Esc::ExitApp
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: Why does "ScrollWindow" produce a blank area?

16 Sep 2017, 18:54

I understand.
thank you very much.
jonathan scott james
Posts: 42
Joined: 05 Apr 2016, 01:56

Re: Why does "ScrollWindow" produce a blank area?

24 Apr 2018, 10:52

here's the natural ahk way of doing it. but it's too slow

Code: Select all

#Persistent
Gui,1: +LastFound +AlwaysOnTop
Gui,1: Add, Text,h150 w400 vCtrlScope,ASDFASDFASDF
Gui,1: Add, Edit         ,,ASDFASDFASDF

Gui,1: Show,H300 W1020,F1=help (Toggle)
Gui,1: +Resize

GuiHwnd := WinExist()
hDC := DllCall("GetDC", UInt, GuiHwnd)

WatchScrollBar:
  soundBeep,1000,1  
    DllCall("ScrollDC",UInt,hdc,Int,1,Int,1)
goto watchscrollbar

esc::
GuiClose:
exitapp
jonathan scott james
Posts: 42
Joined: 05 Apr 2016, 01:56

Re: Why does "ScrollWindow" produce a blank area?

24 Apr 2018, 11:18

that code your posting does not work on my ahk it says:
(1) : ==> Call to nonexistent function.
Specifically: GuiCreate()

Return to “Ask for Help”

Who is online

Users browsing this forum: No registered users and 20 guests