News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How do I create a dynamic list of check boxes?

Started by AParsons, November 17, 2011, 05:38:48 AM

Previous topic - Next topic

AParsons

Hi,

First I had a bit of a search but didn't come up with anything. Normally I find what I need without posting.

So I was trying to find where I start to create a dynamic list of check boxes. By this I mean do I create an array or structure of checkbox objects? And how do I do that?

Can someone please point me in the right direction please.

Regards,
Andrew

MichaelW

eschew obfuscation

AParsons

When it finds a .scr it creates a checkbox, in a listview, I think.

I just wanted to create my own screensaver swapper. Just to learn. I know that there is heaps of these programs on the internet, but, in my view it is easier to learn by doing.

ragdog

Hi

I use this in my programm to Add by a item in the listview to check item or not

invoke   AddItem,CTEXT ("Item1"),1 ; 1 for check listview checkbox and 0 for Not check

DONT forget set the style of InsertColumns >>LVS_EX_CHECKBOXES


.const
; // ListView
LVIS_CHECKED      equ 2000h
LVIS_UNCHECKED    equ 1000h

.code
InsertColumns proc
LOCAL lvc:LV_COLUMN
    invoke    SendMessage,hListView, LVM_SETEXTENDEDLISTVIEWSTYLE,0,LVS_EX_FULLROWSELECT or LVS_EX_CHECKBOXES  ;// Set style   
   mov    lvc.imask,LVCF_WIDTH
  ; mov    lvc.pszText,offset szList1
   mov    lvc.lx,360
invoke    SendMessage,hListView, LVM_INSERTCOLUMN,0,addr lvc
    ret
InsertColumns endp



AddItem PROC uses ebx ecx _Item:DWORD,bCheck:BOOL
LOCAL Item :LV_ITEM

mov    Item.imask, LVIF_TEXT or LVIF_STATE
     mov Item.iSubItem, 0
mov    Item.stateMask, LVIS_STATEIMAGEMASK
.if bCheck==1
        mov   Item.state, LVIS_CHECKED  ;Check Items
        mov   ebx,_Item
        mov   Item.pszText, ebx
     invoke   SendMessage, hListView, LVM_INSERTITEM, 0, addr Item
        lea   ecx, Item
     invoke   SendMessage,hListView, LVM_SETITEMSTATE, eax, ecx
   .else
           mov   Item.state, LVIS_UNCHECKED ;Uncheck Items
           mov   ebx,_Item
           mov   Item.pszText, ebx
        invoke SendMessage, hListView, LVM_INSERTITEM, 0, addr Item
.endif

inc Item.iItem
     ret     
AddItem ENDP




Get the extension of the found file

invoke PathFindExtension,CTEXT ("C:\xyz\test.scr") ; in eax is now ".scr"

Now can you compare the extension .scr

if
invoke   AddItem,CTEXT ("Item1"),1
else
invoke   AddItem,CTEXT ("Item1"),0
endif


Greets

AParsons

Ragdog,

Thankyou for your help. I appreciate it.