Sign in to follow this  
Followers 0
benners

[Solved] Problem with Listview and double click

8 posts in this topic

#1 ·  Posted (edited)

I have a program that contains tabs and a listview. The user selects single or multiple exes and the listview is populated with the file names, the listview has checkboxes and when the user checks or unchecks a box a label is updated with the current number selected.

If the selections are made normally the program acts as it should but if a user double clicks the amount of check boxes currently selected gets out of line with the actual number selected. I have posted the code below which I found on this forum whilst looking for ways to do the task initially and modified it a bit to simulate my problem. Can someone offer a solution or a better way to do what I require. I have tried using GUIRegisterMsg and $WM_NOTIFY but I am unsure of how to get the listview index where the mouse\selection is and as click is before double click I would assume the same thing would happen with the checkbox.

CODE
#include <GuiConstants.au3>

#include <guilistview.au3>

Opt("GuiOnEventMode", 1)

Global $Selected = 0

$GUI = GUICreate("Test")

GUISetOnEvent(-3, "Quit")

$label1 = GUICtrlCreateLabel('Selected = ', 10, 250)

$label2 = GUICtrlCreateLabel('', 70, 250)

$ListView = GUICtrlCreateListView("Column1", 20, 40, 200, 200, -1, $LVS_EX_CHECKBOXES + $WS_EX_OVERLAPPEDWINDOW)

Dim $avLVItems[5]

For $i = 0 To 4

$avLVItems[$i] = GUICtrlCreateListViewItem("Item" & $i, $ListView)

GUICtrlSetOnEvent(-1, "_LVHit")

Next

GUICtrlSetData($label2, $selected)

GUISetState()

While 1

Sleep(20)

WEnd

Func Quit()

Exit

EndFunc ;==>Quit

Func _LVHit()

For $i = 0 To 4

If @GUI_CtrlId = $avLVItems[$i] Then

If _GUICtrlListView_GetItemChecked($ListView, $i) = True Then ; The selected item is checked.

If $Selected <> $avLVItems[0] Then $Selected += 1 ; Increase the selected count.

GUICtrlSetData($label2, $selected)

Else ; The selected item is unchecked.

If $Selected <> 0 Then $Selected -= 1 ; Increase the selected count.

GUICtrlSetData($label2, $selected)

EndIf

ExitLoop

EndIf

Next

EndFunc ;==>_LVHit

Thanks

Edited by benners

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I have a program that contains tabs and a listview. The user selects single or multiple exes and the listview is populated with the file names, the listview has checkboxes and when the user checks or unchecks a box a label is updated with the current number selected.

If the selections are made normally the program acts as it should but if a user double clicks the amount of check boxes currently selected gets out of line with the actual number selected. I have posted the code below which I found on this forum whilst looking for ways to do the task initially and modified it a bit to simulate my problem. Can someone offer a solution or a better way to do what I require. I have tried using GUIRegisterMsg and $WM_NOTIFY but I am unsure of how to get the listview index where the mouse\selection is and as click is before double click I would assume the same thing would happen with the checkbox.

CODE
#include <GuiConstants.au3>

#include <guilistview.au3>

Opt("GuiOnEventMode", 1)

Global $Selected = 0

$GUI = GUICreate("Test")

GUISetOnEvent(-3, "Quit")

$label1 = GUICtrlCreateLabel('Selected = ', 10, 250)

$label2 = GUICtrlCreateLabel('', 70, 250)

$ListView = GUICtrlCreateListView("Column1", 20, 40, 200, 200, -1, $LVS_EX_CHECKBOXES + $WS_EX_OVERLAPPEDWINDOW)

Dim $avLVItems[5]

For $i = 0 To 4

$avLVItems[$i] = GUICtrlCreateListViewItem("Item" & $i, $ListView)

GUICtrlSetOnEvent(-1, "_LVHit")

Next

GUICtrlSetData($label2, $selected)

GUISetState()

While 1

Sleep(20)

WEnd

Func Quit()

Exit

EndFunc ;==>Quit

