nasim007 Posted March 19, 2010 Posted March 19, 2010 Here is the code: #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $MESSAGE = "The following buttons have been clicked" Local $add, $clear, $mylist, $close, $msg GUICreate("My GUI list") ; will create a dialog box that when displayed is centered $add = GUICtrlCreateButton("Add", 64, 32, 75, 25) $clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25) $mylist = GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97) GUICtrlSetLimit(-1, 200) ; to limit horizontal scrolling GUICtrlSetData(-1, $MESSAGE) $close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $add GUICtrlSetData($mylist, "You clicked button No1|") Case $msg = $clear GUICtrlSetData($mylist, "") Case $msg = $close MsgBox(0, "", "the closing button has been clicked", 2) Exit EndSelect WEnd EndFunc I would like to enable a horizontal scroll bar on the listbox if the text exceeds the borders. Anyone know how to do it?
Moderators Melba23 Posted March 19, 2010 Moderators Posted March 19, 2010 nasim007, Anyone know how to do it?Yes. Add the horizontal scrollbar style to the control: $mylist = GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97, BitOR($GUI_SS_DEFAULT_LIST, $WS_HSCROLL)) Note the use of BitOR. If you specify a particular style (or extended style), you overwrite the current values, so if you want to keep them you need to specify them as well. As most styles are expressed at the bit level (look at the hex values to see what I mean) merely adding the styles can lead to some strange results. Always use BitOR to make sure the correct bits are set. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
nasim007 Posted March 19, 2010 Author Posted March 19, 2010 (edited) Melba23,That makes it three times that you helped me out. Thanks so much. I looked up and down the help file but I didn't know I could apply that style. I thought I was limited to the ListboxConstants.au3 file. Thanks again!EDIT: For my program I am populating the listbox with filepaths. Using your suggestion I can make a statically defined limit to the scroll bar using GUICtrlSetLimit. Meaning when the app runs, the empty listbox will already contain a horizonatal scroll bar at a fixed size. Before I go nuts in creating a whole slew of logic blocks trying to figure it out, can I make it so it only appears like the vertical scroll bar; only if the characters exceeds the width of the list box?? Edited March 19, 2010 by nasim007
Moderators Melba23 Posted March 20, 2010 Moderators Posted March 20, 2010 nasim007, You might find these recent topics of interest: Making scrollbars appear only when necessary Using ellipsis styles You will have to adapt the techniques used, but they should give you a few pointers on how you might go about it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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