Jump to content

ListView Hot Items


 Share

Recommended Posts

Hi All,

To my postNr's I look like a beginner but I'm very pleased with the help and the forum for almost all my questions. and I've managed a LOT with autoit without posting :D

But currently I'm struggled with the use of 2 listviews.

To know what I mean it's handy to see the attached image XMLStatusIntern.jpg or just run the script (no home made UDF's).

The access database that it uses is automatically created with it's content, you need MSAccess for this :o

How it works:

There is a hierarchy in my program that for each StatusDetails there can be more BarcodeDetails.

So my goal is when a user clicks an item in the StatusDetails listview, that the Barcode Details Listview gets his Barcodes from the access database with the status that is hotClicked. that's ok and this works.

What doesnt work:

My second goal is that if the user is in the statusdetails, that EVERY hot item that is hot will load the Barcode Details, either by keyUp/Down, pageUp/Down or whatever.

Only with my WM_MY_COMMAND as following you can see that if the case is $LVN_KEYDOWN I get the HotItem with a messageBox. only the HotItem is the item that is clicked and not the item that is selected which is hot because it's blue?

Func MY_WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
    $hWndListView = $Lv_StaDet_Overzicht 
    If Not IsHWnd($Lv_StaDet_Overzicht) Then $hWndListView = GUICtrlGetHandle($Lv_StaDet_Overzicht)

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $LVN_KEYDOWN; A key has been pressed
                    $tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)

                    MsgBox(0, "", _GuiCtrlListView_GetHotItem(GuiCtrlGetHandle($Lv_StaDet_Overzicht))) 
                    $a_SelectedItemDetail   = _GUICtrlListView_GetItemTextArray($Lv_StaDet_Overzicht, _GuiCtrlListView_GetHotItem($Lv_StaDet_Overzicht))
                    _RefreshBarcodeDetails(3, $a_SelectedItemDetail[1])

                Case $NM_CLICK; Sent by a list-view control when the user clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                    $a_SelectedItemDetail   = _GUICtrlListView_GetItemTextArray($Lv_StaDet_Overzicht, _GuiCtrlListView_GetHotItem($Lv_StaDet_Overzicht))
                    _RefreshBarcodeDetails(3, $a_SelectedItemDetail[1])
                   ; No return value
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc

Maybe my intepretation is incorrect with HotItem, maybe someone can help me with this?

PLEASE :D

If there are any questions or if this isn't clear please don't hesitate to reply.

Link to comment
Share on other sites

And YES I found the solution !

In the while from the GUI i've included a Case Else that checkes if an item is selected and unequal to the previous one.

not pretty but functional !

Case Else
            $aStaSelectedIndice = _GUICtrlListView_GetSelectedIndices($Lv_StaDet_Overzicht, True)
            
            If $aStaSelectedIndice[0] > 0 and $aStaSelectedIndice[1] <> $istaDetIndex Then
                $iStaDetIndex = _GUICtrlListView_GetSelectedIndices($Lv_StaDet_Overzicht)
                
                $a_StaDetIndex = _GUICtrlListView_GetItemTextArray(GuiCtrlGetHandle($Lv_StaDet_Overzicht), $iStaDetIndex)
                _RefreshBarcodeDetails(3, $a_StaDetIndex[1])
            EndIf
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...