Sign in to follow this  
Followers 0
GordonFreeman

Get state of ListViewItem checked or not ($LVS_EX_CHECKBOXES)

6 posts in this topic

#1 ·  Posted (edited)

I guys!

I have an simple listview control with exstyle ($LVS_EX_CHECKBOXES) and i need get item state (Checked or not).

I tried:
 
$r = GUICtrlSendMsg($LVI1, $LVM_GETITEMSTATE, 1, $LVIS_SELECTED)
$r2 = GUICtrlRead($LVI1)

GUICtrlSetState($LVI1,$GUI_CHECKED)

MsgBox(0,"", $r & "|" & $r2)
 

With and without guictrlsetstate but return same result if checked or not.

Guictrlsetstate is working fine!

I trying without include listview native udf

my listview code:

$ListView1 = GUICtrlCreateListView("Software|Instalador|Comando", 16, 32, 585, 337,-1,BitOR($LVS_EX_CHECKBOXES,$LVS_EX_GRIDLINES))
Edited by GordonFreeman

Share this post


Link to post
Share on other sites



GordonFreeman,

if you look in the Helpfile under <User Defined Function Reference - GUI Reference - GuiListView user defined functions Reference> you will find the _GUICtrlListView_GetItemChecked function - which is exactly what you need. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

GordonFreeman,

if you look in the Helpfile under <User Defined Function Reference - GUI Reference - GuiListView user defined functions Reference> you will find the _GUICtrlListView_GetItemChecked function - which is exactly what you need. :)

M23

Ok. I will use it. And i will use all code with GuiListview.au3

Is not good idea misc normal listview controls with functions of this include right?!

Thanks Melba!

Edited by GordonFreeman

Share this post


Link to post
Share on other sites

GordonFreeman,

 

i will use all code with GuiListview.au3

No need - most of the UDF functions work with the native ListView control as well - and that is usually easier to code. But I would certainly recommend that you create the items the same way (native/UDF) that you create the ListView - mixing those 2 is very likely to end in tears. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Ok.

We resolve the problem with checked states:

GUICtrlSetState($LVI1,$GUI_CHECKED)

$r = _GUICtrlListView_GetItemChecked($ListView1,0)

MsgBox(0,"",$r)

Working!

 

Now i have other problem. I need Disable a item of listview and get state.

I tried:

GUICtrlSetState($LVI1,$GUI_DISABLE)

MsgBox(0,"",GUICtrlGetState($LVI1))

No sucess, control was not disabled and i got the same state (80)

And i not now how i can use

_GUICtrlListView_SetItemState

Edited by GordonFreeman

Share this post


Link to post
Share on other sites

GordonFreeman,

You cannot "disable" a ListView item - but you can remove the checkbox like this. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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