May 11, 2024, 12:24:14 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


LISTVIEW with CHECKBOX how set to default ON, instead of OFF

Started by billhsln, January 15, 2008, 11:21:49 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

billhsln

I am working on a program that uses as LISTVIEW with 2 columns.  The first column has a CHECKBOX, it defaults to not being checked.  How to I force it to be Checked.

Any help will be appreciated.

Thanks,
Bill
When all else fails, get a bigger hammer.

LarryMc

These are the 2 routines I used.Sub SetCheckState(win:Window,cid:Int,index:Int,ticked:Int)
   Def litem:LVITEM
   litem.mask=LVIF_STATE
   If ticked Then ticked = 0x2000 Else ticked = 0x1000
   litem.state=ticked
   litem.stateMask=LVIS_STATEIMAGEMASK
   SendMessage(win,LVM_SETITEMSTATE,index,litem,cid)
   Return
EndSub

Sub GetCheckState(win:Window,cid:Int,index:Int),Int
int n
   'State image 1 is the unchecked box, and state image 2 is the checked box.
   'Setting the state image To zero removes the check box altogether.
   n=(SendMessage(win,LVM_GETITEMSTATE,index,LVIS_STATEIMAGEMASK,cid))/4096
   Return (n=2)
EndSub

You've already got a version of the GetCheckState

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

Thank you, Larry.  That looks like it is exactly what I am looking for.

Bill
When all else fails, get a bigger hammer.