Func _LVHit()

For $i = 0 To 4

If @GUI_CtrlId = $avLVItems[$i] Then

If _GUICtrlListView_GetItemChecked($ListView, $i) = True Then ; The selected item is checked.

If $Selected <> $avLVItems[0] Then $Selected += 1 ; Increase the selected count.

GUICtrlSetData($label2, $selected)

Else ; The selected item is unchecked.

If $Selected <> 0 Then $Selected -= 1 ; Increase the selected count.

GUICtrlSetData($label2, $selected)

EndIf

ExitLoop

EndIf

Next

EndFunc ;==>_LVHit

Thanks
EDIT:See rasim's post next which has the solution and ignore this post.

I'm not sure I understood, but does this do what you want? I think the double click prevention might be difficult so I didn't try that.

#include <GuiConstants.au3>
#include <guilistview.au3>
AdlibEnable("setChecks", 200)
Opt("GuiOnEventMode", 1)
Global $set[5]
Global $Selected = 0

$GUI = GUICreate("Test")
GUISetOnEvent(-3, "Quit")
$label1 = GUICtrlCreateLabel('Selected = ', 10, 250)
$label2 = GUICtrlCreateLabel('', 70, 250)

$ListView = GUICtrlCreateListView("Column1", 20, 40, 200, 200, -1, $LVS_EX_CHECKBOXES + $WS_EX_OVERLAPPEDWINDOW)
Dim $avLVItems[5]

For $i = 0 To 4
    $avLVItems[$i] = GUICtrlCreateListViewItem("Item" & $i, $ListView)
    GUICtrlSetOnEvent(-1, "_LVHit")
Next

GUICtrlSetData($label2, $Selected)
GUISetState()

While 1
    Sleep(20)
WEnd

Func Quit()
    Exit
EndFunc ;==>Quit

Func _LVHit()
    For $i = 0 To 4
        If _GUICtrlListView_GetItemChecked($ListView, $i) = True Then; The selected item is checked.
            If $set[$i] = 0 Then $Selected += 1; Increase the selected count.
            $set[$i] = 1
        Else
            If $set[$i] = 1 Then $Selected -= 1
            $set[$i] = 0
        EndIf
    Next
    GUICtrlSetData($label2, $Selected)
EndFunc ;==>_LVHit

Func setChecks()
    Local $y
    For $y = 0 To 4
        _GUICtrlListView_SetItemChecked($ListView, $y, $set[$y] = 1)
    Next
EndFunc ;==>setChecks
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

benners

Try this:

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt("GuiOnEventMode", 1)

Global $Selected = 0

$GUI = GUICreate("Test")
GUISetOnEvent(-3, "Quit")

$label1 = GUICtrlCreateLabel('Selected = ', 10, 250)
$label2 = GUICtrlCreateLabel('', 70, 250)

$ListView = GUICtrlCreateListView("Column1", 20, 40, 200, 200, -1, $LVS_EX_CHECKBOXES + $WS_EX_OVERLAPPEDWINDOW)

Dim $avLVItems[5]

For $i = 0 To 4
    $avLVItems[$i] = GUICtrlCreateListViewItem("Item" & $i, $ListView)
Next

GUICtrlSetData($label2, $selected)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

GUISetState()

While 1
    Sleep(100)
WEnd

Func Quit()
    Exit
