1. Listview - Adding an item

Hi all,
    I'm currently trying to add an item to a listview i made using a 
resource dialog, i think i did it the way it should be done, but it's 
not working :(
    This is what i got:

function makeLV_ITEM(sequence items)
    atom hwnd
    hwnd = allocate(36)
    for I = 0 to length(items)-1 do
        poke4(hwnd+(I*4),items[I])
    end for
    return hwnd
end function

--- This is inside the WM_INITDIALOG event

    LPTSTR = allocate_string("Test")

    LV_ITEM = makeLV_ITEM({
                or_all({LVIF_TEXT,LVIF_PARAM}),
                0,
                0,
                0,
                0,
                LPTSTR,
                7,
                0,
                0
                })

    void = c_func(xSendMessage, {GetDlgItem(hWnd, PANEL1), 
LVM_INSERTITEM, 0, LV_ITEM})
    free(LV_ITEM)
    free(LPTSTR)

--- End

Can any win32 guru tell me where the problem is?

TIA,
    Guillermo Bonvehi

new topic     » topic index » view message » categorize

2. Re: Listview - Adding an item

----- Original Message -----
From: "Guillermo Bonvehi" <knixeur at speedy.com.ar>
To: "EUforum" <EUforum at topica.com>
Subject: Listview - Adding an item


>
>
> Hi all,
>     I'm currently trying to add an item to a listview i made using a
> resource dialog, i think i did it the way it should be done, but it's
> not working :(
>     This is what i got:
>
> function makeLV_ITEM(sequence items)
>     atom hwnd
>     hwnd = allocate(36)
>     for I = 0 to length(items)-1 do
>         poke4(hwnd+(I*4),items[I])
>     end for
>     return hwnd
> end function
>
> --- This is inside the WM_INITDIALOG event
>
>     LPTSTR = allocate_string("Test")
>
>     LV_ITEM = makeLV_ITEM({
>                 or_all({LVIF_TEXT,LVIF_PARAM}),
>                 0,
>                 0,
>                 0,
>                 0,
>                 LPTSTR,
>                 7,
>                 0,
>                 0
>                 })
>
>     void = c_func(xSendMessage, {GetDlgItem(hWnd, PANEL1),
> LVM_INSERTITEM, 0, LV_ITEM})
>     free(LV_ITEM)
>     free(LPTSTR)
>
> --- End
>
> Can any win32 guru tell me where the problem is?

I do not think I can help you. I have never worked with true dialogs. Does
GetDlgItem() return the hWnd of the ListView? I also notice that the text
length is givenas 7 but the text is only 4 bytes.

--
Derek

new topic     » goto parent     » topic index » view message » categorize

3. Re: Listview - Adding an item

I don't think I could help either but, if you look at my EFFM project
on the RDS site you may be able to get some clues.

Euman


On 30 Jun 2003 at 2:00, Derek Parnell wrote:

> 
> 
> ----- Original Message -----
> From: "Guillermo Bonvehi" <knixeur at speedy.com.ar>
> To: "EUforum" <EUforum at topica.com>
> Sent: Sunday, June 29, 2003 10:42 PM
> Subject: Listview - Adding an item
> 
> 
> > Hi all,
> >     I'm currently trying to add an item to a listview i made using a
> > resource dialog, i think i did it the way it should be done, but
> > it's not working :(
> >     This is what i got:
> >
> > function makeLV_ITEM(sequence items)
> >     atom hwnd
> >     hwnd = allocate(36)
> >     for I = 0 to length(items)-1 do
> >         poke4(hwnd+(I*4),items[I])
> >     end for
> >     return hwnd
> > end function
> >
> > --- This is inside the WM_INITDIALOG event
> >
> >     LPTSTR = allocate_string("Test")
> >
> >     LV_ITEM = makeLV_ITEM({
> >                 or_all({LVIF_TEXT,LVIF_PARAM}),
> >                 0,
> >                 0,
> >                 0,
> >                 0,
> >                 LPTSTR,
> >                 7,
> >                 0,
> >                 0
> >                 })
> >
> >     void = c_func(xSendMessage, {GetDlgItem(hWnd, PANEL1),
> > LVM_INSERTITEM, 0, LV_ITEM})
> >     free(LV_ITEM)
> >     free(LPTSTR)
> >
> > --- End
> >
> > Can any win32 guru tell me where the problem is?
> 
> I do not think I can help you. I have never worked with true dialogs.
> Does GetDlgItem() return the hWnd of the ListView? I also notice that
> the text length is givenas 7 but the text is only 4 bytes.
> 
> --
> Derek

new topic     » goto parent     » topic index » view message » categorize

4. Re: Listview - Adding an item

Hi again,
    Thanks for answering. Actually, i discovered the item is being=20
added, but not with the text i gave it, it's just adding an empty item.=20
I'll keep trying.

Best Regards,
    Guillermo Bonveh=ED

PS: Derek, 7 remained there because i changed the word i used for=20
testing before sending the example.

euman at bellsouth.net wrote:

>
>
>I don't think I could help either but, if you look at my EFFM project
>on the RDS site you may be able to get some clues.
>
>Euman
>
>On 30 Jun 2003 at 2:00, Derek Parnell wrote:
>
>----- Original Message -----
>From: "Guillermo Bonvehi" <knixeur at speedy.com.ar>
>To: "EUforum" <EUforum at topica.com>
>Sent: Sunday, June 29, 2003 10:42 PM
>Subject: Listview - Adding an item
>=20=20
>
>>>Hi all,
>>>    I'm currently trying to add an item to a listview i made using a
>>>resource dialog, i think i did it the way it should be done, but
>>>it's not working :(
>>>    This is what i got:
>>>
>>>function makeLV_ITEM(sequence items)
>>>    atom hwnd
>>>    hwnd =3D allocate(36)
>>>    for I =3D 0 to length(items)-1 do
>>>        poke4(hwnd+(I*4),items[I])
>>>    end for
>>>    return hwnd
>>>end function
>>>
>>>--- This is inside the WM_INITDIALOG event
>>>
>>>    LPTSTR =3D allocate_string("Test")
>>>
>>>    LV_ITEM =3D makeLV_ITEM({
>>>                or_all({LVIF_TEXT,LVIF_PARAM}),
>>>                0,
>>>                0,
>>>                0,
>>>                0,
>>>                LPTSTR,
>>>                7,
>>>                0,
>>>                0
>>>                })
>>>
>>>    void =3D c_func(xSendMessage, {GetDlgItem(hWnd, PANEL1),
>>>LVM_INSERTITEM, 0, LV_ITEM})
>>>    free(LV_ITEM)
>>>    free(LPTSTR)
>>>
>>>--- End
>>>
>>>Can any win32 guru tell me where the problem is?
>>>=20=20=20=20=20=20
>>>
>>I do not think I can help you. I have never worked with true dialogs.
>>Does GetDlgItem() return the hWnd of the ListView? I also notice that
>>the text length is givenas 7 but the text is only 4 bytes.
>>
>>--
>>Derek
>>=20=20=20=20
>>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu