Allow2010 Posted December 12, 2011 Posted December 12, 2011 Hi all, i have a small problem making a gui, and i hope someone might be so kind to help me out: The following GUI works for me, but i would like it to be resizable (so when i resize the main gui also the Listview and the Edit are resized) and also i would like it to remember its size and position... How can this be done? Thanks in advance fo any hint... BTW: i have one other problem: When i select a listview entry by mouse the edit is updated, but when i do this by keaboard (up down) it is not. How can this be done? expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <Constants.au3> #include <GuiListView.au3> $hGUI = GUICreate("My GUI", 540, 500) $loglistview = GUICtrlCreateListView("Info1|Info2|Info3|Info4|Info5", 10, 10, 520, 200, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetColumnWidth($loglistview, 0, 70) _GUICtrlListView_SetColumnWidth($loglistview, 1, 70) _GUICtrlListView_SetColumnWidth($loglistview, 2, 70) _GUICtrlListView_SetColumnWidth($loglistview, 3, 70) _GUICtrlListView_SetColumnWidth($loglistview, 4, 300) GUICtrlCreateListViewItem("Some1|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some2|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some3|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some4|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some5|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some6|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some7|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some8|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some9|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some10|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some11|info|will|be|added", $loglistview) $logedit = GUICtrlCreateEdit("", 10, 255, 520, 245, $WS_VSCROLL + $WS_HSCROLL + $ES_READONLY) GUICtrlSetBkColor($logedit, "0xffffff") $dellog = GUICtrlCreateButton("&Delete", 20, 220, 160) $emaillog = GUICtrlCreateButton("&Mail", 190, 220, 160) $printlog = GUICtrlCreateButton("&Print", 360, 220, 160) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") _GUICtrlListView_ClickItem($loglistview, 0) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $dellog processlogs("delete") Case $printlog processlogs("print") Case $emaillog processlogs("mail") EndSwitch WEnd GUIDelete() Exit Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $loglistview If Not IsHWnd($loglistview) Then $hWndListView = GUICtrlGetHandle($loglistview) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button $item = _GUICtrlListView_GetItemTextArray($loglistview, -1) GUICtrlSetData($logedit, $item[1]) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func processlogs($action) MsgBox(0,"To be done",$action) EndFunc ;==>processlogs
guinness Posted December 12, 2011 Posted December 12, 2011 You have a couple of choices, have a look in the Help file for GUICtrlSetResizing as well as ControlGetPos/WinGetPos to get the position of the controls as well as the GUI window. About the Up/Down arrows perhaps GUISetAccelerators is what you're looking for e.g. {UP} & {DOWN}. You seem like a user who is willing to try, so I have no doubt you shouldn't find it a problem to implement these into your code. 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
Allow2010 Posted December 12, 2011 Author Posted December 12, 2011 Thanks for the hints, i will try to do some reading on the things you mentioned:-)
guinness Posted December 12, 2011 Posted December 12, 2011 You're welcome and good luck. 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
Allow2010 Posted December 12, 2011 Author Posted December 12, 2011 (edited) OK, now the gui resizes as i want it to, but i still have an issue with the space between listview and edit (where the buttons are), This space should be fixed and now the space get bigger or smaller depending on how i resize the window...could not figure out how to fix that... Also setting a minimal heigth and width would be good...how can i limit that? expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <Constants.au3> #include <GuiListView.au3> $hGUI = GUICreate("My GUI", 540, 500,-1,-1,BitOR($WS_SIZEBOX,$WS_SYSMENU)) $loglistview = GUICtrlCreateListView("Info1|Info2|Info3|Info4|Info5", 10, 10, 520, 200, $LVS_SHOWSELALWAYS) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT + $GUI_DOCKTOP) _GUICtrlListView_SetColumnWidth($loglistview, 0, 70) _GUICtrlListView_SetColumnWidth($loglistview, 1, 70) _GUICtrlListView_SetColumnWidth($loglistview, 2, 70) _GUICtrlListView_SetColumnWidth($loglistview, 3, 70) _GUICtrlListView_SetColumnWidth($loglistview, 4, 300) GUICtrlCreateListViewItem("Some1|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some2|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some3|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some4|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some5|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some6|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some7|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some8|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some9|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some10|info|will|be|added", $loglistview) GUICtrlCreateListViewItem("Some11|info|will|be|added", $loglistview) $logedit = GUICtrlCreateEdit("", 10, 255, 520, 210, $WS_VSCROLL + $WS_HSCROLL + $ES_READONLY) GUICtrlSetBkColor($logedit, "0xffffff") $dellog = GUICtrlCreateButton("&Delete", 20, 220, 160) GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKHCENTER) $emaillog = GUICtrlCreateButton("&Mail", 190, 220, 160) GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKHCENTER) $printlog = GUICtrlCreateButton("&Print", 360, 220, 160) GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKHCENTER) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") _GUICtrlListView_ClickItem($loglistview, 0) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $dellog processlogs("delete") Case $printlog processlogs("print") Case $emaillog processlogs("mail") EndSwitch WEnd GUIDelete() Exit Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $loglistview If Not IsHWnd($loglistview) Then $hWndListView = GUICtrlGetHandle($loglistview) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button $item = _GUICtrlListView_GetItemTextArray($loglistview, -1) GUICtrlSetData($logedit, $item[1]) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func processlogs($action) MsgBox(0,"To be done",$action) EndFunc ;==>processlogs Edited December 12, 2011 by WPA-Fan
guinness Posted December 12, 2011 Posted December 12, 2011 Right now I don't have the time but you could play around with the docking values or have a look at WM_SIZE (search the forum for examples.) 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
Allow2010 Posted December 12, 2011 Author Posted December 12, 2011 Thanks anyway...if anyone has an idea, please feel free to mention it...i am trying for a while now wihout luck...
guinness Posted December 12, 2011 Posted December 12, 2011 Did you try WM_SIZE? 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
Moderators Melba23 Posted December 12, 2011 Moderators Posted December 12, 2011 WPA-Fan & guinness, I am working on a WM_SIZE example at the moment. Stick around for a while. 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
guinness Posted December 12, 2011 Posted December 12, 2011 Thanks Melba, next time it's my turn. 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
Allow2010 Posted December 12, 2011 Author Posted December 12, 2011 I am working on a WM_SIZE example at the moment. Stick around for a while. Thanks, sounds great...
Moderators Melba23 Posted December 12, 2011 Moderators Posted December 12, 2011 WPA-Fan,That was harder than i thought it was going to be" The answer seems to be to let the top control resize itself automatically and then we move the lower controls within the WM_SIZE handler to fit into the rest of the GUI. This is what I came up with: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <Constants.au3> #include <GuiListView.au3> ; Create the GUI $hGUI = GUICreate("My GUI", 540, 500, -1, -1, BitOR($WS_SIZEBOX, $WS_SYSMENU)) ; Create the ListView $hLV = GUICtrlCreateListView("", 10, 10, 520, 190) GUICtrlSetBkColor(-1, 0xFFCCCC) ; Allow this to resize automatically GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP) ; Create buttons $hButton_1 = GUICtrlCreateButton("Test 1", 10, 210, 160, 30) $hButton_2 = GUICtrlCreateButton("Test 2", 190, 210, 160, 30) $hButton_3 = GUICtrlCreateButton("Test 3", 370, 210, 160, 30) ; Create Edit $hEdit = GUICtrlCreateEdit("", 10, 250, 520, 210) GUICtrlSetBkColor(-1, 0xCCFFCC) GUISetState() ; Register the SIZE message GUIRegisterMsg($WM_SIZE, "_WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam) ; If it is our GUI If $hWnd = $hGUI Then ; Get the new size of the GUI $iGUIWidth = BitAND($lParam, 0xFFFF) $iGUIHeight = BitShift($lParam, 16) ; Find position of ListView $aLVPos = ControlGetPos($hGUI, "", $hLV) ; Determine width of buttons $iButton_Width = Int(($iGUIWidth - 60) / 3) ; Work out positions for the buttons and edit $iY_Button = $aLVPos[1] + $aLVPos[3] + 10 $iY_Edit = $iY_Button + 40 $iButtonX_1 = 10 $iButtonX_2 = 30 + $iButton_Width $iButtonX_3 = 50 + $iButton_Width + $iButton_Width ; Determine Height if Edit $iEdit_Ht = $iGUIHeight - $iY_Edit - 10 ; Move buttons and Edit GUICtrlSetPos($hButton_1, $iButtonX_1, $iY_Button, $iButton_Width, 30) GUICtrlSetPos($hButton_2, $iButtonX_2, $iY_Button, $iButton_Width, 30) GUICtrlSetPos($hButton_3, $iButtonX_3, $iY_Button, $iButton_Width, 30) GUICtrlSetPos($hEdit, 10, $iY_Edit, $iGUIWidth - 20, $iEdit_Ht) EndIf EndFuncLet me know if it not what you want. By the way, if you want to limit the max and min sizes of the GUI, that is really easy. 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
Allow2010 Posted December 12, 2011 Author Posted December 12, 2011 First of all: Thanks a lot for your Help !!! I do not have much time now, but will try to continue tomorrow... One quick thing: take a look at the screenshot...this happends when the gui gets to wide...
Moderators Melba23 Posted December 12, 2011 Moderators Posted December 12, 2011 (edited) WPA-Fan,I obviously did not test it enough! Very interesting - let me have a look into it. Any thoughts on size limits? M23Edit:It seems to work perfectly if you limit the width of the buttons! expandcollapse popup#include <guiconstantsex.au3> #include <windowsconstants.au3> #include <editconstants.au3> #include <staticconstants.au3> #include <constants.au3> #include <guilistview.au3> ; Create the GUI $hGUI = GUICreate("My GUI", 540, 500, -1, -1, BitOR($WS_SIZEBOX, $WS_SYSMENU)) ; Create the ListView $hLV = GUICtrlCreateListView("", 10, 10, 520, 190) GUICtrlSetBkColor(-1, 0xFFCCCC) ; Allow this to resize automatically GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP) ; Create buttons $hButton_1 = GUICtrlCreateButton("Test 1", 10, 210, 160, 30) $hButton_2 = GUICtrlCreateButton("Test 2", 190, 210, 160, 30) $hButton_3 = GUICtrlCreateButton("Test 3", 370, 210, 160, 30) ; Create Edit $hEdit = GUICtrlCreateEdit("", 10, 250, 520, 210) GUICtrlSetBkColor(-1, 0xCCFFCC) GUISetState() ; Register the SIZE message GUIRegisterMsg($WM_SIZE, "_WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam) ; If it is our GUI If $hWnd = $hGUI Then ; Get the new size of the GUI $iGUIWidth = BitAND($lParam, 0xFFFF) $iGUIHeight = BitShift($lParam, 16) ; Find position of ListView $aLVPos = ControlGetPos($hGUI, "", $hLV) ; Determine width of buttons $iButton_Width = Int(($iGUIWidth - 60) / 3) $iButton_Width_Limit = 262 ; <<<<<<<<<<<<<<<<<<<<<<<<<<< If $iButton_Width > $iButton_Width_Limit Then $iButton_Width = $iButton_Width_Limit EndIf ; Work out positions for the buttons and edit $iY_Button = $aLVPos[1] + $aLVPos[3] + 10 $iY_Edit = $iY_Button + 40 $iButtonX_1 = 10 $iButtonX_2 = Int(($iGUIWidth / 2) - ($iButton_Width / 2)) ;$iButtonX_3 = 50 + $iButton_Width + $iButton_Width $iButtonX_3 = $iGUIWidth - $iButton_Width - 10 ; Determine Height if Edit $iEdit_Ht = $iGUIHeight - $iY_Edit - 10 ; Move buttons and Edit GUICtrlSetPos($hButton_1, $iButtonX_1, $iY_Button, $iButton_Width, 30) GUICtrlSetPos($hButton_2, $iButtonX_2, $iY_Button, $iButton_Width, 30) GUICtrlSetPos($hButton_3, $iButtonX_3, $iY_Button, $iButton_Width, 30) GUICtrlSetPos($hEdit, 10, $iY_Edit, $iGUIWidth - 20, $iEdit_Ht) EndIf EndFuncSet the limit (<<<<<<<) any higher and the button misbehaves when you move it. I shall try and find out why - but I hope this help in the meantime. See post #19 below for correct solution! Edited December 13, 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
Allow2010 Posted December 13, 2011 Author Posted December 13, 2011 This works quite well and the complete gui is resizable... After playing with it for a while i was thinking that it might be better if the buttons coud keep their inital size (they look very big and strange if i resize the gui). Also i did not figure out how i can limit the size of the window (without making it flicker very much)...any hints on how this can be achieved would be nice...thank you !
Moderators Melba23 Posted December 13, 2011 Moderators Posted December 13, 2011 WPA-Fan,Here is a version with fixed size button and limits on the GUI max/min size: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <Constants.au3> #include <GuiListView.au3> ; Create the GUI $hGUI = GUICreate("My GUI", 540, 500, -1, -1, BitOR($WS_SIZEBOX, $WS_SYSMENU)) ; Create the ListView $hLV = GUICtrlCreateListView("", 10, 10, 520, 190) GUICtrlSetBkColor(-1, 0xFFCCCC) ; Allow this to resize automatically GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP) ; Create buttons $hButton_1 = GUICtrlCreateButton("Test 1", 10, 210, 160, 30) $hButton_2 = GUICtrlCreateButton("Test 2", 190, 210, 160, 30) $hButton_3 = GUICtrlCreateButton("Test 3", 370, 210, 160, 30) ; Create Edit $hEdit = GUICtrlCreateEdit("", 10, 250, 520, 210) GUICtrlSetBkColor(-1, 0xCCFFCC) GUISetState() ; Register the SIZE and MINMAX messages GUIRegisterMsg($WM_SIZE, "_WM_SIZE") GUIRegisterMsg($WM_GETMINMAXINFO, "_WM_GETMINMAXINFO") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam) ; If it is our GUI If $hWnd = $hGUI Then ; Get the new size of the GUI $iGUIWidth = BitAND($lParam, 0xFFFF) $iGUIHeight = BitShift($lParam, 16) ; Find position of ListView $aLVPos = ControlGetPos($hGUI, "", $hLV) ; Set width of buttons $iButton_Width = 160 ; Work out positions for the buttons and edit $iY_Button = $aLVPos[1] + $aLVPos[3] + 10 $iY_Edit = $iY_Button + 40 $iButtonX_1 = 10 $iButtonX_2 = ($iGUIWidth - $iButton_Width) / 2 $iButtonX_3 = $iGUIWidth - $iButton_Width - 10 ; Determine Height of Edit $iEdit_Ht = $iGUIHeight - $iY_Edit - 10 ; Move buttons and Edit GUICtrlSetPos($hButton_1, $iButtonX_1, $iY_Button) GUICtrlSetPos($hButton_2, $iButtonX_2, $iY_Button) GUICtrlSetPos($hButton_3, $iButtonX_3, $iY_Button) GUICtrlSetPos($hEdit, 10, $iY_Edit, $iGUIWidth - 20, $iEdit_Ht) EndIf EndFunc Func _WM_GETMINMAXINFO($hwnd, $Msg, $wParam, $lParam) If $hWnd = $hGUI Then $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) DllStructSetData($tagMaxinfo, 7, 540) ; min X DllStructSetData($tagMaxinfo, 8, 230) ; min Y DllStructSetData($tagMaxinfo, 9, 800) ; max X DllStructSetData($tagMaxinfo, 10, 600) ; max Y Return 0 EndIf EndFunc ;==>WM_GETMINMAXINFOObviously you can set the limits to suit you - but the current min X value prevents the buttons from overlapping. And thanks for the original question. You have got a couple of us scratching our heads over the misplaced button problem - which keeps us off the streets at night. 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
Allow2010 Posted December 13, 2011 Author Posted December 13, 2011 (edited) And thanks for the original question. You have got a couple of us scratching our heads over the misplaced button problem - which keeps us off the streets at night. :-)Thank YOU very much for your help. I got much more than i expected and i am really happy that my gui now works...I am still studying the details and i am sure i will learn quite a bit from your example... Edited December 13, 2011 by WPA-Fan
Moderators Melba23 Posted December 13, 2011 Moderators Posted December 13, 2011 WPA-Fan, Do ask if you have questions - that is why we are here! 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
Moderators Melba23 Posted December 13, 2011 Moderators Posted December 13, 2011 WPA-Fan, I found (or rather was told) the solution to the crazy buttons. Windows was running its own resizing code along with ours - I needed to tell it not to bother: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <Constants.au3> #include <GuiListView.au3> ; Create the GUI $hGUI = GUICreate("My GUI", 540, 500, -1, -1, BitOR($WS_SIZEBOX, $WS_SYSMENU)) ; Create the ListView $hLV = GUICtrlCreateListView("", 10, 10, 520, 190) GUICtrlSetBkColor(-1, 0xFFCCCC) ; Create buttons $hButton_1 = GUICtrlCreateButton("Test 1", 10, 210, 160, 30) $hButton_2 = GUICtrlCreateButton("Test 2", 190, 210, 160, 30) $hButton_3 = GUICtrlCreateButton("Test 3", 370, 210, 160, 30) ; Create Edit $hEdit = GUICtrlCreateEdit("", 10, 250, 520, 210) GUICtrlSetBkColor(-1, 0xCCFFCC) GUISetState() ; Register the SIZE message GUIRegisterMsg($WM_SIZE, "_WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam) ; If it is our GUI If $hWnd = $hGUI Then ; Get the new size of the GUI $iGUIWidth = BitAND($lParam, 0xFFFF) $iGUIHeight = BitShift($lParam, 16) ; Determine height of ListView $iLV_Ht = Int(($iGUIHeight / 2) - 25) ; Determine width of buttons $iButton_Width = Int(($iGUIWidth - 60) / 3) ; Work out positions for the buttons and edit $iY_Button = 10 + $iLV_Ht + 10 $iY_Edit = $iY_Button + 40 $iButtonX_1 = 10 $iButtonX_2 = Int(($iGUIWidth / 2) - ($iButton_Width / 2)) $iButtonX_3 = $iGUIWidth - $iButton_Width - 10 ; Determine height of Edit $iEdit_Ht = $iGUIHeight - $iY_Edit - 10 ; Move controls GUICtrlSetPos($hLV, 10, 10, $iGUIWidth - 20, $iLV_Ht) GUICtrlSetPos($hButton_1, $iButtonX_1, $iY_Button, $iButton_Width, 30) GUICtrlSetPos($hButton_2, $iButtonX_2, $iY_Button, $iButton_Width, 30) GUICtrlSetPos($hButton_3, $iButtonX_3, $iY_Button, $iButton_Width, 30) GUICtrlSetPos($hEdit, 10, $iY_Edit, $iGUIWidth - 20, $iEdit_Ht) Return 0 ; Tell Windows not to run its own resizing code <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< EndIf EndFunc My learning point for today - well the first one at least! 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
phinuts Posted March 24, 2012 Posted March 24, 2012 (edited) My learning point for today - well the first one at least! Hi Melba23, I'm newbie and really thanks for the codes, I'm learning from you now. I add $WS_CLIPCHILDREN to main GUI so to stop it from flickering, but it's no use and the list view now scrolled up. Maybe because we work the script with control IDs So I re-write it with _WinAPI_ ... to get a handles to work with, and it works - sort of. It's not flickering but the colors doesn't works and now when the mouse moves the main GUI just a little move, the list view jump down only once for the first time. Maybe I should look into it more, but thanks for the codes anyway. Your , solve my . Thank you. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiRichEdit.au3> #include <GuiListView.au3> #include <GuiButton.au3> OnAutoItExitRegister("EXIT_STATE") ; Create the GUI $hGUI = GUICreate("My GUI", 540, 500, -1, -1, BitOR($WS_SIZEBOX, $WS_SYSMENU, $WS_CLIPCHILDREN)) ; Create the ListView $hLV = _GUICtrlListView_Create ($hGUI, "", 10, 10, 520, 190);190 - 245 <<== heigth of this list view is "jump down" when resizing _GUICtrlListView_SetBkColor ($hLV, 0xFFCCCC) ; <<== does not works. the color are supposed to be something like light red not light blue ; Create buttons $hButton_1 = _GUICtrlButton_Create ($hGUI, "Test 1", 10, 210, 160, 30) $hButton_2 = _GUICtrlButton_Create ($hGUI, "Test 2", 190, 210, 160, 30) $hButton_3 = _GUICtrlButton_Create ($hGUI, "Test 3", 370, 210, 160, 30) ; Create Edit $hEdit = _GUICtrlRichEdit_Create ($hGUI, "", 10, 250, 520, 210) _WinAPI_SetBkColor ($hEdit, 0xCCFFCC) ; <<== does not works, no color GUISetState() ; Register the SIZE message GUIRegisterMsg($WM_SIZE, "_WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func EXIT_STATE() _GUICtrlRichEdit_Destroy($hEdit) ; <<== must have for rich edit EndFunc ;==>EXIT_STATE Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam) ; If it is our GUI If $hWnd = $hGUI Then ; Get the new size of the GUI $iGUIWidth = BitAND($lParam, 0xFFFF) $iGUIHeight = BitShift($lParam, 16) ; Determine height of ListView $iLV_Ht = Int(($iGUIHeight / 2) - 25) ; Determine width of buttons $iButton_Width = Int(($iGUIWidth - 60) / 3) ; Work out positions for the buttons and edit $iY_Button = 10 + $iLV_Ht + 10 $iY_Edit = $iY_Button + 40 $iButtonX_1 = 10 $iButtonX_2 = Int(($iGUIWidth / 2) - ($iButton_Width / 2)) $iButtonX_3 = $iGUIWidth - $iButton_Width - 10 ; Determine height of Edit $iEdit_Ht = $iGUIHeight - $iY_Edit - 10 ; Move controls WinMove ($hLV, "", 10, 10, $iGUIWidth - 20, $iLV_Ht) WinMove ($hButton_1, "", $iButtonX_1, $iY_Button, $iButton_Width, 30) WinMove ($hButton_2, "", $iButtonX_2, $iY_Button, $iButton_Width, 30) WinMove ($hButton_3, "",$iButtonX_3, $iY_Button, $iButton_Width, 30) WinMove ($hEdit, "", 10, $iY_Edit, $iGUIWidth - 20, $iEdit_Ht) Return $GUI_RUNDEFMSG ; >>>> This tells AutoIt to process the message itself ; >>>> http://www.autoitscript.com/wiki/GUIRegisterMsg <<< EndIf EndFunc Edited March 24, 2012 by phinuts
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