Scrollbars for Gui object, AHK V2

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Scrollbars for Gui object, AHK V2

19 Jun 2018, 15:42

I'm finding forum references to adding "HScroll VScroll" to controls ("but not to text controls") and using "+Resize +0x300000" - but haven't been able to figure out how to apply to AHK V2 (sometimes I see scrollbars with the options I try, but they're grayed out and won't scroll).

Didn't find anything in the V2 vs. V1 documentation.

V2 doc says:
Gui.Add(ControlType [, Options, Text])
Options HScroll/VScroll: Provides a horizontal/vertical scroll bar if appropriate for this type of control.

But this doesn't work for me (i.e. no scrollbars):
Gui2.Add("Edit","HScroll VScroll", msg)

Help, please :oops:
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Scrollbars for Gui object, AHK V2

19 Jun 2018, 18:11

- Here are 2 examples.
- The scrollbars appear greyed out until you type enough text horizontally/vertically.

Code: Select all

;AHK v2

#SingleInstance force
oGui := GuiCreate(, "MyWinTitle")
oGui.OnEvent("Close", "Gui_Close")
hGui := oGui.hWnd

oGui.Add("Edit", "w100 h100 +HScroll +VScroll", "EDIT 1")
oGui.Add("Edit", "w100 h100 r10 +HScroll +VScroll", "EDIT 2")

oGui.Show()
return

;==================================================

Gui_Close()
{
	ExitApp()
}
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: Scrollbars for Gui object, AHK V2

20 Jun 2018, 06:07

Thanks much! My problem: Omitting dimensions e.g. "w100 h100" seems to disable the scrollbars ; )
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Scrollbars for Gui object, AHK V2

20 Jun 2018, 07:25

- These work for me:

Code: Select all

;AHK v2

#SingleInstance force
oGui := GuiCreate(, "MyWinTitle")
oGui.OnEvent("Close", "Gui_Close")
hGui := oGui.hWnd

oGui.Add("Edit", "+Multi +HScroll +VScroll", "EDIT 1")
oGui.Add("Edit", "r10 +HScroll +VScroll", "EDIT 2")

oGui.Show()
return

;==================================================

Gui_Close()
{
	ExitApp()
}
- Perhaps if you don't specify +Multi or r10 (or 'r' with another number) you're left with a single-line Edit control which can't be expanded, and so the vertical scrollbar doesn't become usable.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: Scrollbars for Gui object, AHK V2

20 Jun 2018, 07:47

Thanks

My expectations from reading the doc is that without width/height/row parameters, Edit control would be sized automatically which I find that it is, but no functioning scrollbars

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Danielsan73, Rohwedder, vmech and 35 guests