BartvanBeek Posted September 29, 2008 Share Posted September 29, 2008 A simple ChoiceBox. What do you think about it? Add to UDF??? expandcollapse popup#include <GUIConstants.au3> ;Example START #include <Array.au3> $ChoiceArray = StringSplit("Choice 1|Choice 2|Choice 3|Choice 4|Choice 5|Choice 6|Choice 7|Choice 8|Choice 9|Choice 10","|") $ReturnArray = _ChoiceBox("Choice", $ChoiceArray, 0,"Make your choice") _ArrayDisplay($ReturnArray, "Choice") ;Example END ;=================================================================================================== ; Function Name: _ChoiceBox() ; Description: Generate a ChoiceBox using an array ; Syntax: _ChoiceBox($GUICaption, $ChoiceArray, $SelectionType[, $LabelText = ""] ; [,[$GUIWidth = 150][, $LabelWidth = 130][, $GUIXPOS = -1][, $GUIYPOS = -1]) ; Parameter(s): $Caption : The caption of the ChoiceBox ; $ChoiceArray : One dimensional array with items to select ; $SelectionType : 0 = Checkbox, 1 = Radiobutton ; $LabelText : Label with text below captionbar and above first item (Default = "") ; $GUIWidth : ChoiceBox width, only needed when long values are exists in $ChoiceArray (Default = 150) ; $LabelWidth : Item label width, only needed when long values are exists in $ChoiceArray (Default = 130) ; $GUIXPOS : X-Pos of the ChoiceBox (Default = -1) ; $GUIYPOS : Y-Pos of the ChoiceBox (Default = -1) ; ; Return Value(s): Succes: Returns an array, the first element ($array[0]) contains the number of selected items, ; the remaining elements ($array[1], $array[2], etc.) contain the selected items. ; Failure: Returns a 0 (zero) ; Requirement(s): AutoIt 3.2.10.0 and above ; Note(s): None ; ; Author(s): Bart van Beek ;=================================================================================================== Func _ChoiceBox($Caption, $ChoiceArray, $SelectionType, $LabelText = "", $GUIWidth = 150, $LabelWidth = 130, $GUIXPOS = -1, $GUIYPOS = -1) Dim $SelectionArray[$ChoiceArray[0] + 1] Dim $YPOS = 10 If $LabelText = "" Then GUICreate($Caption, $GUIWidth, ($ChoiceArray[0] * 20 + 40), $GUIXPOS, $GUIYPOS) Else GUICreate($Caption, $GUIWidth, ($ChoiceArray[0] * 20 + 70), $GUIXPOS, $GUIYPOS) GUICtrlCreateLabel($LabelText,10,10,$LabelWidth,20) Dim $YPOS = 30 EndIf For $i = 1 To $ChoiceArray[0] Switch $SelectionType Case 0 $SelectionArray[$i] = GUICtrlCreateCheckbox ($ChoiceArray[$i], 10, $YPOS, $LabelWidth, 20) Case 1 $SelectionArray[$i] = GUICtrlCreateRadio ($ChoiceArray[$i], 10, $YPOS, $LabelWidth, 20) Case Else Return 0 EndSwitch $YPOS = $YPOS + 20 Next $BtnOk = GUICtrlCreateButton("&OK", 5, $YPOS + 5, 80, 20) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Return 0 Case $BtnOk Dim $Selected For $i = 1 To $ChoiceArray[0] If GUICtrlRead($SelectionArray[$i]) = $GUI_CHECKED Then $Selected = $Selected & GUICtrlRead($SelectionArray[$i], 1) & "|" EndIf Next $Selected = StringTrimRight($Selected, 1) Return StringSplit($Selected, "|") EndSwitch WEnd EndFunc ;==>_ChoiceBox Link to comment Share on other sites More sharing options...
TehWhale Posted September 29, 2008 Share Posted September 29, 2008 Nice Newbie script man! Keep up the good work and learn more and more! Link to comment Share on other sites More sharing options...
DirtDBaK Posted September 29, 2008 Share Posted September 29, 2008 Nice Newbie script man! Keep up the good work and learn more and more!your still alive.And so am i [center][/center] Link to comment Share on other sites More sharing options...
BartvanBeek Posted September 29, 2008 Author Share Posted September 29, 2008 Nice Newbie script man! Keep up the good work and learn more and more!Ok, let me show your modified code and teach me!!! Link to comment Share on other sites More sharing options...
spudw2k Posted September 29, 2008 Share Posted September 29, 2008 (edited) I made something like this once using a TreeView ctrl. Here's my version. expandcollapse popup#include <GuiTreeView.au3> #include <GUIConstants.au3> #include <Array.au3> ;only used for this example _ArrayDisplay ;Create Array of Selections Local $aItems=["First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Nineth","Tenth","Eleventh","Twelveth","Thriteenth","Fouteenth","Fifteenth","Sixteenth","Seventeenth","Eighteenth","Nineteenth","Twentieth"] ;Title of Selection Window Local $sTitle = "Choose from these items" ;Return Array of Selections $aResults = _MakeChoice($aItems,$sTitle) ;Display Selections _ArrayDisplay($aResults) ;Selections Window Func _MakeChoice(ByRef $aItems, ByRef $sTitle) ;Error Checking If Not IsArray($aItems) then Return SetError(1,0,0) ;Initialization Local $iUbound = UBound($aItems) Local $aTreeItems[$iUbound] $hGui = GUICreate($sTitle,250,326,-1,-1,"","") $idTree = GUICtrlCreateTreeView(5,5,235,258,BitOr(256,55)) $idSelectAll = GUICtrlCreateButton("Select All",85,270,75,20) $idDeSelectAll = GUICtrlCreateButton("Deselect All",165,270,75,20) $idOKBtn = GUICtrlCreateButton("OK",5,270,75,20) GUICtrlSetState(-1,$GUI_FOCUS) ;Add Selection to TreeView Ctrl For $iX = 0 to UBound($aItems) - 1 $aTreeItems[$iX] = GUICtrlCreateTreeViewItem($aItems[$iX],$idTree) Next ;Display Selections Window GUISetState(@SW_SHOW,$hGui) While 1 $iMsgSelection = GUIGetMsg() ;Select All Button Logic If $iMsgSelection = $idSelectAll Then ;Prevent ReDrawing until TreeView Ctrl Updates are Complete GUICtrlSendMsg($idTree, $__TREEVIEWCONSTANT_WM_SETREDRAW, False, 0) ;Loop through TreeItems and Set Checked State For $iX = 0 to $iUbound - 1 GUICtrlSetState($aTreeItems[$iX],$GUI_CHECKED) Next ;Enable ReDrawing TreeView Ctrl GUICtrlSendMsg($idTree, $__TREEVIEWCONSTANT_WM_SETREDRAW, True, 0) EndIf ;DeSelect All Button Logic If $iMsgSelection = $idDeSelectAll Then ;Prevent ReDrawing until TreeView Ctrl Updates are Complete GUICtrlSendMsg($idTree, $__TREEVIEWCONSTANT_WM_SETREDRAW, False, 0) ;Loop through TreeItems and Set Checked State For $iX = 0 to $iUbound - 1 GUICtrlSetState($aTreeItems[$iX],$GUI_UNCHECKED) Next ;Enable ReDrawing TreeView Ctrl GUICtrlSendMsg($idTree, $__TREEVIEWCONSTANT_WM_SETREDRAW, True, 0) EndIf ;OK Button Logic If $iMsgSelection = $idOKBtn Then ;Create Placeholder String Local $sSelections= "" ;Loop Through TreeView Items and Add Checked Items with Delimeter to Placeholder String For $iY = 0 to $iUbound -1 If BitAnd(GUICtrlRead($aTreeItems[$iY]),$GUI_CHECKED) Then If $sSelections == "" Then $sSelections = GUICtrlRead($aTreeItems[$iY],1) Else $sSelections &= "•" & GUICtrlRead($aTreeItems[$iY],1) EndIf EndIf Next ;Create Array of Results from Delimited Placeholder String Local $aSelections = StringSplit($sSelections,"•") ;If Nothing Selected, Zero-out Selection Array If Not $aSelections[1] Then Dim $aSelections[1]=[0] ;GUI Deletion GUIDelete($hGui) ;Return Selections Array Return $aSelections EndIf WEnd EndFunc Edited April 7, 2021 by spudw2k Code cleanup Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted September 30, 2008 Share Posted September 30, 2008 Good job, BartvanBeek.And very nice alternative spudw2k. It's a shame Treeviews don't support more controls like ComboBox, Radios or mixture of different controls. I suppose some hacking would have to be done. Maybe using ScrollBars would be better fitted for such a case of dynamic GUI creation. This way the GUI can handle more than it can fit...Kip made nice set of Scroll UDF's. Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted September 30, 2008 Share Posted September 30, 2008 (edited) Ok.. Here's a quick example.You'll need the Scroll UDF.Here's a modifed version (includes fixes from the post)CODE#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.13.3 (beta) Author: Kip Script Function: Template AutoIt script.#ce ----------------------------------------------------------------------------; Script Start - Add your code below here#csFunctions:Scrollbar_Create($hWnd, $iBar, $iMax)Scrollbar_Scroll($hWnd, $iBar, $iPos)Scrollbar_GetPos($hWnd, $iBar)Scrollbar_Step($iStep, $hWnd=0, $iBar=0)#CE#Include <GuiScrollBars.au3>#include<GuiconstantsEx.au3>#include<WindowsConstants.au3>#include <ScrollBarConstants.au3>Global $SCROLL_AMOUNTS[1][3]$SCROLL_AMOUNTS[0][0] = 1func Scrollbar_Create($hWnd, $iBar, $iMax) Local $Size = WinGetClientSize($hWnd) If $iBar = $SB_HORZ Then $Size = $Size[0] ElseIf $iBar = $SB_VERT Then $Size = $Size[1] Else Return 0 EndIf ReDim $SCROLL_AMOUNTS[uBound($SCROLL_AMOUNTS)+1][3] $SCROLL_AMOUNTS[uBound($SCROLL_AMOUNTS)-1][0] = $hWnd $SCROLL_AMOUNTS[uBound($SCROLL_AMOUNTS)-1][1] = $iBar $SCROLL_AMOUNTS[uBound($SCROLL_AMOUNTS)-1][2] = $SCROLL_AMOUNTS[0][0] _GUIScrollBars_EnableScrollBar($hWnd, $iBar) _GUIScrollBars_SetScrollRange($hWnd, $iBar, 0,$iMax-1) _GUIScrollBars_SetScrollInfoPage($hWnd, $iBar, $Size) GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL") GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL") GUIRegisterMsg($WM_SIZE, "WM_SIZE") Return $iMax EndFuncFunc Scrollbar_GetPos($hWnd, $iBar) Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $iBar) Return DllStructGetData($tSCROLLINFO, "nPos") EndFuncFunc Scrollbar_Scroll($hWnd, $iBar, $iPos) Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $iBar) $iCurrentPos = DllStructGetData($tSCROLLINFO, "nPos") DllStructSetData($tSCROLLINFO, "nPos", $iPos) DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $iBar, $tSCROLLINFO) If $iBar = $SB_VERT Then $iRound = 0 for $i = 1 to UBound($SCROLL_AMOUNTS)-1 If $SCROLL_AMOUNTS[$i][0] = $hWnd And $SCROLL_AMOUNTS[$i][1] = $SB_VERT Then $iRound = $SCROLL_AMOUNTS[$i][2] EndIf Next If Not $iRound Then Return 0 _GUIScrollBars_ScrollWindow($hWnd, 0, Round(($iCurrentPos-$iPos)/$iRound)*$iRound) ElseIf $iBar = $SB_HORZ Then $iRound = 0 for $i = 1 to UBound($SCROLL_AMOUNTS)-1 If $SCROLL_AMOUNTS[$i][0] = $hWnd And $SCROLL_AMOUNTS[$i][1] = $SB_HORZ Then $iRound = $SCROLL_AMOUNTS[$i][2] EndIf Next If Not $iRound Then Return 0 _GUIScrollBars_ScrollWindow($hWnd, Round(($iCurrentPos-$iPos)/$iRound)*$iRound, 0) Else Return 0 EndIf Return 1 EndFuncFunc Scrollbar_Step($iStep, $hWnd=0, $iBar=0) If not $hWnd or Not $iBar Then $SCROLL_AMOUNTS[0][0] = $iStep Return 1 EndIf $iID = 0 for $i = 1 to UBound($SCROLL_AMOUNTS)-1 If $SCROLL_AMOUNTS[$i][0] = $hWnd And $SCROLL_AMOUNTS[$i][1] = $iBar Then $iID = $i ExitLoop EndIf Next If Not $iID Then Return 0 $SCROLL_AMOUNTS[$iID][2] = $iStep Return 1 EndFuncFunc WM_VSCROLL($hWnd, $Msg, $wParam, $lParam) #forceref $Msg, $wParam, $lParam Local $nScrollCode = BitAND($wParam, 0x0000FFFF) Local $index = -1, $yChar, $yPos Local $Min, $Max, $Page, $Pos, $TrackPos ; Get all the vertial scroll bar information Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT) $Min = DllStructGetData($tSCROLLINFO, "nMin") $Max = DllStructGetData($tSCROLLINFO, "nMax") $Page = DllStructGetData($tSCROLLINFO, "nPage") ; Save the position for comparison later on $yPos = DllStructGetData($tSCROLLINFO, "nPos") $Pos = $yPos $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos") $iRound = 0 for $i = 1 to UBound($SCROLL_AMOUNTS)-1 If $SCROLL_AMOUNTS[$i][0] = $hWnd And $SCROLL_AMOUNTS[$i][1] = $SB_VERT Then $iRound = $SCROLL_AMOUNTS[$i][2] EndIf Next if Not $iRound Then Return $GUI_RUNDEFMSG Switch $nScrollCode Case $SB_TOP ; user clicked the HOME keyboard key DllStructSetData($tSCROLLINFO, "nPos", $Min) Case $SB_BOTTOM ; user clicked the END keyboard key DllStructSetData($tSCROLLINFO, "nPos", $Max) Case $SB_LINEUP ; user clicked the top arrow DllStructSetData($tSCROLLINFO, "nPos", $Pos - $iRound) Case $SB_LINEDOWN ; user clicked the bottom arrow DllStructSetData($tSCROLLINFO, "nPos", $Pos + $iRound) Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page) Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page) Case $SB_THUMBTRACK ; user dragged the scroll box DllStructSetData($tSCROLLINFO, "nPos", Round($TrackPos/$iRound)*$iRound) EndSwitch ;~ // Set the position and then retrieve it. Due to adjustments;~ // by Windows it may not be the same as the value set. DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) ;// If the position has changed, scroll the window and update it $Pos = DllStructGetData($tSCROLLINFO, "nPos") If ($Pos <> $yPos) Then _GUIScrollBars_ScrollWindow($hWnd, 0, $yPos - $Pos) EndIf Return $GUI_RUNDEFMSGEndFunc ;==>WM_VSCROLLFunc WM_HSCROLL($hWnd, $Msg, $wParam, $lParam) #forceref $Msg, $wParam, $lParam Local $nScrollCode = BitAND($wParam, 0x0000FFFF) Local $index = -1, $yChar, $yPos Local $Min, $Max, $Page, $Pos, $TrackPos ; Get all the vertial scroll bar information Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ) $Min = DllStructGetData($tSCROLLINFO, "nMin") $Max = DllStructGetData($tSCROLLINFO, "nMax") $Page = DllStructGetData($tSCROLLINFO, "nPage") ; Save the position for comparison later on $yPos = DllStructGetData($tSCROLLINFO, "nPos") $Pos = $yPos $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos") $iRound = 0 for $i = 1 to UBound($SCROLL_AMOUNTS)-1 If $SCROLL_AMOUNTS[$i][0] = $hWnd And $SCROLL_AMOUNTS[$i][1] = $SB_HORZ Then $iRound = $SCROLL_AMOUNTS[$i][2] EndIf Next if Not $iRound Then Return $GUI_RUNDEFMSG Switch $nScrollCode Case $SB_TOP ; user clicked the HOME keyboard key DllStructSetData($tSCROLLINFO, "nPos", $Min) Case $SB_BOTTOM ; user clicked the END keyboard key DllStructSetData($tSCROLLINFO, "nPos", $Max) Case $SB_LINEUP ; user clicked the top arrow DllStructSetData($tSCROLLINFO, "nPos", $Pos - $iRound) Case $SB_LINEDOWN ; user clicked the bottom arrow DllStructSetData($tSCROLLINFO, "nPos", $Pos + $iRound) Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page) Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page) Case $SB_THUMBTRACK ; user dragged the scroll box DllStructSetData($tSCROLLINFO, "nPos", Round($TrackPos/$iRound)*$iRound) EndSwitch ;~ // Set the position and then retrieve it. Due to adjustments;~ // by Windows it may not be the same as the value set. DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO) _GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO) ;// If the position has changed, scroll the window and update it $Pos = DllStructGetData($tSCROLLINFO, "nPos") If ($Pos <> $yPos) Then _GUIScrollBars_ScrollWindow($hWnd, $yPos - $Pos, 0) EndIf Return $GUI_RUNDEFMSGEndFunc ;==>WM_HSCROLLFunc WM_SIZE($hWnd, $Msg, $wParam, $lParam) #forceref $Msg, $wParam Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax For $x = 0 To UBound($aSB_WindowInfo) - 1 If $aSB_WindowInfo[$x][0] = $hWnd Then $index = $x $xClientMax = $aSB_WindowInfo[$index][1] $xChar = $aSB_WindowInfo[$index][2] $yChar = $aSB_WindowInfo[$index][3] $ivMax = $aSB_WindowInfo[$index][7] ExitLoop EndIf Next If $index = -1 Then Return 0 Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO) ; Retrieve the dimensions of the client area. $xClient = BitAND($lParam, 0x0000FFFF) $yClient = BitShift($lParam, 16) $aSB_WindowInfo[$index][4] = $xClient $aSB_WindowInfo[$index][5] = $yClient ; Set the vertical scrolling range and page size DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE)) DllStructSetData($tSCROLLINFO, "nMin", 0) DllStructSetData($tSCROLLINFO, "nMax", $ivMax) DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar) _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) ; Set the horizontal scrolling range and page size DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE)) DllStructSetData($tSCROLLINFO, "nMin", 0) DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar) DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar) _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO) Return $GUI_RUNDEFMSGEndFunc ;==>WM_SIZEAnd the exampleexpandcollapse popup#include <WindowsConstants.au3> #include <GuiconstantsEx.au3> #include <Timers.au3> #include <Array.au3> #Include "GUIScroll.au3" $Caption = "Choice" $ChoiceArray = StringSplit("Choice 1|Choice 2|Choice 3|Choice 4|Choice 5|Choice 6|Choice 7|Choice 8|Choice 9|Choice 10|Choice 11|Choice 12|Choice 13|Choice 14|Choice 15","|") $GUIWidth = 150 $LabelWidth = 130 $GUIXPOS = -1 $GUIYPOS = -1 $LabelText = "Make your choice" $SelectionType = 0 $MaxHeight = 250 $ReturnArray =_ChoiceBox($Caption, $ChoiceArray, $SelectionType, $LabelText, $GUIWidth, $LabelWidth, $GUIXPOS, $GUIYPOS, $MaxHeight) _ArrayDisplay($ReturnArray, "Choice") Func _ChoiceBox($Caption, $ChoiceArray, $SelectionType, $LabelText = "", $GUIWidth = 150, $LabelWidth = 130, $GUIXPOS = -1, $GUIYPOS = -1, $MaxHeight=250) Dim $SelectionArray[$ChoiceArray[0] + 1] Dim $YPOS = 10 If $LabelText = "" Then $GUIHeight = ($ChoiceArray[0] * 20 + 40) If $GUIHeight > $MaxHeight Then $GUIHeight = $MaxHeight $GUI = GUICreate($Caption, $GUIWidth, $GUIHeight, $GUIXPOS, $GUIYPOS) Else $GUIHeight = ($ChoiceArray[0] * 20 + 70) If $GUIHeight > $MaxHeight Then $GUIHeight = $MaxHeight + 70 $GUI = GUICreate($Caption, $GUIWidth, $GUIHeight, $GUIXPOS, $GUIYPOS) GUICtrlCreateLabel($LabelText,10,10,$LabelWidth,20) Dim $YPOS = 30 EndIf Scrollbar_Create($GUI, $SB_VERT, $GUIHeight + 100); But the actual window is 700 pixels high Scrollbar_Step(1, $GUI, $SB_VERT); Scrolls per 20 pixels. If not set the default is 1 (smooth scrolling) For $i = 1 To $ChoiceArray[0] Switch $SelectionType Case 0 $SelectionArray[$i] = GUICtrlCreateCheckbox ($ChoiceArray[$i], 10, $YPOS, $LabelWidth, 20) Case 1 $SelectionArray[$i] = GUICtrlCreateRadio ($ChoiceArray[$i], 10, $YPOS, $LabelWidth, 20) Case Else EndSwitch $YPOS = $YPOS + 20 Next $BtnOk = GUICtrlCreateButton("&OK", 5, $YPOS + 5, 80, 20) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Return 0 Case $BtnOk Dim $Selected For $i = 1 To $ChoiceArray[0] If GUICtrlRead($SelectionArray[$i]) = $GUI_CHECKED Then $Selected = $Selected & GUICtrlRead($SelectionArray[$i], 1) & "|" EndIf Next $Selected = StringTrimRight($Selected, 1) $Array = StringSplit($Selected, "|") Return StringSplit($Selected, "|") EndSwitch WEnd EndFunc Edited September 30, 2008 by mrRevoked Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
spudw2k Posted September 30, 2008 Share Posted September 30, 2008 Thanks mrRevoked, and kip. Good stuff. >_ Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
BartvanBeek Posted September 30, 2008 Author Share Posted September 30, 2008 spudw2k and mrRevoked thanks for the code, i like it!!! 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