ChrisMasc Posted August 17, 2009 Share Posted August 17, 2009 Hello everybody. I've created a Gui which lists all SQL Databases from entire user Input and will create a Checkbox for each Database among each other. My GUI is created with GUICreate("Input Parameters", 500, $height, @DesktopWidth / 2 - 300, @DesktopHeight /2 -250, -1, 0x00000018) Now I want to resize the height of the GUI by means of the Number of Results from Database Query. So the GUI Height should expand with each created Checkbox. Have anyone a solution for my problem. Many Thanks in advance. Best regards, Chris Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 17, 2009 Moderators Share Posted August 17, 2009 ChrisMasc,Look at WinMove in the Help file. Not the most intuitive place to look, I agree, but that is where you need to go!M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
billthecreator Posted August 17, 2009 Share Posted August 17, 2009 (edited) do for ... next and for ever checkbox you make, make $x += 20 then do the winmove with $x do guess and check for the 20 value, you may need to make it 21, or something around that Edited August 17, 2009 by billthecreator [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap Link to comment Share on other sites More sharing options...
smashly Posted August 17, 2009 Share Posted August 17, 2009 (edited) Hi,#include <GUIConstantsEx.au3> Global $hGui, $ChkBox[1], $Msg, $WGP $hGui = GUICreate("", 135, 25) $ChkBox[0] = GUICtrlCreateCheckbox("Add another checkbox", 5, 5, 125, 15) GUICtrlSetResizing(-1, $GUI_DOCKMENUBAR) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $ChkBox[0] To $ChkBox[UBound($ChkBox) - 1] $WGP = WinGetPos($hGui) If GUICtrlRead($Msg) = $GUI_CHECKED Then ReDim $ChkBox[UBound($ChkBox) + 1] $ChkBox[UBound($ChkBox) - 1] = GUICtrlCreateCheckbox("Add another checkbox", 5, ((UBound($ChkBox) - 1) * 25) + 5, 125, 15) GUICtrlSetResizing(-1, $GUI_DOCKMENUBAR) If UBound($ChkBox) - 1 >= 2 Then GUICtrlSetState($ChkBox[UBound($ChkBox) - 3], $GUI_DISABLE) WinMove($hGui, "", Default, Default, Default, $WGP[3] + 25) Else GUICtrlDelete($ChkBox[UBound($ChkBox) - 1]) If UBound($ChkBox) - 1 >= 2 Then GUICtrlSetState($ChkBox[UBound($ChkBox) - 3], $GUI_ENABLE) ReDim $ChkBox[UBound($ChkBox) - 1] WinMove($hGui, "", Default, Default, Default, $WGP[3] - 25) EndIf EndSwitch WEnd Cheers Edited August 18, 2009 by smashly KnightVegor 1 Link to comment Share on other sites More sharing options...
ChrisMasc Posted August 27, 2009 Author Share Posted August 27, 2009 Hi smashly, Many Thanks for your great and easy Solution. But i've still one quetsion there. I have some Labels in my GUI. Every time i resize my GUI the Labels are changing its Position which is related to the whole GUI Size. The Labels schould be placed always on the same Position no matter how often the Gui is resized. Is there any Posibility for this? To see my Problem test the script below. I've only added line Number 4 (GuiCtrlCreateLabel) Thanks in advance Chris #include <GUIConstantsEx.au3> Global $hGui, $ChkBox[1], $Msg, $WGP $hGui = GUICreate("", 335, 50) GUICtrlCreateLabel("Test Text schould be placed on same position", 150, 10) $ChkBox[0] = GUICtrlCreateCheckbox("Add another checkbox", 5, 5, 125, 15) GUICtrlSetResizing(-1, $GUI_DOCKMENUBAR) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $ChkBox[0] To $ChkBox[uBound($ChkBox) - 1] $WGP = WinGetPos($hGui) If GUICtrlRead($Msg) = $GUI_CHECKED Then ReDim $ChkBox[uBound($ChkBox) + 1] $ChkBox[uBound($ChkBox) - 1] = GUICtrlCreateCheckbox("Add another checkbox", 5, ((UBound($ChkBox) - 1) * 25) + 5, 125, 15) GUICtrlSetResizing(-1, $GUI_DOCKMENUBAR) If UBound($ChkBox) - 1 >= 2 Then GUICtrlSetState($ChkBox[uBound($ChkBox) - 3], $GUI_DISABLE) WinMove($hGui, "", Default, Default, Default, $WGP[3] + 25) Else GUICtrlDelete($ChkBox[uBound($ChkBox) - 1]) If UBound($ChkBox) - 1 >= 2 Then GUICtrlSetState($ChkBox[uBound($ChkBox) - 3], $GUI_ENABLE) ReDim $ChkBox[uBound($ChkBox) - 1] WinMove($hGui, "", Default, Default, Default, $WGP[3] - 25) EndIf EndSwitch WEnd Link to comment Share on other sites More sharing options...
smashly Posted August 27, 2009 Share Posted August 27, 2009 Hi, your welcome Use GUICtrlSetResizing() for each control that you want to tell how to behave. In AutoIt help file -> Function Reference -> Gui Reference -> Gui Control Update -> GUICtrlSetResizing() There you can find the Docking Values and how the function can be used.#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $hGui, $ChkBox[1], $Msg, $WGP $hGui = GUICreate("", 335, 50, -1, -1, $WS_OVERLAPPEDWINDOW) GUICtrlCreateLabel("Test Text stays in the same position", 150, 10) GUICtrlSetResizing(-1, BitOr($GUI_DOCKTOP, $GUI_DOCKLEFT, $GUI_DOCKSIZE)); <- Set the resizing for the control $ChkBox[0] = GUICtrlCreateCheckbox("Add another checkbox", 5, 5, 125, 15) GUICtrlSetResizing(-1, BitOr($GUI_DOCKTOP, $GUI_DOCKLEFT, $GUI_DOCKSIZE)); <- Set the resizing for the control GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $ChkBox[0] To $ChkBox[UBound($ChkBox) - 1] $WGP = WinGetPos($hGui) If GUICtrlRead($Msg) = $GUI_CHECKED Then ReDim $ChkBox[UBound($ChkBox) + 1] $ChkBox[UBound($ChkBox) - 1] = GUICtrlCreateCheckbox("Add another checkbox", 5, ((UBound($ChkBox) - 1) * 25) + 5, 125, 15) GUICtrlSetResizing(-1, BitOr($GUI_DOCKTOP, $GUI_DOCKLEFT, $GUI_DOCKSIZE)) ; <- Set the resizing for the control If UBound($ChkBox) - 1 >= 2 Then GUICtrlSetState($ChkBox[UBound($ChkBox) - 3], $GUI_DISABLE) WinMove($hGui, "", Default, Default, Default, $WGP[3] + 25) Else GUICtrlDelete($ChkBox[UBound($ChkBox) - 1]) If UBound($ChkBox) - 1 >= 2 Then GUICtrlSetState($ChkBox[UBound($ChkBox) - 3], $GUI_ENABLE) ReDim $ChkBox[UBound($ChkBox) - 1] WinMove($hGui, "", Default, Default, Default, $WGP[3] - 25) EndIf EndSwitch WEndCheers 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