CGRemakes Posted January 17, 2011 Posted January 17, 2011 I'm sure this is probably just a simple flag on the elements themselves, but I'm having a tough time finding what that flag would be. I'm attempting to make it so the user can resize this window, and it will stretch the listview to fit to the width of the window (minus the padding), but the buttons/datepicker, etc (the part highlighted in red) I just want to maintain the same distance from the right side without stretching. What would I need to do to accomplish this?
BigDod Posted January 17, 2011 Posted January 17, 2011 GUICtrlSetResizing should do it Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
Moderators Melba23 Posted January 17, 2011 Moderators Posted January 17, 2011 (edited) CGRemakes, I always have to play about with the various resizing constants myself each time I need them, but I think these are the ones you need: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 500, 500, -1, -1, $WS_SIZEBOX) GUICtrlCreateButton("Refresh", 400, 10, 80, 30) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKRIGHT + $GUI_DOCKSIZE) GUICtrlCreateListView("Col 1|Col 2", 10, 50, 480, 370) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlCreateButton("Refresh", 400, 430, 80, 30) GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKRIGHT + $GUI_DOCKSIZE) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd M23 Edit: Forum software screwup = need to edit. Edited January 17, 2011 by Melba23 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
BigDod Posted January 17, 2011 Posted January 17, 2011 GUICtrlSetResizing should do it Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
guinness Posted January 17, 2011 Posted January 17, 2011 (edited) And have a look at WM_GETMINMAXINFO to set the minimum re-size width and height for the GUI. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $Global_MinWidth = 250, $Global_MinHeight = 250 $hGUI = GUICreate("Test", 500, 500, -1, -1, $WS_SIZEBOX) GUICtrlCreateButton("Refresh", 400, 10, 80, 30) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKRIGHT + $GUI_DOCKSIZE) GUICtrlCreateListView("Col 1|Col 2", 10, 50, 480, 370) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlCreateButton("Refresh", 400, 430, 80, 30) GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKRIGHT + $GUI_DOCKSIZE) GUISetState() GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_GETMINMAXINFO($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $wm_Structure = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $ilParam) DllStructSetData($wm_Structure, 7, $Global_MinWidth) DllStructSetData($wm_Structure, 8, $Global_MinHeight) DllStructSetData($wm_Structure, 9, @DesktopWidth) DllStructSetData($wm_Structure, 10, @DesktopHeight) Return 0 EndFunc ;==>WM_GETMINMAXINFO Edited January 17, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
CGRemakes Posted January 17, 2011 Author Posted January 17, 2011 (edited) And have a look at WM_GETMINMAXINFO to set the minimum re-size width and height for the GUI. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $Global_MinWidth = 250, $Global_MinHeight = 250 $hGUI = GUICreate("Test", 500, 500, -1, -1, $WS_SIZEBOX) GUICtrlCreateButton("Refresh", 400, 10, 80, 30) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKRIGHT + $GUI_DOCKSIZE) GUICtrlCreateListView("Col 1|Col 2", 10, 50, 480, 370) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlCreateButton("Refresh", 400, 430, 80, 30) GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKRIGHT + $GUI_DOCKSIZE) GUISetState() GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_GETMINMAXINFO($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $wm_Structure = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $ilParam) DllStructSetData($wm_Structure, 7, $Global_MinWidth) DllStructSetData($wm_Structure, 8, $Global_MinHeight) DllStructSetData($wm_Structure, 9, @DesktopWidth) DllStructSetData($wm_Structure, 10, @DesktopHeight) Return 0 EndFunc ;==>WM_GETMINMAXINFO Wow, almost like you read my mind! Thanks for the info. Everything is working GREAT, with the exception of the date pickers. The position of those just stays the same. Is there a solution to apply that effect to those fields as well? Edited January 17, 2011 by CGRemakes
Moderators Melba23 Posted January 18, 2011 Moderators Posted January 18, 2011 CGRemakes,Is there a solution to apply that effect to those fields as well?We like to leave something as "an exercise for the student" in our examples! GUICtrlSetResizing will work on all native AutoIt controls, so just add the command after creating your other controls (date combos and labels) to let them move/remain fixed as you require. As I mentioned above, you may have to play around with the various constants - I can never remember which does what exactly without a bit of experimentation! 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
CGRemakes Posted January 18, 2011 Author Posted January 18, 2011 CGRemakes, We like to leave something as "an exercise for the student" in our examples! GUICtrlSetResizing will work on all native AutoIt controls, so just add the command after creating your other controls (date combos and labels) to let them move/remain fixed as you require. As I mentioned above, you may have to play around with the various constants - I can never remember which does what exactly without a bit of experimentation! M23 Yeah, I'd already tried that with no success. I'm using _GUICtrlDTP_Create to create the date picker, so I don't know if that's considered "native". The following is what I have (I've also tried changing -1 to $hDTP2 and $hDTP3) $hDTP2 = _GUICtrlDTP_Create($LogHistory, 423, 20) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKRIGHT + $GUI_DOCKSIZE) $hDTP3 = _GUICtrlDTP_Create($LogHistory, 613, 20) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKRIGHT + $GUI_DOCKSIZE) I've tried searching the GuiDateTimePicker.au3 source to see if there is a function provided, but didn't see anything. The constants have performed as expected with everything else. If I'm overlooking something, let me know. I'm willing to change my date picker to something more native if needs be.
Moderators Melba23 Posted January 18, 2011 Moderators Posted January 18, 2011 CGRemakes,When you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. Unfortunately GUICtrlSetResizing does not work with UDF created controls - any function with a leading underscore is not native. But do not worry, it just means we have to do a bit more coding ourselves: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiDateTimePicker.au3> $hGUI = GUICreate("Test", 500, 500, -1, -1, $WS_SIZEBOX) $hDTP = _GUICtrlDTP_Create($hGUI, 250, 10, 120, 30) GUICtrlCreateButton("Refresh", 400, 10, 80, 30) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKRIGHT + $GUI_DOCKSIZE) GUICtrlCreateListView("Col 1|Col 2", 10, 50, 480, 370) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlCreateButton("Refresh", 400, 430, 80, 30) GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKRIGHT + $GUI_DOCKSIZE) GUISetState() ; Intercept the GUI resizing messages GUIRegisterMsg($WM_SIZE, "WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) ; Confirm from our GUI If $hWnd = $hGUI Then ; Move the DTP to the correct place - the BitAND function gives us the new width WinMove($hDTP, "", BitAND($lParam, 0xFFFF) - 250, 10) EndIfEndFunc ;==>WM_SIZEIf you are not used to coding with GUIRegisterMsg, then I recommend the GUIRegisterMsg tutorial in the Wiki. All clear now? 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
CGRemakes Posted January 18, 2011 Author Posted January 18, 2011 Thanks for the reply. That seems to be working much better. I'll have to tweak the values a bit, but that shouldn't be a problem. Yeah, I figured I'd better mention the fact that I was using a UDF to clarify. I appreciate the help!
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