EndFunc ;==>Quit

Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
    Local $tNMHDR, $IdFrom, $iCode
    
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $IdFrom = DllStructGetData($tNMHDR, "IdFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    
    Switch $IdFrom
        Case $ListView
            Switch $iCode
                Case $NM_CLICK, $NM_DBLCLK
                        Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                        Local $iIndex = DllStructGetData($tInfo, "Index")
                        
                        If $iIndex <> -1 Then
                            Local $iX = DllStructGetData($tInfo, "X")
                            Local $aRect = _GUICtrlListView_GetItemRect($ListView, $iIndex)
                            If ($iX < $aRect[0]) And ($iX >= 5) Then _GetItemChecked(_GUICtrlListView_GetItemChecked($ListView, $iIndex) = 0)
                        EndIf
            EndSwitch
    EndSwitch
    
    Return $GUI_RUNDEFMSG
EndFunc

Func _GetItemChecked($sState)
    If $sState = True Then
        $Selected += 1
    Else
        $Selected -= 1
    EndIf
    GUICtrlSetData($label2, $Selected)
EndFunc

Share this post


Link to post
Share on other sites

benners

Try this:

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt("GuiOnEventMode", 1)

Global $Selected = 0

$GUI = GUICreate("Test")
GUISetOnEvent(-3, "Quit")

$label1 = GUICtrlCreateLabel('Selected = ', 10, 250)
$label2 = GUICtrlCreateLabel('', 70, 250)

$ListView = GUICtrlCreateListView("Column1", 20, 40, 200, 200, -1, $LVS_EX_CHECKBOXES + $WS_EX_OVERLAPPEDWINDOW)

Dim $avLVItems[5]

For $i = 0 To 4
    $avLVItems[$i] = GUICtrlCreateListViewItem("Item" & $i, $ListView)
Next

GUICtrlSetData($label2, $selected)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

GUISetState()

While 1
    Sleep(100)
WEnd

Func Quit()
    Exit
EndFunc ;==>Quit

Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
    Local $tNMHDR, $IdFrom, $iCode
    
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $IdFrom = DllStructGetData($tNMHDR, "IdFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    
    Switch $IdFrom
        Case $ListView
            Switch $iCode
                Case $NM_CLICK, $NM_DBLCLK
                        Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                        Local $iIndex = DllStructGetData($tInfo, "Index")
                        
                        If $iIndex <> -1 Then
                            Local $iX = DllStructGetData($tInfo, "X")
                            Local $aRect = _GUICtrlListView_GetItemRect($ListView, $iIndex)
                            If ($iX < $aRect[0]) And ($iX >= 5) Then _GetItemChecked(_GUICtrlListView_GetItemChecked($ListView, $iIndex) = 0)
                        EndIf
            EndSwitch
    EndSwitch
    
    Return $GUI_RUNDEFMSG
EndFunc

Func _GetItemChecked($sState)
    If $sState = True Then
        $Selected += 1
    Else
        $Selected -= 1
    EndIf
    GUICtrlSetData($label2, $Selected)
EndFunc
Very good rasim, I couldn't see how to do that.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Very good rasim, I couldn't see how to do that.

Thanks martin and rasim for your help. I have tried to implement the code into my program but am having some problems. I posted the first code because it simplified my intention and the proper code I didn't want to post because it is a joint effort and there are pointers to other files and resources that I would need to post as well.

I have since gone through the code and removed all the stuff that may not be required to work, the main aims of this code are :-

The user selects Microsoft Hotfixes which are then added to the listview. (Using the Actions button)

An array is created with the file names in the first code this was represented by $avLVItems[5] but really the array has a different element total each time, not .5

The Tab is updated with the total count and selected count, these are the same to begin with.

Actions can then be performed on the files and the listview is updated. If a user does not want a file or files to be altered they can uncheck them.

When the files are selected\unselected the tab text changes with the updates, this is where the problem with the dbl click comes in.

I have tried to use both codes but was unable to get any to work successfully and was using the LVClick method instead of WM_Notify because I don't really understand the mechanics of the code and try not to cut and paste things I can't alter after but it looks like that would be the better course to take. I may be able to add things for other controls later so I would ask again if you could lend a hand and find out what it wrong.

I have looked at the code by rasim and the _GetItemChecked function is not getting fired I think because of the $iX < $aRect[0] as $iX is always greater than $aRect. As I have mentioned earlier I cannot understand all of the code to alter it

Here is the new code

CODE

; Koda Includes.

#include <GUIConstantsEx.au3>

#include <GuiListView.au3>

#include <ListViewConstants.au3>

; Extra Includes.

#include <file.au3>

#include <array.au3>

#include <String.au3>

#include <GuiTab.au3>

Opt("GUIOnEventMode", 1)

Global $HF_Path, $HF_Count, $HF_Selected

Dim $PDrive, $PPath, $PFile, $PExt, $StrToChk, $files

#Region ### GUI section ###

$OIMain = GUICreate("Hotfix selector ", 446, 394, -1, -1)

$Tab1 = GUICtrlCreateTab(5, 51, 435, 337)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)

#Region ### Hotfix Tab ###

$HF_Tab = GUICtrlCreateTabItem("Hotfix ( 0 )")

$Listview = GUICtrlCreateListView("KB Number|Description|Filename|Internal Filename", 15, 96, 415, 250, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT))

