BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TListView and selected

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Curtis Richards
Guest





PostPosted: Thu Sep 07, 2006 5:08 am    Post subject: TListView and selected Reply with quote



Can someone tell me what I need to do to make the selected
area of a customdraw cell on the listview to act the same way
as the other cells when you select the row.

For example, when you select a row the entire row turns to
blue, and the text appears white. Now on the customdraw
cell it stays white, there is no border or coloring.

I took this from a vcl component set that I am trying to figure
out that part on.

void __fastcall TDownLoaderTest::ListViewAdvancedCustomDrawSubItem(
TCustomListView *Sender, TListItem *Item, int SubItem,
TCustomDrawState State, TCustomDrawStage Stage, bool &DefaultDraw)
{
TclInternetItem *InternetItem = static_cast<TclInternetItem*>(Item->Data);
if ((!InternetItem) || (SubItem != 4)) return;
TRect R;
TclResourceStateList *ResourceState = InternetItem->ResourceState;
ListView_GetSubItemRect(Item->Handle, Item->Index, SubItem, LVIR_BOUNDS,
&R);

TControlCanvas *canvas = new TControlCanvas();
__try
{
canvas->Control = Sender;
clProgressBar->Draw(ResourceState, canvas, R);
}
__finally
{
delete canvas;
}
DefaultDraw = false;
}

Can someone help me out here.

Thanks.
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Sep 07, 2006 5:31 am    Post subject: Re: TListView and selected Reply with quote



"Curtis Richards" <cj_richards (AT) mpquest (DOT) com> wrote in message
news:44ff62e9 (AT) newsgroups (DOT) borland.com...

Quote:
For example, when you select a row the entire row turns to
blue, and the text appears white. Now on the customdraw
cell it stays white, there is no border or coloring.

You are setting the DefaultDraw parameter to false. That means that you are
entirely responsible for drawing everything about the item, including its
background.


Gambit
Back to top
Curtis Richards
Guest





PostPosted: Sun Sep 10, 2006 6:27 pm    Post subject: Re: TListView and selected Reply with quote



So if I set the parameter to DefaultDraw=true; will that handle the
selection of the entire row for me?

I just want the entire row to be highlighted with the default colors
that you seee when you select a row, nothing more.


"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote in message
news:44ff6a77$1 (AT) newsgroups (DOT) borland.com...
Quote:

"Curtis Richards" <cj_richards (AT) mpquest (DOT) com> wrote in message
news:44ff62e9 (AT) newsgroups (DOT) borland.com...

For example, when you select a row the entire row turns to
blue, and the text appears white. Now on the customdraw
cell it stays white, there is no border or coloring.

You are setting the DefaultDraw parameter to false. That means that you
are
entirely responsible for drawing everything about the item, including its
background.


Gambit

Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Sep 12, 2006 2:51 am    Post subject: Re: TListView and selected Reply with quote

"Curtis Richards" <cj_richards (AT) mpquest (DOT) com> wrote in message
news:450412ba (AT) newsgroups (DOT) borland.com...

Quote:
So if I set the parameter to DefaultDraw=true; will that handle
the selection of the entire row for me?

Yes.

Quote:
I just want the entire row to be highlighted with the default colors
that you seee when you select a row, nothing more.

Then you should not be drawing anything at all.


Gambit
Back to top
Curtis Richards
Guest





PostPosted: Tue Sep 12, 2006 9:53 pm    Post subject: Re: TListView and selected Reply with quote

You are confusing me here.

This is the code the author has put in his demo to show
his vcl component. The code is displaying a progress
bar in the column of the listview. What other way is
there to display the progressbar without drawing it in
there?

