1. setLVItemText ()

Hello Everyone,

setLVItemText (integer LV, integer position, integer subitem, object text)

  When I use this procedure nothing seems to print in my list view.

A couple of questions about this.

Position, is that the col or row position or both?

Subitem what would be an example of that?

Also what would be the best procedure or function to write to a Listview?
Besides addLVItem which is the only one
I can get to work. I would like something with more control in placing data in a
specific row and col of a list view. I have tried all the demos and tried all the
Euforum links but can’t find what I’m looking for.

Many thanks in advance,

Don Cole

new topic     » topic index » view message » categorize

2. Re: setLVItemText ()

don cole wrote:
> 
> 
> Hello Everyone,
> 
> setLVItemText (integer LV, integer position, integer subitem, object text)
> 
>   When I use this procedure nothing seems to print in my list view.
> 
> A couple of questions about this.
> 
> Position, is that the col or row position or both?

The ROW number.
 
> Subitem what would be an example of that?

The COLUMN number.

 
--  ListViewEdit.exw
-- Example provided by Tony Stewart

include Win32lib.ew
without warning


--------------------------------------------------------------------------------
--  Window TestWin
integer TestWin
integer MyLV
integer MiscText
integer ChangeButton
integer DeleteButton
--------------------------------------------------------------------------------

constant cName = 1,
         cEmail = 2,
         cTelephone = 3

sequence MyLVSelected, MyLVID, MyData

--------------------------------------------------------------------------------
procedure MyLV_onClick (integer self, integer event, sequence parms)
    MyLVSelected = getLVSelected(MyLV)
    if length(MyLVSelected) > 0 then
        setText(MiscText, getLVItemText(MyLV, MyLVSelected[1],cEmail))
    else
        setText(MiscText, "")
    end if
end procedure
--------------------------------------------------------------------------------

procedure ChangeButton_onClick (integer self, integer event, sequence parms)
    sequence newText
    VOID = getLVAllChecked(MyLV)
    newText = getText(MiscText)
    for i = 1 to length(MyLVSelected) do
        setLVItemText(MyLV, MyLVSelected[i], cEmail, newText)
    end for


    VOID = getColumnHeadings(MyLV)

end procedure

procedure DeleteButton_onClick (integer self, integer event, sequence parms)
    sequence lSelected
    lSelected = getLVAllChecked(MyLV)
    for i = 1 to length(lSelected) do
        setLVItemText(MyLV, lSelected[i], cEmail, "")
    end for
end procedure

procedure AppInit()
    atom flags

    TestWin = createEx( Window, "Test LV", 0, Default, Default, 400, 300, 0, 0 )
MyLV = createEx( ListView,
    {{"Name",110,0},{"Email",140,0},{"Phone",96,'>'}}, TestWin, 24, 20, 352,
    116,or_all({LVS_REPORT,LVS_SHOWSELALWAYS}),0)
    MiscText = createEx( EditText, "", TestWin, 52, 156, 148, 20, 0, 0 )
ChangeButton = createEx( PushButton, "Change Email", TestWin, 204, 156, 188,
    20, 0, 0 )
DeleteButton = createEx( PushButton, "Clear Checked Emails", TestWin, 204,
    186, 188, 20, 0, 0 )---------------------------------------------------------

flags =
    or_all({LVS_EX_GRIDLINES,LVS_EX_FULLROWSELECT,LVS_EX_CHECKBOXES,LVS_EX_HEADERDRAGDROP
    })
    VOID = sendMessage(MyLV, LVM_SETEXTENDEDLISTVIEWSTYLE, flags, flags)
    MyLVSelected = {}
    MyLVID = {}
    MyData = {
                {"Nigel Hawthorne","here at there.com","43234344"},
                {"John Brown","this@there","332987"},
                {"Samantha West","beauty at girls.com","99343666"}
             }

    -- Add them in this order.
    VOID = setLVInsert(1)
    for i = 1 to length(MyData) do
        MyLVID &= addLVItem(MyLV, 0, MyData[i])
    end for
    setHandler(MyLV, w32HClick,routine_id("MyLV_onClick"))
    setHandler(ChangeButton, w32HClick,routine_id("ChangeButton_onClick"))
    setHandler(DeleteButton, w32HClick, routine_id("DeleteButton_onClick"))

end procedure

AppInit()
WinMain( TestWin,Normal )



-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

3. Re: setLVItemText ()

Hello Derek,

And thank you very much.

This exactly the demo I have been messing with.

I notice line 82 approx. has:

MyLVID &= addLVItem(MyLV, 0, MyData[i])

As  I said I would like to eliminate the addLVItem function.

If I rem this line out then nothing is printed in the listView.

Must the addLVItem() be used to display anything in the listVeiw?

Thank you again,

Don Cole

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

4. Re: setLVItemText ()

don cole wrote:
> 
> Hello Derek,
> 
> And thank you very much.
> 
> This exactly the demo I have been messing with.
> 
> I notice line 82 approx. has:
> 
> MyLVID &= addLVItem(MyLV, 0, MyData[i])
> 
> As  I said I would like to eliminate the addLVItem function.
> 
> If I rem this line out then nothing is printed in the listView.
> 
> Must the addLVItem() be used to display anything in the listVeiw?

Yes.

addLVItem adds a new item (row) to the list view.

setLVItem updates an existing item in the list view.

Why do you want to avoid using addLVItem?

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

5. Re: setLVItemText ()

Derek Parnell wrote:
> 
> don cole wrote:
> > 
> > Hello Derek,
> > 
> > And thank you very much.
> > 
> > This exactly the demo I have been messing with.
> > 
> > I notice line 82 approx. has:
> > 
> > MyLVID &= addLVItem(MyLV, 0, MyData[i])
> > 
> > As  I said I would like to eliminate the addLVItem function.
> > 
> > If I rem this line out then nothing is printed in the listView.
> > 
> > Must the addLVItem() be used to display anything in the listVeiw?
> 
> Yes.
> 
> addLVItem adds a new item (row) to the list view.
> 
> setLVItem updates an existing item in the list view.
> 
> Why do you want to avoid using addLVItem?
> 
 Hello again Derek,

So addLVItem is like a refresh?

Because I want to put some items in a LV from row 8 to row 14.

Look at them.

Then later I want to add stuff to row 1 through 6.

How would I do that?

Don Cole

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

6. Re: setLVItemText ()

don cole wrote:
 
> So addLVItem is like a refresh?

No. 

A ListView is NOT like a spreadsheet. It doesn't really have rows and columns;
it has items, which are like records. That is, an item has one key field and zero
or more other fields. And one (of many) ways of looking at the items in a
ListView is the REPORT layout. This displays the items in row-column format.
 
> Because I want to put some items in a LV from row 8 to row 14.
> 
> Look at them.

And during this period, would there be anything in rows 1 - 7? If not, you would
have to add seven dummy blank items to fill the rows.

> Then later I want to add stuff to row 1 through 6.
>
> How would I do that?

Use setLVItem to update the dummy blank rows.

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

7. Re: setLVItemText ()

Thanks again Derek,

This will give me something to work on awhile.

Since we are using addLVItem, I don't see anypoint of using setLVItem at all.

Don Cole

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

Search



Quick Links

User menu

Not signed in.

Misc Menu