GUICtrlSetBkColor($Listview, $GUI_BKCOLOR_LV_ALTERNATE) ; Set back colour for Hotfix listview.

GUICtrlSendMsg(-1, 0x101E, 0, 90)

GUICtrlSendMsg(-1, 0x101E, 1, 100)

GUICtrlSendMsg(-1, 0x101E, 2, 100)

GUICtrlSendMsg(-1, 0x101E, 3, 120)

$HF_Path_lbl = GUICtrlCreateLabel("", 17, 360, 334, 17)

GUISetOnEvent(-1, '_button_clicked')

GUICtrlSetColor(-1, 0xFF0000)

$HF_Actions_btn = GUICtrlCreateButton("Actions", 354, 357, 75, 21, 0)

GUICtrlSetOnEvent(-1, '_button_clicked')

$HF_Actions_btncontext = GUICtrlCreateContextMenu($HF_Actions_btn)

$HF_Browse = GUICtrlCreateMenuItem('Browse...', $HF_Actions_btncontext)

GUICtrlSetOnEvent(-1, '_HF_Btn_Cmenu')

#EndRegion ### Hotfix Tab ###

GUISetState(@SW_SHOW)

#EndRegion ### GUI section ###

GUISetOnEvent($GUI_EVENT_CLOSE, "_DoExit") ; Exit when 'X' clicked.

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

While 1

Sleep(10)

WEnd

; # GUI Functions #####################

Func _button_clicked() ; On events for the buttons

Switch @GUI_CtrlId ; Get the control that was clicked.

Case $HF_Actions_btn ; Hotfix actions button.

DllCall("user32.dll", "ptr", "SendMessage", "hwnd", ControlGetHandle($OIMain, "", $HF_Actions_btn), "int", $WM_CONTEXTMENU, "int", $HF_Actions_btn, "int", 0)

EndSwitch

EndFunc ;==>_button_clicked

Func _HF_Btn_Cmenu() ; Hotfix actions menu.

Switch GUICtrlRead(@GUI_CtrlId, 1) ; Get the text of the clicked context menu option.

Case 'Browse...'; Browse for Hotfixes.

$var = FileOpenDialog('Browse', '', "Hotfixes (*.exe)", 1 + 4)

If $var = '' Then Return ; User cancelled.

$aArray = StringSplit($var, '|') ; Read the hotfixes to an array

_ArraySort($aArray, '', 2) ; Sort them according to KB #

$var = _ArrayToString($aArray, '|', 1) ; Write the sorted strings back to the variable

_HF_Check($var) ; Check the Hotfixes.

EndSwitch

EndFunc ;==>_HF_Btn_Cmenu

Func _HF_Tab_Upd() ; Update the Hotfix Tab

MsgBox(0,'','hello')

$Tab_Text = _GUICtrlTab_GetItemText($Tab1, 0) ; Get the text of the Hotfix tab.

