FMS Posted August 17, 2016 Posted August 17, 2016 Hello, Below is a code whish i made for this problem i've. (code 1) The problem is that iff i try Winmove to to show the hidden button it's not working as i tought. What i try to do is just simple expand the GUI to make the hidden button visible. (code 2) I've already looked into GUICoordMode but don't think that's the problem.(or I don't understand it properly) Also tried to look into the forum but din't find anything around this subject but could't find anything around this subject. Does somebody knows what I'm doing wrong? Code 1 (winmove prblem) : #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 134, 103, 192, 124) $Button1 = GUICtrlCreateButton("1", 8, 8, 75, 25) $Button2 = GUICtrlCreateButton("2", 8, 40, 75, 25) $Button3 = GUICtrlCreateButton("3", 8, 72, 75, 25) $expand_button = GUICtrlCreateButton("EXP", 96, 40, 27, 25) $hidden_button = GUICtrlCreateButton("Hidden", 160, 40, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $expand_button WinMove($Form1, "From1", 192, 124, 300, 103) EndSwitch WEnd Code 2 What I'm trying to expand to : #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 265, 114, 192, 124) $Button1 = GUICtrlCreateButton("1", 8, 8, 75, 25) $Button2 = GUICtrlCreateButton("2", 8, 40, 75, 25) $Button3 = GUICtrlCreateButton("3", 8, 72, 75, 25) $expand_button = GUICtrlCreateButton("EXP", 96, 40, 27, 25) $hidden_button = GUICtrlCreateButton("Hidden", 160, 40, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd as finishing touch god created the dutch
water Posted August 17, 2016 Posted August 17, 2016 Melba23 has written a great UDF to do exactly what you want to do. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
AutoBert Posted August 17, 2016 Posted August 17, 2016 Your code will work using the correct resizing mode and valid window-sizes: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIResizeMode", $GUI_DOCKALL) ;0=no resizing, <1024 special resizing $Form1 = GUICreate("Form1", 134, 103, 192, 124) $Button1 = GUICtrlCreateButton("1", 8, 8, 75, 25) $Button2 = GUICtrlCreateButton("2", 8, 40, 75, 25) $Button3 = GUICtrlCreateButton("3", 8, 72, 75, 25) $expand_button = GUICtrlCreateButton("EXP", 96, 40, 27, 25) $hidden_button = GUICtrlCreateButton("Hidden", 160, 40, 75, 25) ;GUICtrlSetState($hidden_button,BitOR($GUI_HIDE,$GUI_DISABLE )) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $expand_button $aWin=WinGetPos($Form1) WinMove($Form1, "", $aWin[0], $aWin[1], 265, $aWin[3]) ;GUICtrlSetState($hidden_button,BitOR($GUI_SHOW,$GUI_ENABLE )) Case $hidden_button $aWin=WinGetPos($Form1) WinMove($Form1, "", $aWin[0], $aWin[1], 134, $aWin[3]) ;GUICtrlSetState($hidden_button,BitOR($GUI_HIDE,$GUI_DISABLE )) MsgBox(64,'Test','Hidden Button clicked') EndSwitch WEnd Test above script: use the tab to tab to hidden button, yes button work also when he isn't visible test the expand button. if isn't espected result post again Remove the semicolons in lines: 12, 23 and 27 and test again.
FMS Posted August 17, 2016 Author Posted August 17, 2016 YESSS totaly what I was looking for. Thanks @AutoBert for the good explanation. also credits to @water , Ive looked into it and think the solution Autobert proposed is little bit simpler to have the same. as finishing touch god created the dutch
water Posted August 17, 2016 Posted August 17, 2016 I'm sure AutoBert's solution perfectly fits your needs whereas Melba's UDF is more of a swiss army knife and does much more My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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