computergroove Posted December 28, 2015 Share Posted December 28, 2015 I want to click a button and toggle a GUI Size. I can get it to work for one toggle if I delete the GUI and then call the Main function again but it only works once and when I do this I cannot close the window with the x in the upper right corner. Here is my code:expandcollapse popup#include <GUIConstantsEx.au3> Global $GUI, $fStartMonday = False, $iGridSize = 1, $sTheme = "Blue", $GUIBackX = 800, $GUIBackY = 600, $CalXPos = 20, $CalYPos = 40, $CalWidth = 760, $CalHeight = 520, $CalFontSize = 30, $ToggleSizeValue = 1 _Main() Func _Main() Local $GUI = GUICreate("Calendar example", $GUIBackX, $GuiBackY, -1, -1) Opt("GUIOnEventMode",1) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetState();Makes the GUI visible to the user GUICtrlCreateButton("Toggle Size", 20, 20, 150, 20) GUICtrlSetOnEvent(-1, "Btn_ToggleSize") While 1 Sleep(50) WEnd EndFunc Func _Exit() Exit 0 EndFunc Func Btn_ToggleSize() If $ToggleSizeValue == 1 Then ;1024 x 768 $ToggleSizeValue = 2 $GUIBackX = 1024 $GUIBackY = 768 $CalXPos = 20 $CalYPos = 40 $CalWidth = 984 $CalHeight = 688 GUIDelete($GUI) _Main() ElseIf $ToggleSizeValue == 2 Then ; 1280 x 1024 $ToggleSizeValue = 3 $GUIBackX = 1280 $GUIBackY = 1024 $CalXPos = 20 $CalYPos = 40 $CalWidth = 1240 $CalHeight = 944 GUIDelete($GUI) _Main() Else $ToggleSizeValue = 1; 800 x 600 $GUIBackX = 800 $GUIBackY = 600 $CalXPos = 20 $CalYPos = 40 $CalWidth = 760 $CalHeight = 520 GUIDelete($GUI) _Main() EndIf EndFuncWhat should I do to refresh the size settings on the GUI without recreating it? Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
InunoTaishou Posted December 28, 2015 Share Posted December 28, 2015 (edited) WinMove can resize it without deleting the GUIFunc Btn_ToggleSize() Local const $abscoord_gui = WinGetPos($GUI) If $ToggleSizeValue == 1 Then ;1024 x 768 $ToggleSizeValue = 2 $GUIBackX = 1024 $GUIBackY = 768 WinMove($GUI, "", $abscoord_gui[0], $abscoord_gui[1], $GUIBackX, $GUIBackY) ElseIf $ToggleSizeValue == 2 Then ; 1280 x 1024 $ToggleSizeValue = 3 $GUIBackX = 1280 $GUIBackY = 1024 WinMove($GUI, "", $abscoord_gui[0], $abscoord_gui[1], $GUIBackX, $GUIBackY) Else $ToggleSizeValue = 1; 800 x 600 $GUIBackX = 800 $GUIBackY = 600 WinMove($GUI, "", $abscoord_gui[0], $abscoord_gui[1], $GUIBackX, $GUIBackY) EndIf EndFunc Edited December 28, 2015 by InunoTaishou Link to comment Share on other sites More sharing options...
computergroove Posted December 28, 2015 Author Share Posted December 28, 2015 Excellent. That worked. Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html 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