Board index » delphi » editing subitems in a ListView

editing subitems in a ListView

Hi,

I have derived a custom component from TListView, In this ListView I'm
showing data from a database table. I want to edit the text (items) , so I
can write them back to the database.
Does anybody know a way to edit the sub-items ???? In the ListView there is
only the possibility to edit the items, and not the sub-items.

Thanks in advance for your help,
Edwin.

 

Re:editing subitems in a ListView


Edwin,

it's possible to edit the sub-items if you'd let your program remember which
item refers to which record. You could do it
1) By placing each item in a non-sorted Listview and line 0 refers to record 1
or..
2) By double-clicking (or enter) search the item of the ListView in the
database..

There are more ways, and these two also have their limits.
1) No sorting
2) The item has to be a unique item

But try it... for more help.. mail me

Leon "The Sorceror" Friesema

Quote
Edwin Hietbrink wrote:
> Hi,

> I have derived a custom component from TListView, In this ListView I'm
> showing data from a database table. I want to edit the text (items) , so I
> can write them back to the database.
> Does anybody know a way to edit the sub-items ???? In the ListView there is
> only the possibility to edit the items, and not the sub-items.

> Thanks in advance for your help,
> Edwin.

Re:editing subitems in a ListView


What I do is create a Custom Dialog box

with mydlg.create(application) do
try
    edit1.text := listview1.items[index].subitems[0];
    if showmodal=mrOK then
    begin
        Table1.Dataset.Fields[1].AsString := edit1.text;  // this is from
memory, check it first
        Listviiew1.items[index].subitems[0] := edit1.text;
    end;
finally
    free;
end;

but if you're using vsReport, then you could
use a TStringGrid instead of a listview

Quote
Friesema <frie...@cistron.nl> wrote in message

news:380394A5.318B585E@cistron.nl...
Quote
> Edwin,

> it's possible to edit the sub-items if you'd let your program remember
which
> item refers to which record. You could do it
> 1) By placing each item in a non-sorted Listview and line 0 refers to
record 1
> or..
> 2) By double-clicking (or enter) search the item of the ListView in the
> database..

> There are more ways, and these two also have their limits.
> 1) No sorting
> 2) The item has to be a unique item

> But try it... for more help.. mail me

> Leon "The Sorceror" Friesema

> Edwin Hietbrink wrote:

> > Hi,

> > I have derived a custom component from TListView, In this ListView I'm
> > showing data from a database table. I want to edit the text (items) , so
I
> > can write them back to the database.
> > Does anybody know a way to edit the sub-items ???? In the ListView there
is
> > only the possibility to edit the items, and not the sub-items.

> > Thanks in advance for your help,
> > Edwin.

Other Threads