Search the Community
Showing results for tags 'guieventoptions'.
-
Has anybody else noticed that Windows 7 reacts ignorantly when you use the Windows key + arrow key shortcuts on a GUI with GUIEventMode set to 1? I discovered this recently when I was working on an app where I wanted complete control over the maximize/minimize buttons. Just give it a spin: #include <GUIConstants.au3> Opt('GUIEventOptions', 1) $hGUI = GUICreate('', 300, 200, Default, Default, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX)) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_MAXIMIZE ToolTip('Maximized') Case $GUI_EVENT_MINIMIZE ToolTip('Minimized') Case $GUI_EVENT_RESTORE ToolTip('Restored') Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Run that, then hit Win+Up or Win+Down. None of those events get triggered, and it still maximizes/minimizes. Although I can't get it to restore down from a maximize unless the window is also resizable ($WS_THICKFRAME in the style). Is there a way to stop Windows from doing what it wants or is the only option to check with WinGetState() and then change it back? Windows 10 seems to respect my settings, and I don't have any other versions to test on.
-
- guieventoptions
- opt
-
(and 1 more)
Tagged with:
-
Hi all, Can anyone tell me please, how to make my GUI stop moving/resizing elements that lays below $hInput (editbox) when I am trying to change the window size? The problem is that when I try to initialize my GUI 23px high I dont even get the buttons drawn, and if I try to redraw the window to smaller one, all elements get stuck together. All I want to do is to have a simple GUI, initialized with edit box only, and to have a window slowly expand if user type: add %s (command). ; INCLUDES #Region - INCLUDES #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> #include <Array.au3> #include <WinAPI.au3> #EndRegion #Region - OPTIONS Opt("GUIOnEventMode", 1) Opt("GUIEventOptions", 1) ;0=default, 1=just notification, 2=GUICtrlRead tab index #endregion #Region - GLOBAL VARIABLES Global Enum $Title, $Handle, $X, $Y, $Width, $Height, $isVisible, $isActive Global Enum $Short, $Long Global Enum $Len=0, $Client, $Order, $Year Global $hGUI Global $AI[7], $HP[8] $AI[$Title] = "Illustrator" $HP[$Title] = "Helper" $HP[$Handle] = $hGUI $HP[$isVisible] = True $HP[$isActive] = True $HP[$Y] = 2 $HP[$Width] = 160 $HP[$Height] = 23 Global $aClient[][] = [ ["SHORT", "LONG"], ["1st", "First client"], ["2nd", "Second client"] ] Global $tAutoExit = TimerInit() #EndRegion #Region - GUI ; GUI INITIALIZATION $hGUI = GUICreate("Helper", 160, 110, Default, 2, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST,$WS_EX_TRANSPARENT)) ;~ GUISetBkColor(0x3399FF) $hInput = GUICtrlCreateInput("", 0, 0, 160, 23) GUICtrlSetOnEvent($hInput, "InputHandler") $Button1 = GUICtrlCreateButton("File", 8, 28, 145, 22) $Button2 = GUICtrlCreateButton("Folder", 8, 50, 145, 22) $Button3 = GUICtrlCreateButton("Win Search", 8, 72, 145, 22) GUISetState(@SW_SHOW) Sleep(2000) WinMove($HP[$Title], "", Default, Default, Default, 23, 3) #EndRegion GUI #Region - MAIN LOOP While 1 CheckForRequest($HP) AutoExit(10) Sleep(10) WEnd #EndRegion #Region - FUNCTIONS Func AutoExit($iSeconds) If TimerDiff($tAutoExit) > $iSeconds*1000 Then Exit EndFunc Func CheckForRequest($vObject) If $vObject[$isActive] And _IsPressed("1B") Then Fade($HP) If (_IsPressed("12") And _IsPressed("C0")) Then Fade($HP) EndFunc Func InputHandler() Local $sMsg = GUICtrlRead(@GUI_CtrlId) ConsoleWrite("+ Command: " & $sMsg & @CRLF) Switch $sMsg Case "bye" ConsoleWrite("> Exiting... " & @CRLF) Exit Case "ai" ConsoleWrite("> " & $AI[$Title] & @CRLF) Case "hp" ConsoleWrite("> " & $HP[$Title] & @CRLF) Case StringInStr($sMsg, " ") <> False GetArgs($sMsg) Case Else EndSwitch Fade($HP) EndFunc Func GetArgs($sMsg) Local $aMsg = StringSplit($sMsg, " ") Switch $aMsg[0] Case 2 To 3 isClientFolder($aMsg) isNewCommand($aMsg) EndSwitch EndFunc Func isNewCommand($aArgs) If $aArgs < 2 Then Return -1 Switch $aArgs[1] Case "add" CommandAdd($aArgs[2]) Case "del" CommandDel($aArgs[2]) EndSwitch EndFunc Func CommandAdd($vVar) Local $t = 0 ConsoleWrite("-> Adding new command..." & @CRLF) WinMove($HP[$Title], "", Default, Default, Default, 140, 1) GUICtrlSetState($Button1, $GUI_SHOW) While $t < 4 $t += 1 Sleep(1000) WEnd EndFunc Func CommandDel($vVar) ConsoleWrite("-> Removing existing command..." & @CRLF) EndFunc Func isClientFolder($aArgs) Local $aSearch = _ArraySearch($aClient, $aArgs[$Client]) Local $hSearch, $sFileName = "" Local $aOrderNo, $sOrderNo, $sOrderName, $nOrder=1 Local $sPath = "D:\" Local $iYear = "2015" ; Check if user is looking for client folder If $aSearch=-1 Then Return -1 ; Check if user have specified the year If ($aArgs[$Len]=3 And ($aArgs[3]>11 And $aArgs[3]<15)) Then $iYear = "20" & $aArgs[$Year] EndIf ; Set up new working path $sPath &= $iYear & "\" $sPath &= $aClient[$aSearch][$Long] & "\" ; Reorder? $aOrder = StringSplit($aArgs[$Order], ".") $sOrderNo = $iYear ; Deep search Do FileChangeDir($sPath) $sOrderNo &= "."& $aOrder[$nOrder] $hSearch = FileFindFirstFile($sOrderNo &"*") $sFileName = FileFindNextFile($hSearch) FileClose($hSearch) If $sFileName = "" Then Return -1 Else $sPath &= "\" & $sFileName &"\" EndIf $nOrder += 1 Until $nOrder > $aOrder[$Len] ShellExecute($sPath, "", "", "open") EndFunc Func Fade(ByRef $vObject) If $HP[$isVisible] Then For $i=255 To 0 Step -1 WinSetTrans($vObject[$Title], "", $i) If IsInt($i/10) Then Sleep(2) Next GUICtrlSetData($hInput, "") Else For $i=0 To 255 Step 1 WinSetTrans($vObject[$Title], "", $i) If IsInt($i/10) Then Sleep(2) Next EndIf $vObject[$isVisible] = Not $vObject[$isVisible] $vObject[$isActive] = Not $vObject[$isActive] EndFunc #endregion