Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/25/2013 in all areas

  1. Yashied

    TVExplorer UDF

    LAST VERSION - 1.3 28-Jan-15 Unlike >this, here is a fully ready UDF library. The library allows you to create TreeView (TV) Explorer controls that displays a tree of files and folders for the specified root folder with the specified parameters. TV Explorer controls is self-contained GUI controls that do not require you any further doing. Note that TVExplorer UDF requires >WinAPIEx UDF version 3.3 or later. To create TV Explorer control, just call the _GUICtrlTVExplorer_Create() function. And that's it. If you want to be notified about events such as the changing selection, the beginning and ending of the updating TV Explorer control, mounting and unmounting removeable drives, etc., you must specify a user function to retrieve these notifications, like WM-functions. How it works is shown in the following example. This library can work in "Loop" and "OnEvent" GUI modes. If the "GUIOnEventMode" option is set to 0, you should use _GUICtrlTVExplorer_GetMsg() instead of native GUIGetMsg() function, otherwise, the TV Explorer controls will not work. In using, these two functions are completely equivalent. A more detailed description of all functions you'll find inside the library. Available functions TVExplorer UDF Library v1.2 Previous downloads: 2266 TVExplorer.zip Example 1 #Include <APIConstants.au3> #Include <GUIConstantsEx.au3> #Include <GUITreeView.au3> #Include <TVExplorer.au3> #Include <TreeViewConstants.au3> #Include <WindowsConstants.au3> #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) Global $hForm, $hTV[3], $Input[3], $hFocus = 0, $Dummy, $Path, $Style If Not _WinAPI_DwmIsCompositionEnabled() Then $Style = $WS_EX_COMPOSITED Else $Style = -1 EndIf $hForm = GUICreate('TVExplorer UDF Example', 700, 736, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX), $Style) GUISetIcon(@WindowsDir & '\explorer.exe') $Input[0] = GUICtrlCreateInput('', 20, 20, 320, 19) GUICtrlSetState(-1, $GUI_DISABLE) $hTV[0] = _GUICtrlTVExplorer_Create(@ProgramFilesDir, 20, 48, 320, 310, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent') $Input[1] = GUICtrlCreateInput('', 360, 20, 320, 19) GUICtrlSetState(-1, $GUI_DISABLE) $hTV[1] = _GUICtrlTVExplorer_Create(@UserProfileDir, 360, 48, 320, 310, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent') $Input[2] = GUICtrlCreateInput('', 20, 378, 660, 19) GUICtrlSetState(-1, $GUI_DISABLE) $hTV[2] = _GUICtrlTVExplorer_Create('', 20, 406, 660, 310, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent') For $i = 0 To 2 _TVSetPath($Input[$i], _GUICtrlTVExplorer_GetSelected($hTV[$i])) _GUICtrlTVExplorer_SetExplorerStyle($hTV[$i]) Next $Dummy = GUICtrlCreateDummy() GUIRegisterMsg($WM_GETMINMAXINFO, 'WM_GETMINMAXINFO') GUIRegisterMsg($WM_SIZE, 'WM_SIZE') HotKeySet('{F5}', '_TVRefresh') GUISetState() _GUICtrlTVExplorer_Expand($hTV[0], @ProgramFilesDir & '\AutoIt3') _GUICtrlTVExplorer_Expand($hTV[1]) While 1 Switch _GUICtrlTVExplorer_GetMsg() Case $GUI_EVENT_CLOSE GUIDelete() _GUICtrlTVExplorer_DestroyAll() Exit Case $Dummy $Path = _GUICtrlTVExplorer_GetSelected($hFocus) _GUICtrlTVExplorer_AttachFolder($hFocus) _GUICtrlTVExplorer_Expand($hFocus, $Path, 0) $hFocus = 0 EndSwitch WEnd Func _TVEvent($hWnd, $iMsg, $sPath, $hItem) Switch $iMsg Case $TV_NOTIFY_BEGINUPDATE GUISetCursor(1, 1) Case $TV_NOTIFY_ENDUPDATE GUISetCursor(2) Case $TV_NOTIFY_SELCHANGED For $i = 0 To 2 If $hTV[$i] = $hWnd Then _TVSetPath($Input[$i], $sPath) ExitLoop EndIf Next Case $TV_NOTIFY_DBLCLK ; Nothing Case $TV_NOTIFY_RCLICK ; Nothing Case $TV_NOTIFY_DELETINGITEM ; Nothing Case $TV_NOTIFY_DISKMOUNTED ; Nothing Case $TV_NOTIFY_DISKUNMOUNTED ; Nothing EndSwitch EndFunc ;==>_TVEvent Func _TVSetPath($iInput, $sPath) Local $Text = _WinAPI_PathCompactPath(GUICtrlGetHandle($iInput), $sPath, -2) If GUICtrlRead($iInput) <> $Text Then GUICtrlSetData($iInput, $Text) EndIf EndFunc ;==>_TVSetPath Func _TVRefresh() Local $hWnd = _WinAPI_GetFocus() For $i = 0 To 2 If $hTV[$i] = $hWnd Then If Not $hFocus Then $hFocus = $hWnd GUICtrlSendToDummy($Dummy) EndIf Return EndIf Next HotKeySet('{F5}') Send('{F5}') HotKeySet('{F5}', '_TVRefresh') EndFunc ;==>_TVRefresh Func WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam) Local $tMMI = DllStructCreate('long Reserved[2];long MaxSize[2];long MaxPosition[2];long MinTrackSize[2];long MaxTrackSize[2]', $lParam) Switch $hWnd Case $hForm DllStructSetData($tMMI, 'MinTrackSize', 428, 1) DllStructSetData($tMMI, 'MinTrackSize', 450, 2) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_GETMINMAXINFO Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) Local $WC, $HC, $WT, $HT Switch $hWnd Case $hForm $WC = _WinAPI_LoWord($lParam) $HC = _WinAPI_HiWord($lParam) $WT = Floor(($WC - 60) / 2) $HT = Floor(($HC - 116) / 2) GUICtrlSetPos(_WinAPI_GetDlgCtrlID($hTV[0]), 20, 48, $WT, $HT) GUICtrlSetPos(_WinAPI_GetDlgCtrlID($hTV[1]), $WT + 40, 48, $WC - $WT - 60, $HT) GUICtrlSetPos(_WinAPI_GetDlgCtrlID($hTV[2]), 20, $HT + 96, $WC - 40, $HC - $HT - 116) GUICtrlSetPos($Input[0], 20, 20, $WT) GUICtrlSetPos($Input[1], $WT + 40, 20, $WC - $WT - 60) GUICtrlSetPos($Input[2], 20, $HT + 68, $WC - 40) For $i = 0 To 2 _TVSetPath($Input[$i], _GUICtrlTVExplorer_GetSelected($hTV[$i])) Next Return 0 EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE Example 2 (OnEvent mode) #Include <APIConstants.au3> #Include <GUIConstantsEx.au3> #Include <GUITreeView.au3> #Include <TVExplorer.au3> #Include <TreeViewConstants.au3> #Include <WindowsConstants.au3> #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) Opt('GUIOnEventMode', 1) Global $hForm, $hTV[3], $Input[3], $hFocus = 0, $Dummy, $Style If Not _WinAPI_DwmIsCompositionEnabled() Then $Style = $WS_EX_COMPOSITED Else $Style = -1 EndIf $hForm = GUICreate('TVExplorer UDF Example', 700, 736, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX), $Style) GUISetOnEvent($GUI_EVENT_CLOSE, '_GUIEvent') GUISetIcon(@WindowsDir & '\explorer.exe') $Input[0] = GUICtrlCreateInput('', 20, 20, 320, 19) GUICtrlSetState(-1, $GUI_DISABLE) $hTV[0] = _GUICtrlTVExplorer_Create(@ProgramFilesDir, 20, 48, 320, 310, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent') $Input[1] = GUICtrlCreateInput('', 360, 20, 320, 19) GUICtrlSetState(-1, $GUI_DISABLE) $hTV[1] = _GUICtrlTVExplorer_Create(@UserProfileDir, 360, 48, 320, 310, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent') $Input[2] = GUICtrlCreateInput('', 20, 378, 660, 19) GUICtrlSetState(-1, $GUI_DISABLE) $hTV[2] = _GUICtrlTVExplorer_Create('', 20, 406, 660, 310, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent') For $i = 0 To 2 _TVSetPath($Input[$i], _GUICtrlTVExplorer_GetSelected($hTV[$i])) _GUICtrlTVExplorer_SetExplorerStyle($hTV[$i]) Next $Dummy = GUICtrlCreateDummy() GUICtrlSetOnEvent(-1, '_GUIEvent') GUIRegisterMsg($WM_GETMINMAXINFO, 'WM_GETMINMAXINFO') GUIRegisterMsg($WM_SIZE, 'WM_SIZE') HotKeySet('{F5}', '_TVRefresh') GUISetState() _GUICtrlTVExplorer_Expand($hTV[0], @ProgramFilesDir & '\AutoIt3') _GUICtrlTVExplorer_Expand($hTV[1]) While 1 Sleep(1000) WEnd Func _GUIEvent() Local $Path Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE GUIDelete() _GUICtrlTVExplorer_DestroyAll() Exit Case $Dummy $Path = _GUICtrlTVExplorer_GetSelected($hFocus) _GUICtrlTVExplorer_AttachFolder($hFocus) _GUICtrlTVExplorer_Expand($hFocus, $Path, 0) $hFocus = 0 EndSwitch EndFunc ;==>_GUIEvent Func _TVEvent($hWnd, $iMsg, $sPath, $hItem) Switch $iMsg Case $TV_NOTIFY_BEGINUPDATE GUISetCursor(1, 1) Case $TV_NOTIFY_ENDUPDATE GUISetCursor(2) Case $TV_NOTIFY_SELCHANGED For $i = 0 To 2 If $hTV[$i] = $hWnd Then _TVSetPath($Input[$i], $sPath) ExitLoop EndIf Next Case $TV_NOTIFY_DBLCLK ; Nothing Case $TV_NOTIFY_RCLICK ; Nothing Case $TV_NOTIFY_DELETINGITEM ; Nothing Case $TV_NOTIFY_DISKMOUNTED ; Nothing Case $TV_NOTIFY_DISKUNMOUNTED ; Nothing EndSwitch EndFunc ;==>_TVEvent Func _TVSetPath($iInput, $sPath) Local $Text = _WinAPI_PathCompactPath(GUICtrlGetHandle($iInput), $sPath, -2) If GUICtrlRead($iInput) <> $Text Then GUICtrlSetData($iInput, $Text) EndIf EndFunc ;==>_TVSetPath Func _TVRefresh() Local $hWnd = _WinAPI_GetFocus() For $i = 0 To 2 If $hTV[$i] = $hWnd Then If Not $hFocus Then $hFocus = $hWnd GUICtrlSendToDummy($Dummy) EndIf Return EndIf Next HotKeySet('{F5}') Send('{F5}') HotKeySet('{F5}', '_TVRefresh') EndFunc ;==>_TVRefresh Func WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam) Local $tMMI = DllStructCreate('long Reserved[2];long MaxSize[2];long MaxPosition[2];long MinTrackSize[2];long MaxTrackSize[2]', $lParam) Switch $hWnd Case $hForm DllStructSetData($tMMI, 'MinTrackSize', 428, 1) DllStructSetData($tMMI, 'MinTrackSize', 450, 2) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_GETMINMAXINFO Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) Local $WC, $HC, $WT, $HT Switch $hWnd Case $hForm $WC = _WinAPI_LoWord($lParam) $HC = _WinAPI_HiWord($lParam) $WT = Floor(($WC - 60) / 2) $HT = Floor(($HC - 116) / 2) GUICtrlSetPos(_WinAPI_GetDlgCtrlID($hTV[0]), 20, 48, $WT, $HT) GUICtrlSetPos(_WinAPI_GetDlgCtrlID($hTV[1]), $WT + 40, 48, $WC - $WT - 60, $HT) GUICtrlSetPos(_WinAPI_GetDlgCtrlID($hTV[2]), 20, $HT + 96, $WC - 40, $HC - $HT - 116) GUICtrlSetPos($Input[0], 20, 20, $WT) GUICtrlSetPos($Input[1], $WT + 40, 20, $WC - $WT - 60) GUICtrlSetPos($Input[2], 20, $HT + 68, $WC - 40) For $i = 0 To 2 _TVSetPath($Input[$i], _GUICtrlTVExplorer_GetSelected($hTV[$i])) Next Return 0 EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE
    1 point
  2. I can't test at the moment but I think if you escape the slash the problem should be solved: local $worked = _AD_RemoveUserFromGroup("First Level Review R\/W", $user) The AD UDF provides a function to escape/unescape such characters: _AD_FixSpecialChars
    1 point
  3. I would say this is a specific case which has to be handled by custom code which requires cooperation between the core application and the function. This is not something in the realm of a standard UDF AFAICT. Else we're going to end up making this function work like a departure flight display panel!
    1 point
  4. OMG what a load of bullshit ...
    1 point
  5. Here a another way using windows messaging. #include <GUIConstantsEx.au3> #include <GuiSlider.au3> #include <WindowsConstants.au3> #include <GuiSlider.au3> #include <GuiEdit.au3> Global $TicArray[7] = [0, 5, 30, 50, 70, 90, 100] Local $oldpos = MouseGetPos(0) ; Create GUI $hGUI = GUICreate("Slider Set Tic", 400, 296) $iSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_BOTH, $TBS_ENABLESELRANGE)) $hSlider = GUICtrlGetHandle($iSlider) $edit = GUICtrlCreateEdit("--", 50, 50) GUISetState() _GUICtrlSlider_ClearTics($iSlider) ; Set Tics ArrayTicks($TicArray, $iSlider) Global $iSliderPos = 0, $iPos = 0, $iPosOld = -1, $bUpdate = False GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit ;~ Case $iSlider ;~ While $iSlider ;~ Local $mPos = MouseGetPos(0) ;~ If $oldpos < $mPos Then ;~ _GUICtrlEdit_SetText($edit, "moving right") ;~ ;$oldpos = $mPos ;~ ;ExitLoop ;~ ElseIf $oldpos > $mPos Then ;~ _GUICtrlEdit_SetText($edit, "moving left") ;~ ;$oldpos = $mPos ;~ ;ExitLoop ;~ EndIf ;~ Sleep(250) ;~ $oldpos = $mPos ;~ ExitLoop ;~ WEnd EndSwitch WEnd Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam) #forceref $hWnd, $Msg, $wParam Local $i, $c, $d = 0xFFFFFF, $p Switch $lParam Case $hSlider $iPos = _GUICtrlSlider_GetPos($hSlider) For $i = 0 To UBound($TicArray) - 1 $c = Abs(1 - (($TicArray[$i] + 1) / ($iPos + 1))) If $c < $d Then $d = $c $p = $i EndIf Next _GUICtrlSlider_SetPos($hSlider, $TicArray[$p]) EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_HSCROLL ; Create array tics Func ArrayTicks($array, $CurrentSlider) Local $iMax = UBound($array), $i For $i = 0 To $iMax - 1 _GUICtrlSlider_SetTic($CurrentSlider, $array[$i]) Next EndFunc ;==>ArrayTicks I know that the arrow keys are not working this way. Maybe I will find a solution for this... Br, UEZ
    1 point
  6. taietel

    GUI design concepts.

    I use this template in my projects: #include <GuiConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #region GLOBAL VARIABLES Global $iW = 600, $iH = 400, $iT = 52, $iB = 52, $iLeftWidth = 150, $iGap = 10, $hMainGUI #endregion GLOBAL VARIABLES _MainGui() Func _MainGui() Local $hFooter, $nMsg, $aPos Local $iLinks = 5 Local $sMainGuiTitle = "Sample Title" Local $sHeader = "Sample GUI" Local $sFooter = "2012 © AutoIt" Local $aLink[$iLinks], $aPanel[$iLinks] $aLink[0] = $iLinks - 1 $aPanel[0] = $iLinks - 1 $hMainGUI = GUICreate($sMainGuiTitle, $iW, $iH, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_TABSTOP)) GUISetIcon("shell32.dll", -58, $hMainGUI) GUICtrlCreateLabel($sHeader, 48, 8, $iW - 56, 32, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 14, 800, 0, "Arial", 5) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateIcon("shell32.dll", -131, 8, 8, 32, 32) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateLabel("", 0, $iT, $iW, 2, $SS_SUNKEN);separator GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKHEIGHT) GUICtrlCreateLabel("", $iLeftWidth, $iT + 2, 2, $iH - $iT - $iB - 2, $SS_SUNKEN);separator GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUICtrlCreateLabel("", 0, $iH - $iB, $iW, 2, $SS_SUNKEN);separator GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKHEIGHT) $hFooter = GUICtrlCreateLabel($sFooter, 10, $iH - 34, $iW - 20, 17, BitOR($SS_LEFT, $SS_CENTERIMAGE)) GUICtrlSetTip(-1, "AutoIt Forum", "Click to open...") GUICtrlSetCursor(-1, 0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT) ;add links to the left side $aLink[1] = _AddNewLink("Link 1") $aLink[2] = _AddNewLink("Link 2", -167) $aLink[3] = _AddNewLink("Link 3", -222) $aLink[4] = _AddNewLink("Link 4", -22) ;and the corresponding GUI's $aPanel[1] = _AddNewPanel("Title for the panel 1") $aPanel[2] = _AddNewPanel("Title for the panel 2") $aPanel[3] = _AddNewPanel("Title for the panel 3") $aPanel[4] = _AddNewPanel("Title for the panel 4") ;add some controls to the panels _AddControlsToPanel($aPanel[1]) GUICtrlCreateEdit("", 10, 37, $iW - $iLeftWidth + 2 - 20 - 5, $iH - $iT - $iB - 40, BitOR($ES_AUTOVSCROLL, $ES_NOHIDESEL, $ES_WANTRETURN, $WS_VSCROLL), $WS_EX_STATICEDGE) Local $sTestTxt = "" For $i = 1 To 10 $sTestTxt &= @TAB & "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum felis lectus, pharetra vel laoreet nec, pulvinar nec justo. Donec malesuada, nunc eu faucibus sodales, diam sem tempor neque, id condimentum turpis nunc vel lacus. Nulla a nulla libero, eget eleifend dolor. Vivamus volutpat tincidunt ultricies. Vestibulum eu libero nisi, quis tincidunt nisi. Proin tincidunt, ipsum ullamcorper posuere venenatis, libero nulla venenatis enim, ultrices tincidunt ipsum arcu nec turpis. In at erat sed ipsum gravida mattis in at felis. Vivamus diam purus, dictum ut luctus vitae, sollicitudin ut velit. Maecenas velit mauris, fringilla ut condimentum bibendum, aliquam a neque. Nulla metus eros, commodo id dictum in, interdum sed ipsum. Vivamus feugiat, mi at auctor fringilla, libero lectus vulputate tortor, eu sollicitudin nulla lacus at neque." & @CRLF $sTestTxt &= @TAB & "Sed vel ante magna. Curabitur porttitor ante in tellus bibendum non tristique diam volutpat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In tellus lectus, ultrices in tempus eget, sollicitudin quis eros. Curabitur at arcu bibendum massa feugiat euismod at a felis. Nunc molestie, enim non ornare tincidunt, ipsum nisi tempus sapien, quis elementum elit velit ut neque. Suspendisse eu adipiscing risus. Nam tempor odio ut elit auctor rhoncus. Etiam viverra elit id felis feugiat pellentesque pretium porttitor dui. Vivamus eu quam non ante suscipit vehicula a nec eros. Phasellus congue massa sed libero interdum ullamcorper. Quisque fringilla massa ut lorem fringilla pulvinar eget ullamcorper eros. Praesent faucibus, erat at consequat tempus, nulla erat sodales mi, eget sagittis nibh erat nec nunc. Phasellus risus nibh, porta viverra pretium nec, vehicula eget nisi." & @CRLF $sTestTxt &= @TAB & "Sed vel neque vel urna elementum accumsan feugiat quis mauris. Sed mi nisl, consequat dapibus molestie ac, rutrum ut elit. Praesent sed risus sem. Mauris rutrum blandit magna nec tristique. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse consequat iaculis odio nec cursus. Duis varius tincidunt ligula ac ultricies. Ut eget magna in nulla vulputate dapibus ut vel sem. Integer ac tempor risus." & @CRLF $sTestTxt &= @TAB & "Maecenas molestie semper turpis, id tristique nibh pharetra eget. Aliquam erat volutpat. In egestas, lorem quis varius vestibulum, enim diam porta lorem, quis dictum arcu ante a diam. Nullam vel nisi mauris. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam ut leo purus, eget vulputate augue. Fusce et est sagittis felis accumsan sollicitudin eget a lectus. Cras sapien sapien, rutrum eu tempor non, tempor nec velit. Vivamus interdum adipiscing felis in malesuada. Fusce quis purus est, eget molestie turpis. In hac habitasse platea dictumst." & @CRLF $sTestTxt &= @TAB & "Aenean eleifend risus vitae lorem laoreet facilisis. Suspendisse ac urna quam, vel rutrum sem. Sed bibendum porta tellus malesuada scelerisque. Vestibulum at ligula sed nulla sollicitudin tincidunt. Pellentesque mi magna, vulputate et aliquam a, auctor et nunc. Phasellus feugiat fringilla accumsan. Donec ultrices, elit id dapibus auctor, nunc odio viverra lorem, non commodo mi libero a libero. Cras vitae felis venenatis augue laoreet tincidunt scelerisque id odio. Proin lorem purus, molestie feugiat pretium nec, ornare aliquam turpis. " Next GUICtrlSetData(-1, $sTestTxt) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM) _AddControlsToPanel($aPanel[2]) GUICtrlCreateLabel("Label1", 8, 38, 36, 17) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) Local $hInput1 = GUICtrlCreateInput("Input1", 56, 35, 121, 21) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) Local $hButton1 = GUICtrlCreateButton("Button1", 200, 33, 75, 25) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) _AddControlsToPanel($aPanel[3]) GUICtrlCreateList("", 8, 37, 121, 93, -1, 0) GUICtrlSetData(-1, "dfgdfg|ertert|kljlkj|poipoi|qweqwe") GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) _AddControlsToPanel($aPanel[4]) GUICtrlCreateGroup("Group1", 8, 35, 129, 90) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) Local $aChkBox[4] For $i = 1 To 3 $aChkBox[$i] = GUICtrlCreateRadio("Some radio " & $i, 16, 56 + ($i - 1) * 20, 113, 17) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) Next GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlCreateGroup("", -99, -99, 1, 1) ;set default to Panel1 GUISwitch($aPanel[1]) ;show the main GUI GUISetState(@SW_SHOW, $hMainGUI) While 1 Sleep(10) $nMsg = GUIGetMsg(1) Switch $nMsg[1] Case $hMainGUI Switch $nMsg[0] Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_MINIMIZE, $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE $aPos = WinGetPos($hMainGUI) $iW = $aPos[2] $iH = $aPos[3] For $i = 0 To $aPanel[0] WinMove($aPanel[$i], "", $iLeftWidth + 2, $iT, $iW - $iLeftWidth + 2, $iH - $iT - $iB - 20) Next Case $aLink[1], $aLink[2], $aLink[3], $aLink[4] For $i = 1 To $aLink[0] If $nMsg[0] = $aLink[$i] Then GUISetState(@SW_SHOW, $aPanel[$i]) Else GUISetState(@SW_HIDE, $aPanel[$i]) EndIf Next Case $hFooter ShellExecute("http://www.autoitscript.com/forum/topic/146952-gui-design-concepts/") EndSwitch Case $aPanel[2] Switch $nMsg[0] Case $hButton1 MsgBox(32, "Test", "You have " & GUICtrlRead($hInput1) & "?") EndSwitch Case $aPanel[4] Switch $nMsg[0] Case $aChkBox[1], $aChkBox[2], $aChkBox[3] For $i = 1 To 3 If GUICtrlRead($aChkBox[$i]) = $GUI_CHECKED Then MsgBox(64, "Test", "You checked nr. " & $i & "!") Next EndSwitch EndSwitch WEnd EndFunc ;==>_MainGui Func _AddNewLink($sTxt, $iIcon = -44) Local $hLink = GUICtrlCreateLabel($sTxt, 36, $iT + $iGap, $iLeftWidth - 46, 17) GUICtrlSetCursor(-1, 0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateIcon("shell32.dll", $iIcon, 10, $iT + $iGap, 16, 16) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $iGap += 22 Return $hLink EndFunc ;==>_AddNewLink Func _AddNewPanel($sTxt) Local $gui = GUICreate("", $iW - $iLeftWidth + 2, $iH - $iT - $iB, $iLeftWidth + 2, $iT, $WS_CHILD + $WS_VISIBLE, -1, $hMainGUI) GUICtrlCreateLabel($sTxt, 10, 10, $iW - $iLeftWidth - 20, 17, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 9, 800, 4, "Arial", 5) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) Return $gui EndFunc ;==>_AddNewPanel Func _AddControlsToPanel($hPanel) GUISwitch($hPanel) EndFunc ;==>_AddControlsToPanel
    1 point
×
×
  • Create New...