I am trying to integrate Attach and Class_ScrollGUI to make a scrollable child GUI inside a Tab Control that resizes with the main Gui - similar I guess to what bichlepa is trying to do.
I have all the other bits working, but I cannot get the ScrollGui window to resize - it seems to be because you are parenting Guis in ScrollGui?
Here is how it should behave (Minus the scrollbars):
Code: Select all
#SingleInstance force
#Include <attach>
#Include <Class_ScrollGUI>
mc := new MyClass()
class MyClass {
__New(){
Gui +resize
Gui, Add, Tab2, hwndhTab w200 h200, Tab A|Tab B
fn := this.OnSize.Bind(this)
Gui +HwndhDef
Gui, Add, Text, hwndhEdit w180 h160
Gui, New, hwndhChild -Border
this.hChild := hChild
Gui, Color, FF0000
Loop 10 {
Gui, Add, Edit, xm w300
}
Gui, Show, x0 y0 w180 h160
;this.SG1 := New ScrollGUI(hChild, 180, 160, "+Resize +LabelGui1 -Border", 3, 4)
;this.SG1.Show("ScrollGUI1", "x0 y0 w180 h160")
Gui, % "+Parent" hEdit
Attach(hTab,"w1 h1")
Attach(hEdit,"w1 h1")
Gui, % hDef ":Show"
OnMessage(0x0005, fn)
}
OnSize(wParam, lParam){
dllcall("MoveWindow", "Ptr", this.hChild, "int", 0,"int", 0, "int", lParam & 0xffff, "int", lParam >> 16, "int", 0)
;dllcall("MoveWindow", "Ptr", this.SG1.HWND, "int", 0,"int", 0, "int", lParam & 0xffff, "int", lParam >> 16, "int", 0)
}
}
I just can't get your class to make the ScrollGui resize when the parent resizes. The commented out lines are my attempt at integrating SG.
Any ideas?
BTW: Why do you need a scrollable child window as well as a rezizable parent window?
In my case, I am writing a Rapid Application Development framework for AHK called RADical.
The goal is to allow people to take a script (ie hard-coded hotkeys, settings etc) and easily turn it into a user-friendly "Application" that is configurable by end-users with no knowledge of AHK.
Script writers can include my library, and it wraps their script with useful functionality:
- Decent Hotkey GuiControls that allow the end-user to choose which Hotkey activates the script functions (Supports Keyboard, Mouse, Joystick buttons,Joystick Hat directions or any combination thereof - eg Ctrl+Lbutton+Joystick 2 Hat Up)
- Persistent settings (Contents of GuiControls and Hotkey bindings saved between runs).
- Profile support (End user can create profiles which allow for sets of settings to be swapped in and out).
- etc, etc.
These extra functions (eg the DDL to select current profile) are not part of the "Client" script's GUI - for example the profile select DDL will be on one of the other tabs.
The Script author has his own "Client" Gui (The one inside the Tab Control), so all Gui, Add commands that the script author uses can use coordinates relative to the "Client" Gui.
Therefore, as I do not know how many GuiControls will be inside the Client Gui, I need scrollbars inside the Tab control to accommodate for any size of Client Gui.
Here is a GIF of the profile / persistent settings system in action (I havent done the child Gui part for it yet, just the Hotkey GuiControl and the Profile system:
The Hotkey GuiControl is here:
https://github.com/evilC/HotClass