Search the Community
Showing results for tags 'Accelerators'.
-
I was playing with guiframe udf and it seems like it breaks accelerators. Meaning Alt+"underlined letter" does nothing. What am I missing? Below is what I am having trouble with. I do not like to use hotkeys because I think they are they make the script look sloppy, interfering and hard to follow IMHO. BTW not using accelerators is not an option, mouses are for "slow" people, I would rather give up go home and cry than use the mouse. /melodramatics #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIFrame.au3" #include <Array.au3> ;~ Glbal $iSep_Pos #include <Misc.au3> #include<string.au3> ;~ #include<_CArray.au3> If _Singleton("Single", 1) = 0 Then ;only on instance running Exit EndIf _main() Func _main() _GuiCreate() EndFunc ;==>_main Func _GuiCreate() Local $aAccelartors[1] $hGUI = GUICreate("GUI_Frame Example 1", @DesktopWidth, @DesktopHeight, -1, -1, BitOR($WS_MAXIMIZE, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUISetState() $hMenu=GUICtrlCreateMenu(_EasyAccelerator($aAccelartors,"Title")) ; Create a 1st level frame $iFrame_Main = _GUIFrame_Create($hGUI, 0, 200) _GUIFrame_SetMin($iFrame_Main, 50, 100) _GUIFrame_Switch($iFrame_Main, 2) $aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_Main, 2)) ;~ GUICtrlCreateLabel("", 5, 5, $aWinSize[0] - 5, $aWinSize[1] - 5) ;~ GUICtrlSetBkColor(-1, 0xFF0000) ;~ GUICtrlSetState(-1, $GUI_DISABLE) $hButton_1 = GUICtrlCreateButton(_EasyAccelerator($aAccelartors,"Pos Sep"), 10, 10, 50, 30) ; Create a 2nd level frame Left $iFrame_Left = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_Main, 1), 1, $aWinSize[1] * .7) GUISetBkColor(0x00FF00, _GUIFrame_GetHandle($iFrame_Left, 1)) _GUIFrame_SetMin($iFrame_Left, 10, 10) _GUIFrame_Switch($iFrame_Left, 1) $hButton_2 = GUICtrlCreateButton("Po&s Sep", 10, 10, 50, 30) ; Create a 2nd level frame Left $iFrame_Right = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_Main, 2), 1) GUISetBkColor(0x00FF00, _GUIFrame_GetHandle($iFrame_Right, 1)) _GUIFrame_SetMin($iFrame_Right, 10, 10) _GUIFrame_Switch($iFrame_Right, 2) ;~ $hButton_3 = GUICtrlCreateButton(_EasyAccelerator($aAccelartors,"Pos Sep"), 10, 10, 50, 30) _GUIFrame_ResizeSet(0) _GUIFrame_ResizeReg() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ; The UDF does all the tidying up as you exit Exit Case $hMenu MsgBox(0,"",'arg') Case $hButton_1 MsgBox(0,"","Oh nohz! You clicked button 1") Case $hButton_2 MsgBox(0,"",'barf') ;~ $iRet = _GUIFrame_SetSepPos($iFrame_Left, 310) ;~ $iSep_Pos = _GUIFrame_GetSepPos($iFrame_Left) ;~ GUICtrlSetData($hButton_2, $iSep_Pos) Sleep(1000) ;~ GUICtrlSetData($hButton_2, "Sep Pos") EndSwitch WEnd EndFunc ;==>_GuiCreate Func _EasyAccelerator(ByRef $aEasyAccelerator, $sTitleString) _ArraySort($aEasyAccelerator) ;~ _CArray($aEasyAccelerator) For $iX = 1 To StringLen($sTitleString) $sLetter = StringMid($sTitleString, $iX, 1) _log(_ArrayBinarySearch($aEasyAccelerator, $sLetter)) If _ArrayBinarySearch($aEasyAccelerator, $sLetter)=-1 Then _ArrayAdd($aEasyAccelerator, $sLetter) $sTitleString=_StringInsert($sTitleString,"&",$ix-1) Return ($sTitleString) Else ContinueLoop EndIf Next Return $aEasyAccelerator EndFunc ;==>_EasyAccelerator func _log($sMSG) ConsoleWrite(@lf&$sMSG) EndFunc below is a repost of the guiframe UDF