jonny1234 Posted January 23, 2007 Posted January 23, 2007 Hi, Is it possible to dock all controls within a group control, to the borders of the group, in the same way as it is possible to dock controls to the borders of a GUI? For example, in the following code, would it be possible to dock the edit control and OK and Cancel buttons to the surrounding group, so that when the Resize Group button is pressed, these controls within the group would resize automatically? I know this can be done manually, but I was wondering if there is an easier way as this is just a simple example I have put together to illustrate the question. The real script I have in mind is much more complex, but the same principle applies. #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("AForm1", 307, 232, 296, 209) GUISetOnEvent($GUI_EVENT_CLOSE, "AForm1Close") $Group1 = GUICtrlCreateGroup("", 10, 10, 287, 173) $Edit1 = GUICtrlCreateEdit("", 20, 30, 273, 109, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) $cmdOK = GUICtrlCreateButton("OK", 18, 146, 77, 27, 0) $cmdCancel = GUICtrlCreateButton("Cancel", 102, 146, 77, 27, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) $cmdResize = GUICtrlCreateButton("Resize Group", 10, 192, 85, 29, 0) GUICtrlSetOnEvent(-1, "cmdResizeClick") GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func AForm1Close() GUIDelete($Form1) Exit EndFunc Func cmdResizeClick() Local $group_pos = ControlGetPos($Form1, "", $Group1) ControlMove($Form1, "", $Group1, $group_pos[0], $group_pos[1], $group_pos[2], $group_pos[3] - 10) EndFunc Any suggestions would be much appreciated. Regards, Jonny
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now