Kreatorul Posted July 24, 2008 Share Posted July 24, 2008 I tried using the multiline style from edit but of course it didn't work. Can this be done? Link to comment Share on other sites More sharing options...
Kreatorul Posted July 24, 2008 Author Share Posted July 24, 2008 No one know how to make a multi-line combo? muttley Link to comment Share on other sites More sharing options...
crzftx Posted July 24, 2008 Share Posted July 24, 2008 I don't think a multiline combo is part of Windows. I've never heard of such a thing. You could use a [disabled] multiline edit control with a button next to it. Pressing the button could open a child window with the choices of what you may want. Link to comment Share on other sites More sharing options...
Kreatorul Posted July 25, 2008 Author Share Posted July 25, 2008 It is possible. I've seen it implemented in some programs and with autoit window info the class is combobox...so it's actually a multi-line combo. Link to comment Share on other sites More sharing options...
BrettF Posted July 25, 2008 Share Posted July 25, 2008 After much google searching I did come across this: Scroll down to see more: http://www.vbcity.com/forums/faq.asp?fid=1...mboBox#TID58434 Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
telmob Posted October 22, 2011 Share Posted October 22, 2011 Sorry to revive this thread, but has anyone been able to make a combo with multiple lines, like the pic below? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 22, 2011 Moderators Share Posted October 22, 2011 (edited) telmob, I do not believe a multiline combo is possible. Does this work-a-round help at all? expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIMenu.au3> Global Enum $id_1 = 1000, $id_2, $id_3 Global $sItem_1 = "Item 1 and a long tail" Global $sItem_2 = "Item 2 and a long tail" Global $sItem_3 = "Item 3 and a long tail" $hGUI = GUICreate("Test", 500, 500) $hEdit = GUICtrlCreateEdit("", 10, 10, 60, 35, $ES_READONLY) $hSplit = GUICtrlCreateButton("6", 69, 10, 20, 35) GUICtrlSetFont(-1, 10, 400, 0, "Webdings") GUISetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hSplit ; Show the menu for a left click on the button _Menu() EndSwitch WEnd Func _Menu() ; Move mouse to correct place $iOldOpt = Opt("MouseCoordMode", 2) MouseMove(10, 45, 0) Opt("MouseCoordMode", $iOldOpt) ; Show menu $hMenu = _GUICtrlMenu_CreatePopup(24) _GUICtrlMenu_InsertMenuItem($hMenu, 0, $sItem_1, $id_1) _GUICtrlMenu_InsertMenuItem($hMenu, 1, $sItem_2, $id_2) _GUICtrlMenu_InsertMenuItem($hMenu, 3, $sItem_3, $id_3) _GUICtrlMenu_TrackPopupMenu($hMenu, $hGUI) _GUICtrlMenu_DestroyMenu($hMenu) EndFunc Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Switch $wParam Case $id_1 GUICtrlSetData($hEdit, $sItem_1) Case $id_2 GUICtrlSetData($hEdit, $sItem_2) Case $id_3 GUICtrlSetData($hEdit, $sItem_3) EndSwitch EndFunc ;==>WM_COMMAND Or perhaps this one which is considerably simpler: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIMenu.au3> #Include <GuiComboBox.au3> Global $sItem_1 = "Item 1 and a long tail" Global $sItem_2 = "Item 2 and a long tail" Global $sItem_3 = "Item 3 and a long tail" $hGUI = GUICreate("Test", 500, 500) $hEdit = GUICtrlCreateEdit("", 10, 10, 60, 35, $ES_READONLY) $hSplit = GUICtrlCreateButton("6", 69, 10, 21, 35) GUICtrlSetFont(-1, 10, 400, 0, "Webdings") $hCombo = GUICtrlCreateCombo("", 10, 25, 80, 20, BitOr($GUI_SS_DEFAULT_COMBO, $WS_CLIPSIBLINGS)) GUICtrlSetData(-1, $sItem_1 & "|" & $sItem_2 & "|" &$sItem_3) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hSplit _GUICtrlComboBox_ShowDropDown ($hCombo, True) Case $hCombo GUICtrlSetData($hEdit, GUICtrlRead($hCombo)) EndSwitch WEnd M23 Edit: Added second example. Edited October 22, 2011 by Melba23 Fr33b0w 1 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 Link to comment Share on other sites More sharing options...
telmob Posted October 22, 2011 Share Posted October 22, 2011 Maybe i can put a .jpg background to make it a bit more combo like. Thanks again Melba. Link to comment Share on other sites More sharing options...
czardas Posted October 23, 2011 Share Posted October 23, 2011 (edited) I had an idea about this. It's complicated, but I imagine it would be possible to embed a child GUI with a vertical scroll bar and set the multiline data on labels. The trick is getting the child gui to appear and disappear. It could be destroyed and created by clicking on a custom desined button, similar in appearnce to a combo dropdown button. I'm not sure how you would highlight the items, but it all sounds feasable. Some consideration will have to be made about other controls on the gui to ensure the embeded gui does not overlap anything (I think). Perhaps other controls could be destroyed before the dropdown appears in front of them, or maybe the child gui does not need to be embedded. Perhaps it can be floated over the parent in the corresponding position. EditOn reflection I think there are several downsides to my idea. It woulld be limited to a small number of items and would involve quite a lot of code. Edited October 23, 2011 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 23, 2011 Moderators Share Posted October 23, 2011 czardas, Do you mean something like this: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIMenu.au3> #Include <GuiComboBox.au3> Global $sItem_1 = "Item 1 and a long tail" Global $sItem_2 = "Item 2 and a longer tail" Global $sItem_3 = "Item 3 and an even longer tail" $hGUI = GUICreate("Test", 500, 500, 100, 100) $hEdit = GUICtrlCreateEdit("", 10, 10, 60, 35, $ES_READONLY) $hSplit = GUICtrlCreateButton("6", 69, 10, 21, 35) GUICtrlSetFont(-1, 10, 400, 0, "Webdings") GUISetState() $hGUI_Child = GUICreate("Child", 200, 200, 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) $hCombo = GUICtrlCreateCombo("", 0, -21, 200, 20, BitOr($GUI_SS_DEFAULT_COMBO, $WS_CLIPSIBLINGS)) GUICtrlSetData(-1, $sItem_1 & "|" & $sItem_2 & "|" &$sItem_3) GUISetState(@SW_HIDE) WinMove($hGUI_Child, "", 115, 167) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hSplit GUISetState(@SW_SHOW, $hGUI_Child) _GUICtrlComboBox_ShowDropDown ($hCombo, True) Case $hCombo GUISetState(@SW_HIDE, $hGUI_Child) GUICtrlSetData($hEdit, GUICtrlRead($hCombo)) EndSwitch WEnd Still a bit rough - ideally I would want to limit the child GUI size to that required for the drop-down and deal with the "no combo selection" case, but it shows the principle. Not sure it is any better then the other examples though. 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 Link to comment Share on other sites More sharing options...
czardas Posted October 23, 2011 Share Posted October 23, 2011 (edited) I was thinking more along the lines of having multiline on all items in the list, and not just on the selected item in the edit. I thought it might be possible to float something over the parent gui. At first I hadn't quite figured out what was going on in the examples you posted. Now I have looked again and I think your solution is the most practical and probably the best. Thanks again. Edited October 23, 2011 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 23, 2011 Moderators Share Posted October 23, 2011 czardas, You mean something like this then: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <WinAPI.au3> Global $iItems = 3 ; Number of items in list Global $aLabelID[$iItems][2] ; ControlIDs & handles of labels ; Data and colour state of labels Global $aData[$iItems] = ["Item 1 and a long tail", "Item 2 and a longer tail", "Item 3 and an even longer tail"] $hGUI = GUICreate("Test", 500, 500, 100, 100) $hEdit = GUICtrlCreateEdit("", 10, 10, 80, 35, $ES_READONLY) $hSplit = GUICtrlCreateButton("6", 89, 10, 21, 35) GUICtrlSetFont(-1, 10, 400, 0, "Webdings") $hButton = GUICtrlCreateButton("Test", 10, 70, 80, 30) GUISetState() $hGUI_Child = GUICreate("Child", 200, 200, 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) ; Create "list" For $i = 0 To $iItems - 1 $aLabelID[$i][0] = GUICtrlCreateLabel($aData[$i], 10, 10 + ($i * 40), 100, 40) $aLabelID[$i][1] = GUICtrlGetHandle(-1) Next GUISetState(@SW_HIDE) WinMove($hGUI_Child, "", 114, 167) $iLast_Hilite = 0 While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $hSplit GUISetState(@SW_SHOW, $hGUI_Child) Case $aLabelID[0][0] To $aLabelID[$iItems - 1][0] GUICtrlSetData($hEdit, GUICtrlRead($iMsg)) GUISetState(@SW_HIDE, $hGUI_Child) EndSwitch ; Get highlighting If BitAnd(WinGetState($hGUI_Child, ""), 2) Then If @AutoItX64 Then $tPoint = DllStructCreate("int X;int Y") DllStructSetData ( $tPoint, "X", MouseGetPos(0)) DllStructSetData ( $tPoint, "Y", MouseGetPos(1)) $tPoint64 = DllStructCreate("int64", DllStructGetPtr($tPoint)) $aHwnd = DllCall("user32.dll", "hwnd", "WindowFromPoint", "int64", DllStructGetData($tPoint64, 1)) Else $aHwnd = DllCall("user32.dll", "hwnd", "WindowFromPoint", "uint", MouseGetPos(0), "uint", MouseGetPos(1)) EndIf For $i = 0 To $iItems - 1 If $aLabelID[$i][1] = $aHwnd[0] And $aLabelID[$i][0] <> $iLast_Hilite Then GUICtrlSetBkColor($iLast_Hilite, 0xFEFEFE) GUICtrlSetBkColor($aLabelID[$i][0], 0xCCCCFF) $iLast_Hilite = $aLabelID[$i][0] EndIf Next EndIf WEnd Can you tell I am bored this morning? M23 Fr33b0w 1 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 Link to comment Share on other sites More sharing options...
czardas Posted October 23, 2011 Share Posted October 23, 2011 Wow, I love it. Now can we have the ListView version. Only joking. operator64 ArrayWorkshop 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