Terenz Posted June 18, 2014 Posted June 18, 2014 (edited) Hello guys, this is the script: expandcollapse popup#include <GuiListView.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <EditConstants.au3> Global $hGUI = GUICreate("Test", 280, 400, -1, -1) Global $cListview = GUICtrlCreateListView("NUMBER", 5, 5, 270, 272, BitOR($LVS_REPORT, $LVS_SINGLESEL)) Global $hListview = GUICtrlGetHandle($cListview) Global $Input = GUICtrlCreateInput("100", 81, 304, 45, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER)) Global $UpDownInput = GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1, 100, 1) GUICtrlCreateListViewItem(45, $cListview) GUICtrlCreateListViewItem(22, $cListview) GUICtrlCreateListViewItem(70, $cListview) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $tIndex, $tStruct $tStruct = DllStructCreate("hwnd;long;int;long;long", $ilParam) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch BitAND($iwParam, 0xFFFF) Case $UpDownInput If DllStructGetData($tStruct, 3) = 0xFFFFFD2E Then ; $UDN_DELTAPOS ConsoleWrite("Click") ;~ _GUICtrlListView_GetSelectedIndices($hListview) EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc What i want to do is: a ) Select an item in the listview b ) Click on the Updown control ( or write the numeric value in the input ) and edit the value in the listview selected item using WM_NOTIFY The main problem is when i click on the input or the Updown control the selected item in the listview disappear, so i can't make any change. Thanks for any help Edited June 18, 2014 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength
Moderators Melba23 Posted June 18, 2014 Moderators Posted June 18, 2014 Terenz,This looks as if it does what you want:expandcollapse popup#include <GuiListView.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <EditConstants.au3> Global $fFlag = False Global $hGUI = GUICreate("Test", 280, 400, -1, -1) Global $cListview = GUICtrlCreateListView("NUMBER", 5, 5, 270, 272, BitOR($LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_EDITLABELS)) GUICtrlSetBkColor($cListview, 0x00FFCC) Global $hListview = GUICtrlGetHandle($cListview) Global $Input = GUICtrlCreateInput("100", 81, 304, 45, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER)) Global $UpDownInput = GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1, 100, 1) GUICtrlCreateListViewItem(45, $cListview) GUICtrlCreateListViewItem(22, $cListview) GUICtrlCreateListViewItem(70, $cListview) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If $fFlag Then $fFlag = False $iSelected = _GUICtrlListView_GetSelectedIndices($hListview) If $iSelected <> "" Then _GUICtrlListView_EditLabel($hListview, $iSelected) Sleep(100) Send(GUICtrlRead($Input) & "{ENTER}") EndIf EndIf WEnd Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $tIndex, $tStruct $tStruct = DllStructCreate("hwnd;long;int;long;long", $ilParam) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $iIDFrom Case $UpDownInput If DllStructGetData($tStruct, 3) = 0xFFFFFD2E Then ; $UDN_DELTAPOS $fFlag = True EndIf EndSwitch Switch $iCode Case $LVN_BEGINLABELEDITW Local $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam) Return False Case $LVN_ENDLABELEDITW Local $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam) Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", _ DllStructGetData($tInfo, "Text")) Local $sNewText = DllStructGetData($tBuffer, "Text") If StringLen($sNewText) Then Return True EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFYPlease ask if you have any questions. 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
johnmcloud Posted June 18, 2014 Posted June 18, 2014 An alternative expandcollapse popup; Johnmcloud + superuser Melba23 - 2014 #include <GuiListView.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <EditConstants.au3> Global $fFlag = False Global $hGUI = GUICreate("Test", 280, 400, -1, -1) Global $cListview = GUICtrlCreateListView("NUMBER|Another Column", 5, 5, 270, 272, BitOR($LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) Global $hListview = GUICtrlGetHandle($cListview) Global $Input = GUICtrlCreateInput("100", 81, 304, 45, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER)) Global $UpDownInput = GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1, 100, 1) GUICtrlCreateListViewItem("45|A text 0", $cListview) GUICtrlCreateListViewItem("22|A text 1", $cListview) GUICtrlCreateListViewItem("75|A text 2", $cListview) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If $fFlag Then $fFlag = False $iSelected = _GUICtrlListView_GetSelectedIndices($hListview) If $iSelected <> "" Then Local $sControl = ControlGetFocus($hGUI) _GUICtrlListView_SetItemText($hListview, $iSelected, ControlGetText($hGUI, "", $sControl), 0) Sleep(10) EndIf EndIf WEnd Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0xFFFF) Local $iCode = BitShift($wParam, 16) If $iIDFrom = $Input And $iCode = $EN_CHANGE Then $fFlag = True EndFunc ;==>WM_COMMAND
Moderators Melba23 Posted June 18, 2014 Moderators Posted June 18, 2014 johnmcloud,Nice. 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