Board index » cppbuilder » TListView

TListView


2003-12-04 12:28:38 PM
cppbuilder57
Hi,
From what I know, when TListView was hide will have problem
to access the TListView->Items data. It must be at least 1 pixel width
and visible. Why?
So my question how can I force TListView to create a node/item even
it was hide.
Regards
KL Chin
 
 

Re:TListView

"KL Chin" < XXXX@XXXXX.COM >wrote in message
Quote
From what I know, when TListView was hide will have
problem to access the TListView->Items data. It must be
at least 1 pixel width and visible. Why?
Why do you think that is needed? It is not.
Quote
So my question how can I force TListView to create a
node/item even it was hide.
I just did a test and had no troubles adding new items to a hidden ListView
that was 0 pixels high. It worked fine.
Gambit
 

Re:TListView

Hi Remy,
Thx for ur reply.
I will re-check again.
Regards
KL Chin
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"KL Chin" < XXXX@XXXXX.COM >wrote in message
news:3fceb83f$ XXXX@XXXXX.COM ...

>From what I know, when TListView was hide will have
>problem to access the TListView->Items data. It must be
>at least 1 pixel width and visible. Why?

Why do you think that is needed? It is not.

>So my question how can I force TListView to create a
>node/item even it was hide.

I just did a test and had no troubles adding new items to a hidden
ListView
that was 0 pixels high. It worked fine.


Gambit



 

{smallsort}

Re:TListView

Hi
I miss an event in TListView
TList.OnItemCheckboxClick or something like that ;)
 

Re:TListView

Ah yes found other newsgroup message.
This even should do the trick :P*:D
procedure TFormMain.ListViewReceiverMulticastMembershipChanging(
Sender: TObject; Item: TListItem; Change: TItemChange;
var AllowChange: Boolean);
:)
 

Re:TListView

Actually this OnChange is better than OnChanging for what I want to do...
Otherwise it is vice versa :d
procedure TFormMain.ListViewReceiverMulticastMembershipChange(
Sender: TObject; Item: TListItem; Change: TItemChange);
begin
if (Change = ctState) then
begin
if Item.Checked then
begin
ShowMessage('checked');
end else
begin
ShowMessage('unchecked');
end;
end;
end;
 

Re:TListView

Hmmm seems like both events are needed to determine which property changed
:D
Since these events are used for different properies doh.
 

Re:TListView

Hmmm it's not as easy as it seems.
Many of these events occur.. which requires the checkbox checked state to be
stored for each list item !
 

Re:TListView

Ok,
I found the solution.
On adding and removing items prevent the OnChange and OnChanging events from
happening
( These will otherwise occur a lot and for different items. For example when
removing an item
some of these event will happen becomes a select property changed... and
then the checked
property of another item is assign to the boolean which you dont want :D )
procedure ButtonAddOrRemoveClick Etc
var
TempOnChange : TLVChangeEvent;
TempOnChanging : TLVChangingEvent;
begin
// prevent OnChange and OnChanging events from happening
TempOnChange := ListView.OnChange;
TempOnChanging := ListView.OnChanging;
ListView.OnChange := nil;
ListView.OnChanging := nil;
// code to add or remove here
// re-enable On Change Event
ListView.OnChange := TempOnChange;
ListView.OnChanging := TempOnChanging;
end;
FormVariable:
var
mReceiverMulticastMembershipItemChecked
Then in OnChange:
procedure TFormMain.ListViewReceiverMulticastMembershipChange(
Sender: TObject; Item: TListItem; Change: TItemChange);
begin
if (Change = ctState) then
begin
// als deze twee verschillen dan is het verandert.
if (mReceiverMulticastMembershipItemChecked <>Item.Checked) then
begin
if Item.Checked then
begin
ShowMessage('checked');
end else
begin
ShowMessage('unchecked');
end;
mReceiverMulticastMembershipItemChecked := Item.Checked;
end;
end;
end;
And in onChanging:
procedure TFormMain.ListViewReceiverMulticastMembershipChanging(
Sender: TObject; Item: TListItem; Change: TItemChange;
var AllowChange: Boolean);
begin
if (Change = ctState) then
begin
mReceiverMulticastMembershipItemChecked := Item.Checked;
end;
end;
Hehe :) works perfectly (for so far tested :) :P ) {*word*30}ing yeah ! :D
 

Re:TListView

Can someone give me an example on how to set the fontstyle
on a listview row if its checked using the checkbox?
Right now i am testing something small to make it work. I have
five items in my listview with checkboxes enabled. When i check
an item, i would like it to change the font style.
Curtis
 

Re:TListView

"Curtis Richards" < XXXX@XXXXX.COM >wrote in message
Quote
Can someone give me an example on how to set the
fontstyle on a listview row if its checked using the checkbox?
TListView has no concept of per-item font settings. You have to manage that
manually by owner-drawing the items yourself.
Gambit
 

Re:TListView

I am looking for a TListView type component that is fast and has auto-sorting when clicking on a column, preferably free. I am using D2005 and it needs to be available in the .net component pallete. I've tried TCoolListView, TdfsExtListView and TExtListViewCtrl but none of them seem to be compatible with D2005 .net or I am doing something wrong on package creation. Can anyon suggest where to get one from, preferably one that's tried and tested with .net Apps created in D2005.
Many thanks
 

Re:TListView

I have a TListView with ViewStype = vsReport, and the first time I add an
item the values do not appear. All additional items appear fine.
TListItem *tli = ListViewLaps->Items->Add();
static int Lap = 1;
if (tli)
{
tli->Caption = Lap++;
tli->SubItems->Add(LapTime);
tli->SubItems->Add(Pace);
tli->SubItems->Add(Position);
}
I have this code attached to a button. The first time I click the button
nothing appears. The second time it works and the Lap value displayed = 2.
Thanks for any tips!
Doug
 

Re:TListView

"Douglas Hay" < XXXX@XXXXX.COM >wrote in message
Quote
if (tli)
You can get rid of that. Add() will never return a NULL pointer. If
Add() fails, it will throw an exception.
Quote
I have this code attached to a button. The first time I click
the button nothing appears.
Works fine for me. I do see the first item as expected.
Gambit
 

Re:TListView

Hi,
I need some tutorials or examples for this component
Can anybody help me?
Enrico