Jump to content

how to disable listview items with checkboxes


Recommended Posts

Hi,

A guy on this forum asked this question, along with many others. I answered his other questions but didn't find an answer for this 1..

Anybody knows?

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

Can't get GuiCtrlSetState to work.. The listview itself is treated as a ctrlitem. It's disabling the entire list not the individual list items.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include<listviewconstants.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $listview, $button, $item1, $item2, $item3, $input1, $msg
    
    GUICreate("listview items", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES)
    GUISetBkColor(0x00E0FFFF)  ; will change background color

    $listview = GUICtrlCreateListView("col1  |col2|col3  ", 10, 10, 200, 150,"",$LVS_EX_CHECKBOXES);,$LVS_SORTDESCENDING)
    $button = GUICtrlCreateButton("Value?", 75, 170, 70, 20)
    $item1 = GUICtrlCreateListViewItem("item2|col22|col23", $listview)
    GUICtrlSetState(-1,$gui_disable)
    $item2 = GUICtrlCreateListViewItem("item1|col12|col13", $listview)
    $item3 = GUICtrlCreateListViewItem("item3|col32|col33", $listview)
    $input1 = GUICtrlCreateInput("", 20, 200, 150)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)   ; to allow drag and dropping
    GUISetState()
    GUICtrlSetData($item2, "ITEM1")
    GUICtrlSetData($item3, "||COL33")
    GUICtrlDelete($item1)

    Do
        $msg = GUIGetMsg()
        
        Select
            Case $msg = $button
                MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2)
            Case $msg = $listview
                MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2)
        EndSelect
    Until $msg = $GUI_EVENT_CLOSE
EndFunc   ;==>Example
[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

Have a look at _GUICtrlListView_SetItemState

:D

Stefan

These are the only states supported for _GUICtrlListView_SetItemState(). Doesn't have disabling.

$LVIS_CUT - The item is marked for a cut-and-paste operation

$LVIS_DROPHILITED - The item is highlighted as a drag-and-drop target

$LVIS_FOCUSED - The item has the focus, so it is surrounded by a standard focus rectangle

$LVIS_SELECTED - The item is selected

$LVIS_OVERLAYMASK - Use this mask to retrieve the item's overlay image index

$LVIS_STATEIMAGEMASK - Use this mask to retrieve the item's state image index

Hi,

i don't know, if i understand your question correctly.

My question is simple. There are these checkboxes in the listview for each item. I want to disable them for some items, so that user cannot check these items.

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
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...