Search the Community
Showing results for tags 'GUIFrame'.
-
I'm making a little chat client, and I'm using Melbas GUIFrame (). I want it, so that when I re-size the window (with min/max sizes) it re-sizes the input and history boxes to match the new window size. That's working fine with re-sizing the whole GUI (using GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")), but when I try to move the frame separator bar, the history box (since it's made with _GUICtrlRichEdit instead of GUICtrlEdit) doesn't update until after you're finished moving the separator. Using the other GUIRegisterMsg, the history edit re-sizes instantly as you move the separator bar, but the other controls in the window don't change at all. Using both at once causes only the second one to work. Is there a way to have both things happen (re-size edits on window and separator bar re-size)? #include <GUIRichEdit.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <WinAPI.au3> #include <GUIEdit.Au3> #include "GUIFrame.au3" #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $GUIMINWID = 300, $GUIMINHT = 100 ;Min window sizes Local $GUIMAXWID = @DesktopWidth, $GUIMAXHT = @DesktopHeight ;Max window sizes $hGUI = GUICreate('MEOW', 500, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUISetState(@SW_SHOW) $iFrames = _GUIFrame_Create($hGUI, 0, 200) ;Creation of the two GUI frames _GUIFrame_ResizeSet(0, 1) ;Required for proper resizing _GUIFrame_ResizeReg() ;Required for proper resizing _GUIFrame_SetMin($iFrames, 150, 200, True) ;Set frame min size _GUIFrame_Switch($iFrames, 2) ;Switch to second frame to create controls $History = _GUICtrlRichEdit_Create(_GUIFrame_Switch($iFrames, 2), 'adsfadsfasdf', 2, 2, 263, 255) $Input = GUICtrlCreateEdit('', 2, 272, 293, 20, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_BORDER), $WS_EX_STATICEDGE) GUICtrlSetFont(-1, 10, 400, 0, "Courier New") GUICtrlSetResizing(-1, 582) ;Resizing parameters GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO") ;~ GUIRegisterMsg($WM_SIZE, "WM_SIZE") $SepPos = _GUIFrame_GetSepPos($iFrames) ;Get the seperator bars current position While 1 Sleep(10) If $SepPos <> _GUIFrame_GetSepPos($iFrames) Then History_Resize() Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($History) Exit EndSwitch WEnd Func WM_GETMINMAXINFO($hwnd, $Msg, $wParam, $lParam) $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) DllStructSetData($tagMaxinfo, 7, $GUIMINWID) ; min X DllStructSetData($tagMaxinfo, 8, $GUIMINHT) ; min Y DllStructSetData($tagMaxinfo, 9, $GUIMAXWID); max X DllStructSetData($tagMaxinfo, 10, $GUIMAXHT) ; max Y History_Resize() Return 0 EndFunc ;==>WM_GETMINMAXINFO Func WM_SIZE($hwnd, $iMsg, $wParam, $lParam) History_Resize() EndFunc ;==>WM_SIZE Func History_Resize() $SepPos = _GUIFrame_GetSepPos($iFrames) $hGpos = WinGetPos($hGUI) $iPos = ControlGetPos($hGUI, '', 'Edit1') _WinAPI_MoveWindow($History, 2, 2, ($hGpos[2] - $SepPos) - 50, $hGpos[3] - $iPos[3] - 55, False) EndFunc ;==>History_Resize
- 7 replies
-
- GUIRegisterMsg
- GUIFrame
-
(and 1 more)
Tagged with:
-
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