$string = _StringBetween($Tab_Text, '( ', '\') ; Get the # of selected Hotfixes.

GUISetState(@SW_LOCK, $OIMain) ; Lock the GUI to avoid repainting.

_GUICtrlTab_SetItemText($Tab1, 0, StringReplace($Tab_Text, $string[0], $HF_Selected, 1)) ; Update the number of selected Hotfixes.

GUISetState(@SW_UNLOCK, $OIMain) ; Unlock the GUI

EndFunc ;==>_HF_Tab_Upd

Func _HF_Check($StrToChk, $ShowErrMsg = 1) ; Checks an exe for Hotfix info ($StrToChk = String to check, $ShowErrMsg = Should msg box be shown - Default is yes).

Local $Hotfix_Desc ; Hotfix description.

Local $IntName ; Hotfix Internal name.

Local $HF_FName ; Name of Hotfix

$HF_Count = 0 ; # of Hotfixes.

$HF_Selected = 0 ; # of Hotfixes Selected.

GUISetState(@SW_LOCK, $OIMain) ; Lock the GUI to stop repainting.

_GUICtrlTab_SetItemText($Tab1, 0, 'Hotfix ( 0 )') ; Reset the Hotfixes tab text.

_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($Listview)) ; Delete all the Hotfixes

$files = StringSplit($StrToChk, '|') ; Add the filenames to an array.

If @error = 1 Then ; No delimiters, assume its a single file. Returns string in $Files[1].

_PathSplit($files[1], $PDrive, $PPath, $PFile, $PExt) ; Split the Hotfix string.

GUICtrlSetData($HF_Path_lbl, $PDrive & $PPath) ; Set the Hotfix folder

$HF_FName = StringRegExpReplace($files[1], ".*[\\|/]", "", 0) ; Get a Hotfix name.

$HF_Count = 1 ; Set the Count to 1

$HF_Selected = 1 ; Set the # of selected Hotfixes to 1.

$Hotfix_Desc = FileGetVersion($files[1], 'FileDescription')

; Get the Hotfix description.

$IntName = FileGetVersion($files[1], 'InternalName') ; Get the Internal name

$LV_Item = GUICtrlCreateListViewItem(StringUpper(StringMid($HF_FName, StringInStr($HF_FName, 'KB'), 8)) & '|' & $Hotfix_Desc & '|' & $HF_FName & '|' & $IntName, $Listview) ; Add to the listview.

GUICtrlSetBkColor($LV_Item, 0xFCF6EA) ; Alternate the back colour

_GUICtrlListView_SetItemChecked($Listview, 0, True) ; Check the Hotfix.

_ResizeHotfix() ; Resize the listview.

_GUICtrlTab_SetItemText($Tab1, 0, 'Hotfix ( ' & $files[0] & ' )') ; Set the # of Hotfixes on the tab.

$files = $StrToChk ; Set the return value.

_ResizeHotfix() ; Resize the listview.

_GUICtrlTab_SetItemText($Tab1, 0, 'Hotfix ( ' & $HF_Selected & '\' & $HF_Count & ' )') ; Set the # of Hotfixes on the tab.

$files = $StrToChk ; Set the return value.

Else ; Multiple files selected.

