mike2003 Posted November 4, 2014 Share Posted November 4, 2014 (edited) I tried several ways and none work. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $ListView1 = GUICtrlCreateListView("", 24, 24, 250, 150, BitOR($LVS_LIST,$LVS_SHOWSELALWAYS)) $ListView1_0 = GUICtrlCreateListViewItem("asdadad", $ListView1) $ListView1_1 = GUICtrlCreateListViewItem("adsad", $ListView1) $ListView1_2 = GUICtrlCreateListViewItem("2323", $ListView1) $ListView1_3 = GUICtrlCreateListViewItem("454545", $ListView1) $Edit1 = GUICtrlCreateEdit("-", 312, 200, 185, 89) $Button1 = GUICtrlCreateButton("Button1", 128, 224, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUICtrlSetData($Edit1,GUICtrlRead(GUICtrlRead($ListView1))) EndSwitch WEnd Help page has no information about the reading. Only strange GUICtrlRead(GUICtrlRead($ListView1)). return only first selected line #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("Form1", 616, 439, 192, 124) $List1 = GUICtrlCreateList("", 112, 80, 121, 97, BitOR($GUI_SS_DEFAULT_LIST,$LBS_MULTIPLESEL)) GUICtrlSetData(-1, "34345|af5555|asdfasdf|nnbn") $Button1 = GUICtrlCreateButton("Button1", 120, 232, 75, 25) $Edit1 = GUICtrlCreateEdit("-", 280, 232, 185, 89) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUICtrlSetData($Edit1, GUICtrlRead($List1)) EndSwitch WEnd Always returns the last line where the mouse clicked.even if not selected. How? Edited November 4, 2014 by mike2003 Link to comment Share on other sites More sharing options...
kaisies Posted November 4, 2014 Share Posted November 4, 2014 What values are you trying to get. What they clicked? All the ones selected? Are you going to do this on click of an item, or after a guictrlbutton click? Link to comment Share on other sites More sharing options...
mike2003 Posted November 4, 2014 Author Share Posted November 4, 2014 (edited) Select some items in list and get it text after button press. $string="text item 1 selected"+"text item 2 selected"+.... something like that Edited November 4, 2014 by mike2003 Link to comment Share on other sites More sharing options...
kaisies Posted November 4, 2014 Share Posted November 4, 2014 (edited) Napkin code edited from a program I made, but it will point you in the right direction: expandcollapse popup#include <WindowsConstants.au3> #include <GuiListView.au3> #include <Date.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> Global $BatchWidth = 350, $BatchHeight = 500 Global $hBtnSelectBatches = 50 Global $btnProcessBatches = 9999 Global $BatchesForm, $lstBatches ChooseBatches() While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $BatchesForm Switch $aMsg[0] Case $GUI_EVENT_CLOSE $btnProcessBatches = 9999 GUIDelete($BatchesForm) Case $btnProcessBatches GUISetState(@SW_HIDE) ProcessBatches() EndSwitch EndSwitch WEnd Func ChooseBatches() Local $x, $todaydate Local $FormTitle = "Select Some Dates!" $BatchesForm = GUICreate($FormTitle, $BatchWidth, $BatchHeight, (@DesktopWidth - $BatchWidth) / 2, (@DesktopHeight - $BatchHeight) / 2, $WS_SYSMENU ) ;$WS_SIZEBOX $lstBatches = GUICtrlCreateListView("", 0, 0, $BatchWidth-4, $BatchHeight - $hBtnSelectBatches - 25 - 8,BitOr($LVS_SHOWSELALWAYS, $LVS_REPORT), $LVS_SORTASCENDING) _GUICtrlListView_InsertColumn($lstBatches,0,"Batch Date",$BatchWidth-30) _GUICtrlListView_AddItem($lstBatches,"Current Date") $todaydate = @YEAR & "/" & @MON & "/" & @MDAY For $x = 1 To 100 _GUICtrlListView_AddItem($lstBatches,_DateAdd("d",-$x,$todaydate)) Next $btnProcessBatches = GUICtrlCreateButton("Review Selected Dates", ($BatchWidth/2)-4, $BatchHeight - $hBtnSelectBatches - 25 - 4 ,($BatchWidth/2)-4,$hBtnSelectBatches) GUISetState(@SW_SHOW) EndFunc Func ProcessBatches() Local $tmparr $tmparr = _GUICtrlListView_GetSelectedIndices($lstBatches,True) For $x = 1 to $tmparr[0] $tmparr[$x] = _GUICtrlListView_GetItemText($lstBatches,$tmparr[$x]) Next _ArrayDisplay($tmparr) EndFunc Edited November 4, 2014 by kaisies Link to comment Share on other sites More sharing options...
Solution mike2003 Posted November 4, 2014 Author Solution Share Posted November 4, 2014 (edited) thanks! key is Local $tmparr = _GUICtrlListView_GetSelectedIndices($ListView1, True) For $x = 1 To $tmparr[0] GUICtrlSetData($Edit1,_GUICtrlListView_GetItemText($ListView1, $tmparr[$x]) & @CRLF, True) Next GUICtrlSetData($Edit1,"---" & @CRLF, True)full simple version with ListView#include <GuiListView.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $ListView1 = GUICtrlCreateListView("", 24, 24, 250, 150, BitOR($LVS_LIST, $LVS_SHOWSELALWAYS)) $ListView1_0 = GUICtrlCreateListViewItem("asdadad", $ListView1) $ListView1_1 = GUICtrlCreateListViewItem("adsad", $ListView1) $ListView1_2 = GUICtrlCreateListViewItem("2323", $ListView1) $ListView1_3 = GUICtrlCreateListViewItem("454545", $ListView1) $Edit1 = GUICtrlCreateEdit("", 312, 200, 185, 189) $Button1 = GUICtrlCreateButton("Button1", 128, 224, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Local $tmparr = _GUICtrlListView_GetSelectedIndices($ListView1, True) For $x = 1 To $tmparr[0] GUICtrlSetData($Edit1,_GUICtrlListView_GetItemText($ListView1, $tmparr[$x]) & @CRLF, True) Next GUICtrlSetData($Edit1,"---" & @CRLF, True) EndSwitch WEndPS how insert colored code? Edited November 4, 2014 by mike2003 Link to comment Share on other sites More sharing options...
kaisies Posted November 4, 2014 Share Posted November 4, 2014 with [ autoit ] and [ /autoit ] (no spaces) glad to help Link to comment Share on other sites More sharing options...
mike2003 Posted November 4, 2014 Author Share Posted November 4, 2014 with [ autoit ] and [ /autoit ] (no spaces) glad to help there is no button in the editor? Link to comment Share on other sites More sharing options...
kaisies Posted November 4, 2014 Share Posted November 4, 2014 Probably never bothered to take the time to look Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 4, 2014 Moderators Share Posted November 4, 2014 mike2003,The editor has 2 modes - WYSIWYG and basic - which are toggled by the button at top left. If you are in WYSIWYG mode then you will see a small blue "A" icon about halfway along the bottom row - that is the "code insertion" button. 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...
mike2003 Posted November 4, 2014 Author Share Posted November 4, 2014 (edited) blue "A" icon this is black and white code and I was looking for color insertsI like how it looks Edited November 4, 2014 by mike2003 Link to comment Share on other sites More sharing options...
MikahS Posted November 4, 2014 Share Posted November 4, 2014 It's this button Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 4, 2014 Moderators Share Posted November 4, 2014 mike2003,Oh ye of little faith! Why on earth would I tell you something that was not correct? The code is not coloured until you post and the forum software does some Geshi magic depending on its syntax. Go and test in the "Test posting" section if you still do not believe me. M23 MikahS 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...
mike2003 Posted November 4, 2014 Author Share Posted November 4, 2014 (edited) Go and test in the "Test posting" section if you still do not believe me. It's this button i used this button A in 1st post and all code-text is black. what's wrong? Edited November 4, 2014 by mike2003 Link to comment Share on other sites More sharing options...
mike2003 Posted November 4, 2014 Author Share Posted November 4, 2014 '?do=embed' frameborder='0' data-embedContent>> all black again Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 4, 2014 Moderators Share Posted November 4, 2014 mike2003,Looking at the tags in that post it starts: code=nocode:0 which is used for plain text. You must make sure that the dropdown in the code insertion dialog is set to "AutoIt". It really does work for the rest of us - we are not trolling you. 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...
mike2003 Posted November 4, 2014 Author Share Posted November 4, 2014 ok. understood. The problem was that I paste text, highlight and press the buttons. there is no choice and the text will be black. Link to comment Share on other sites More sharing options...
MikahS Posted November 4, 2014 Share Posted November 4, 2014 (edited) gives you this when you press okay: ;example code here All clear? Edited November 4, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
mike2003 Posted November 4, 2014 Author Share Posted November 4, 2014 (edited) gives you this when you press only if no selection. otherwise "Plain Text". solved Edited November 4, 2014 by mike2003 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