Bumek662 Posted July 19, 2013 Share Posted July 19, 2013 expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> Global $GUI = GUICreate("Kulinarne przepisy", 293, 294, 302, 218) Global $Przepisy = GUICtrlCreateList("xd", 0, 0, 153, 292) GUICtrlSetData($Przepisy, "Skasuj Mnie|") $Skasuj = GUICtrlCreateButton("Skasuj", 160, 146, 129, 49) $Dodaj = GUICtrlCreateButton("Dodaj", 160, 90, 129, 49) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Dodaj Dodaj() Case $Skasuj If Not GUICtrlRead($Przepisy) = "" Then $DoSkasownia = _GUICtrlListBox_FindInText($Przepisy, GUICtrlRead($Przepisy)) _GUICtrlListBox_DeleteString($Przepisy, $DoSkasownia) EndIf EndSwitch WEnd Func Dodaj() Local $GuiDodaj = GUICreate("Dodawanie przepisu", 267, 357, 192, 124) GUICtrlCreateLabel("Podaj nazwę przepisu:", 64, 8, 139, 22) GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS") $Nazwa = GUICtrlCreateInput("", 0, 32, 265, 21) GUICtrlCreateLabel("Tutaj daj przepis:", 72, 64, 113, 22) GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS") $Przepis = GUICtrlCreateEdit("", 0, 88, 265, 225) GUICtrlSetData(-1, "Przepis") $Koniec = GUICtrlCreateButton("Dodaj!", 49, 320, 169, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($GuiDodaj) Return Case $Koniec GUICtrlSetData($Przepisy, GUICtrlRead($Nazwa) & "|") GUIDelete($GuiDodaj) Return EndSwitch WEnd EndFunc How to do that when I click two times for a given position in the list, it will start the feature? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 19, 2013 Moderators Share Posted July 19, 2013 Burnek662, You can detect a doubleclick on a list item like this: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <Constants.au3> Global $GUI = GUICreate("Kulinarne przepisy", 293, 294, 302, 218) Global $Przepisy = GUICtrlCreateList("xd", 0, 0, 153, 292) GUICtrlSetData($Przepisy, "Skasuj Mnie|") $Skasuj = GUICtrlCreateButton("Skasuj", 160, 146, 129, 49) $Dodaj = GUICtrlCreateButton("Dodaj", 160, 90, 129, 49) $cDblClk = GUICtrlCreateDummy() ; Create dummy control <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") ; Register handler to detect double click <<<<<<<<<<<<<<<<< While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Dodaj Dodaj() Case $Skasuj If Not GUICtrlRead($Przepisy) = "" Then $DoSkasownia = _GUICtrlListBox_FindInText($Przepisy, GUICtrlRead($Przepisy)) _GUICtrlListBox_DeleteString($Przepisy, $DoSkasownia) EndIf Case $cDblClk ; Dummy control fired <<<<<<<<<<<<<<<<<<<<<< $sText = GUICtrlRead($cDblClk) ; Get text <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< MsgBox($MB_OK, "DoubleClicked", $sText) ; Display it <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< EndSwitch WEnd Func Dodaj() Local $GuiDodaj = GUICreate("Dodawanie przepisu", 267, 357, 192, 124) GUICtrlCreateLabel("Podaj nazwe przepisu:", 64, 8, 139, 22) GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS") $Nazwa = GUICtrlCreateInput("", 0, 32, 265, 21) GUICtrlCreateLabel("Tutaj daj przepis:", 72, 64, 113, 22) GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS") $Przepis = GUICtrlCreateEdit("", 0, 88, 265, 225) GUICtrlSetData(-1, "Przepis") $Koniec = GUICtrlCreateButton("Dodaj!", 49, 320, 169, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($GuiDodaj) Return Case $Koniec GUICtrlSetData($Przepisy, GUICtrlRead($Nazwa) & "|") GUIDelete($GuiDodaj) Return EndSwitch WEnd EndFunc ;==>Dodaj Func _WM_COMMAND($hWnd, $msg, $wParam, $lParam) Local $nCode = BitShift($wParam, 16) ; HiWord Local $nIDFrom = BitAND($wParam, 0xFFFF) ; LoWord Switch $nIDFrom Case $Przepisy Switch $nCode Case $LBN_DBLCLK $sListItem = GUICtrlRead($Przepisy) ; Read selected item <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSendToDummy($cDblClk, $sListItem) ; Send the text to the dummy control and fire it <<<<<<<<<<<<<<<<<<< EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND All clear? M23 czardas and Bumek662 2 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...
FireFox Posted July 19, 2013 Share Posted July 19, 2013 (edited) If you had searched in the forum with the keywords "list double click" you would have found a few topics with the solution as Melba23's just gave you. Here is your cleaned code :expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #region GUI Local $hGUI = GUICreate("Kulinarne przepisy", 293, 294, 302, 218) Global $iListPrzepisy = GUICtrlCreateList("xd", 0, 0, 153, 292) GUICtrlSetData($iListPrzepisy, "Skasuj Mnie|") Local $iBtnSkasuj = GUICtrlCreateButton("Skasuj", 160, 146, 129, 49) Local $iBtnDodaj = GUICtrlCreateButton("Dodaj", 160, 90, 129, 49) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW, $hGUI) #endregion Local $iDoSkasownia = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $iBtnDodaj Dodaj() Case $iBtnSkasuj If GUICtrlRead($iListPrzepisy) <> "" Then $iDoSkasownia = _GUICtrlListBox_FindInText($iListPrzepisy, GUICtrlRead($iListPrzepisy)) _GUICtrlListBox_DeleteString($iListPrzepisy, $iDoSkasownia) EndIf EndSwitch WEnd GUIDelete($hGUI) Func Dodaj() Local $iInputNazwa = 0, $iEditPrzepis = 0, $iBtnDodaj2 = 0 Local $hGUIDodaj = GUICreate("Dodawanie przepisu", 267, 357, 192, 124) GUICtrlCreateLabel("Podaj nazwe przepisu:", 64, 8, 139, 22) GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS") $iInputNazwa = GUICtrlCreateInput("", 0, 32, 265, 21) GUICtrlCreateLabel("Tutaj daj przepis:", 72, 64, 113, 22) GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS") $iEditPrzepis = GUICtrlCreateEdit("", 0, 88, 265, 225) GUICtrlSetData($iEditPrzepis, "Przepis") $iBtnDodaj2 = GUICtrlCreateButton("Dodaj!", 49, 320, 169, 33) GUISetState(@SW_SHOW, $hGUIDodaj) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete($hGUIDodaj) Return Case $iBtnDodaj2 GUICtrlSetData($iListPrzepisy, GUICtrlRead($iInputNazwa) & "|") GUIDelete($hGUIDodaj) Return EndSwitch WEnd EndFunc ;==>Dodaj Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Local $iIDFrom = 0, $iCode = 0 $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word Switch $iIDFrom Case $iListPrzepisy Switch $iCode Case $LBN_DBLCLK ConsoleWrite("Item double clicked: " & GUICtrlRead($iListPrzepisy) & @CrLf) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFYBr, FireFox. Edited July 19, 2013 by FireFox Bumek662 1 Link to comment Share on other sites More sharing options...
Bumek662 Posted July 19, 2013 Author Share Posted July 19, 2013 (edited) I have problem, first double click - working If i double click secound time - program crash. http://scr.hu/12lk/e9ofb Edited July 19, 2013 by Bumek662 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 19, 2013 Moderators Share Posted July 19, 2013 Bumek662,The code I posted does not crash after multiple doubleclicks. What code are you using? 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...
FireFox Posted July 19, 2013 Share Posted July 19, 2013 (edited) @Melba23It crashes with the stable version 3.3.8.1 but not with the beta one.He is using your code. Edited July 19, 2013 by FireFox Bumek662 1 Link to comment Share on other sites More sharing options...
Bumek662 Posted July 19, 2013 Author Share Posted July 19, 2013 Yeah, FireFox code all work, thanks. 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