void __fastcall TDownLoaderTest::ListViewAdvancedCustomDrawSubItem(
TCustomListView *Sender, TListItem *Item, int SubItem,
TCustomDrawState State, TCustomDrawStage Stage, bool &DefaultDraw)
{
TclInternetItem *InternetItem = static_cast<TclInternetItem*>(Item->Data);
if ((!InternetItem) || (SubItem != 4)) return;
TRect R;
TclResourceStateList *ResourceState = InternetItem->ResourceState;
ListView_GetSubItemRect(Item->Handle, Item->Index, SubItem, LVIR_BOUNDS, &R);

TControlCanvas *canvas = new TControlCanvas();
__try
{
canvas->Control = Sender;
clProgressBar->Draw(ResourceState, canvas, R);
}
__finally
{
delete canvas;
}

DefaultDraw = true;
}

Can you please show me what you are talking about?


Thanks.
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Sep 12, 2006 10:59 pm    Post subject: Re: TListView and selected Reply with quote

"Curtis Richards" <cj_richards (AT) mpquest (DOT) com> wrote in message
news:4506e5f9$1 (AT) newsgroups (DOT) borland.com...

Quote:
This is the code the author has put in his demo to show
his vcl component. The code is displaying a progress
bar in the column of the listview. What other way is
there to display the progressbar without drawing it in
there?

You are not taking the Stage parameter into account. You should set
DefaultDraw to true, and then draw your progress bar only when the Stage is
cdPostPaint. For example:

void __fastcall
TDownLoaderTest::ListViewAdvancedCustomDrawSubItem(TCustomListView *Sender,
TListItem *Item, int SubItem, TCustomDrawState State, TCustomDrawStage
Stage, bool &DefaultDraw)
{
DefaultDraw = true;

TclInternetItem *InternetItem =
static_cast<TclInternetItem*>(Item->Data);
if( (InternetItem) && (SubItem == 4) && (Stage == cdPostPaint) )
{
TclResourceStateList *ResourceState =
InternetItem->ResourceState;
TRect R;

ListView_GetSubItemRect(Item->Handle, Item->Index, SubItem,
LVIR_BOUNDS, &R);
clProgressBar->Draw(ResourceState, Sender->Canvas, R);
}
}


Gambit
Back to top
Curtis Richards
Guest





PostPosted: Wed Sep 13, 2006 12:41 am    Post subject: Re: TListView and selected Reply with quote

Hi Gambit,

Just when I thought it was safe to go back in the water :)

First I would like to say thank you for helping me out in
trying to understand this better.

If you don't mind I uploaded an attachment in the attachments
group with two pics.

The first pic has the original code.

TclInternetItem *InternetItem =
static_cast<TclInternetItem*>(Item->Data);
if ((!InternetItem) || (SubItem != 4)) return;
TRect R;
TclResourceStateList *ResourceState = InternetItem->ResourceState;
ListView_GetSubItemRect(Item->Handle, Item->Index, SubItem,
LVIR_BOUNDS, &R);

TControlCanvas *canvas = new TControlCanvas();
__try
{
canvas->Control = Sender;
clProgressBar->Draw(ResourceState, canvas, R);
}
__finally
{
delete canvas;
}

DefaultDraw = true;


The second Pic has this code.

Quote:
void __fastcall
TDownLoaderTest::ListViewAdvancedCustomDrawSubItem(TCustomListView
*Sender,
TListItem *Item, int SubItem, TCustomDrawState State,
TCustomDrawStage
Stage, bool &DefaultDraw)
{
DefaultDraw = true;

TclInternetItem *InternetItem =
static_cast<TclInternetItem*>(Item->Data);
if( (InternetItem) && (SubItem == 4) && (Stage ==
cdPostPaint) )
{
TclResourceStateList *ResourceState =
InternetItem->ResourceState;
TRect R;

ListView_GetSubItemRect(Item->Handle, Item->Index,
SubItem,
LVIR_BOUNDS, &R);
clProgressBar->Draw(ResourceState, Sender->Canvas, R);
}
}

There is no other drawing in the program. Do you have any idea how
come it's still
not highlighting the row? Also, what happened to the font in the
other column?

Thanks again
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.