GUICtrlSetData($HF_Path_lbl, $files[1] & '\') ; Set the Hotfix folder and add a trailing slash.

$NewFiles = _ArrayCreate($files[1]) ; Start a new array and add the directory containing the files.

For $i = 2 To $files[0] ; Loop through the files.

$HF_Count += 1 ; Increase the Hotfix count.

_ArrayAdd($NewFiles, $files[$i]) ; Add to array.

$Hotfix_Desc = FileGetVersion($files[1] & '\' & $files[$i], 'FileDescription') ; Get the Hotfix description.

$IntName = FileGetVersion($files[1] & '\' & $files[$i], 'InternalName') ; Get the Internal name

$LV_Item = GUICtrlCreateListViewItem(StringUpper(StringMid($files[$i], StringInStr($files[$i], 'KB'), 8)) & '|' & $Hotfix_Desc & '|' & $files[$i] & '|' & $IntName, $Listview) ; Add to the listview

GUICtrlSetBkColor($LV_Item, 0xFCF6EA) ; Alternate the back colour

_GUICtrlListView_SetItemChecked($Listview, (_GUICtrlListView_GetItemCount($Listview) - 1), True) ; Check the Hotfix.

Next

$HF_Selected = $HF_Count ; Set the # of selected Hotfixes.

_GUICtrlTab_SetItemText($Tab1, 0, 'Hotfix ( ' & $HF_Selected & '\' & $HF_Count & ' )') ; Set the # of Hotfixes on the tab.

If UBound($NewFiles) > 2 Then $files = _ArrayToString($NewFiles, '|') ; Multiple files are Hotfixes.

If UBound($NewFiles) = 2 Then $files = StringReplace(_ArrayToString($NewFiles, '|'), '|', '\') ; 1 file is a Hotfix.

If UBound($NewFiles) < 2 Then $files = '' ; No files are Hotfixes.

EndIf

_ResizeHotfix(); Resize the listview

GUISetState(@SW_UNLOCK, $OIMain) ; Unlock the GUI (avoids repainting flicker).

EndFunc ;==>_HF_Check

Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)

Local $tNMHDR, $IdFrom, $iCode

$tNMHDR = DllStructCreate($tagNMHDR, $lParam)

$IdFrom = DllStructGetData($tNMHDR, "IdFrom")

$iCode = DllStructGetData($tNMHDR, "Code")

Switch $IdFrom

Case $ListView

Switch $iCode

Case $NM_CLICK, $NM_DBLCLK

Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)

Local $iIndex = DllStructGetData($tInfo, "Index")

If $iIndex <> -1 Then

Local $iX = DllStructGetData($tInfo, "X")

Local $aRect = _GUICtrlListView_GetItemRect($ListView, $iIndex)

If ($iX < $aRect[0]) And ($iX >= 5) Then _GetItemChecked(_GUICtrlListView_GetItemChecked($ListView, $iIndex) = 0)

EndIf

EndSwitch

EndSwitch

Return $GUI_RUNDEFMSG

EndFunc

Func _GetItemChecked($sState)

If $sState = True Then

$HF_Selected += 1

Else

$HF_Selected -= 1

EndIf

_HF_Tab_Upd() ; Update the Hotfix Tab

EndFunc

Func _DoExit() ; Close the program.

Exit

EndFunc ;==>_DoExit

Func _ResizeHotfix() ; Resize the Hotfix listview columns.

_GUICtrlListView_SetColumnWidth($Listview, 1, $LVSCW_AUTOSIZE_USEHEADER)

_GUICtrlListView_SetColumnWidth($Listview, 2, $LVSCW_AUTOSIZE_USEHEADER)

_GUICtrlListView_SetColumnWidth($Listview, 3, $LVSCW_AUTOSIZE_USEHEADER)

EndFunc ;==>_ResizeHotfix

thanks again to those who replied.

Share this post


Link to post
Share on other sites

In the function WM_NOTIFY change the line

Local $aRect = _GUICtrlListView_GetItemRect($Listview, $iIndex)

to

Local $aRect = _GUICtrlListView_GetItemRect($Listview, $iIndex,2);<-- add ,2 to indicate it's the the bounding rectangle for the text of the item


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

In the function WM_NOTIFY change the line

Local $aRect = _GUICtrlListView_GetItemRect($Listview, $iIndex)

to

Local $aRect = _GUICtrlListView_GetItemRect($Listview, $iIndex,2);<-- add ,2 to indicate it's the the bounding rectangle for the text of the item

Thanks martin and rasim

there's no way I would have thought to do it this way. :D

I know that _GUICtrlListView_GetItemRect gets the bounding rectangle for my listview but WTF is a bounding rectangle?. is it the checkbox? :D

Share this post


Link to post
Share on other sites

but WTF is a bounding rectangle?. is it the checkbox? :D

As I said in my post "it's the the bounding rectangle for the text of the item". The item has text and it has a checkbox. if you draw a rectangle round just the text so that all the text just fits inside the rectangle then that is the bounding rectangle for the text. The important thing was that the cursor position had to be to the left of the bounding rectangle. Without the final 2 as a parameter the rectangle included the checkbox so the cursor was always inside. At least that is how I understood it.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
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
Sign in to follow this  
Followers 0