smashly Posted June 7, 2006 Share Posted June 7, 2006 (edited) Hi to all and thank for reading my first post in this forum. Hoping that my beggings are simple. I'm not actually writing anything for a purpose yet and I'm slowly trying to wrap my mind around AutoIt and what can be done with it's GUI. Could someone please post or point me to a small sample of how to get a Gui to Auto Resize by an added Control? eg:#include <GUIConstants.au3> GUICreate("Main",80,40,-1,-1) GUISetState (@SW_SHOW) Opt("GUICoordMode", 2) $Button = GUICtrlCreateButton ("Add",-1,-1,40,40) GUICtrlSetResizing ($Button,$GUI_DOCKLEFT+$GUI_DOCKVCENTER) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $Button Then $Button1 = GUICtrlCreateButton ("Newer",0,-1) EndIf Wend Basicly I'm after when a button is added to the Main window that the Main window resizes to fit the new button added. (please forgive my bad non working example above :"> ). In the meantime I'll keep sifting through the AutoIt forum and Help files and such to better my understanding. So far AutoIts help files have been an absolute blessing and a half, now if I coulkd just get my mind around that bundle of info. Thank You & Cheers Edited June 7, 2006 by smashly Link to comment Share on other sites More sharing options...
Uten Posted June 7, 2006 Share Posted June 7, 2006 (edited) EDIT: hmm, did not read the post properly. :"> I'll be back. Edited June 7, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Uten Posted June 7, 2006 Share Posted June 7, 2006 Somthing like this? #include <GUIConstants.au3> $gForm = GUICreate("Main",80,40,-1,-1) GUISetState (@SW_SHOW) Opt("GUICoordMode", 2) Global $Buttons[10] $Buttons[1] = GUICtrlCreateButton ("Add",-1,-1,40,40) $Buttons[0] = 1 GUICtrlSetResizing($Buttons[$Buttons[0]], $GUI_DOCKSIZE+ $GUI_DOCKLEFT) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop for $i = 1 to $Buttons[0] If $msg = $Buttons[$i] Then $Buttons[$Buttons[0]+1] = GUICtrlCreateButton ("Newer:" & $Buttons[0]+1,0,-1) $Buttons[0] =$Buttons[0] + 1 GUICtrlSetResizing($Buttons[$Buttons[0]], $GUI_DOCKSIZE + $GUI_DOCKLEFT) ; get last possition $SC =WinGetPos(GuiCtrlGetHandle($Buttons[$Buttons[0]])) ConsoleWrite("$SC[0]:=" & $SC[0] & ", $SC[1]:=" & $SC[1] & ", $SC[2]:=" & $SC[2] & ", $SC[3]:=" & $SC[3] & @LF) ;Resize form $SF = WinGetPos(WinGetHandle($gForm)) ConsoleWrite("$SF[0]:=" & $SF[0] & ", $SF[1]:=" & $SF[1] & ", $SF[2]:=" & $SF[2] & ", $SF[3]:=" & $SF[3] & @LF) WinMove(WinGetHandle($gForm),"", $SF[0], $SF[1], $SC[0] -$SF[0] + $SC[2] + 10) EndIf Next Wend Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
smashly Posted June 7, 2006 Author Share Posted June 7, 2006 (edited) Thank You for taking the time Uten. It's greatly appreciated. Sorry to say I get an Undefined Function error when I tried your updated code.C:\Temp\testresizeaddcontrol.au3(23,63) : ERROR: GuiCtrlGetHandle(): undefined function. $SC =WinGetPos(GuiCtrlGetHandle($Buttons[$Buttons[0]]) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^What am I doing wrong? Edited June 7, 2006 by smashly Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 7, 2006 Moderators Share Posted June 7, 2006 You need AutoIt Beta for that function. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
smashly Posted June 8, 2006 Author Share Posted June 8, 2006 Thank You , dang that's just nifty .. my fondness of AutoIt has become even more so now Once again Thank You Uten & Cheers SmOke_N All Good Link to comment Share on other sites More sharing options...
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