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 

TCustomListBox / TScrollingWinControl / ...?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing
View previous topic :: View next topic  
Author Message
Jens Gruschel
Guest





PostPosted: Tue Oct 14, 2003 9:48 pm    Post subject: TCustomListBox / TScrollingWinControl / ...? Reply with quote



I want to create a control and don't know from which control to derive.
TCustomListBox or TScrollingWinControl might be possible, but both have some
disadvantages. Maybe there is another alternative?

My control should display some items with different height, that the control
draws itself (any one of these items can be selected), and a vertical
scrollbar (no horizontal scrollbar).

I could derive from TCustomListBox, set Style to lbOwnerDrawVariable, and
override MeasureItem and DrawItem. But I need no Items property, which is
published in TCustomListBox, and which is important for TCustomListBox (even
if I ignore the texts while drawing, Items.Count is needed). And you cannot
scroll pixel-accurate, which might be a problem for very large items.

TScrollingWinControl sounds like more work, but might be more flexible.
Unfortunatelly HorzScrollBar is a published property (while I could set
HorzScrollBar.Visible to false in the constructor it could still be changed
in the designer).

Maybe I could also derive from TCustomControl and add a vertical scrollbar
somehow (whereas I don't like TScrollBar very much, because it doesn't look
very Windows(XP)-like and must be measured with GetSystemMetrics to have the
same size than other scrollbars).

Any other ideas?

Jens



Back to top
Kurt Barthelmess
Guest





PostPosted: Wed Oct 15, 2003 12:28 pm    Post subject: Re: TCustomListBox / TScrollingWinControl / ...? Reply with quote



"Jens Gruschel" <nospam (AT) pegtop (DOT) net> wrote:

Quote:
I want to create a control and don't know from which control to derive.
TCustomListBox or TScrollingWinControl might be possible, but both have some
disadvantages. Maybe there is another alternative?

[clip]

I had something like this and ended up using a TPanel descendant.
Another possibility would be a TScrollBox with an embedded TPaintBox.

Good luck.

Kurt


Back to top
Jens Gruschel
Guest





PostPosted: Wed Oct 15, 2003 9:34 pm    Post subject: Re: TCustomListBox / TScrollingWinControl / ...? Reply with quote



Quote:
I had something like this and ended up using a TPanel descendant.
Another possibility would be a TScrollBox with an embedded TPaintBox.

Good luck.

Thanks. I think I've found what I was searching for. I'm using a simple
TCustomControl, adding some code for a vertical scrollbar (WS_VSCROLL in
CreateParams, catching WM_VSCROLL, using some GetScrollInfo / SetScrollInfo
api calls etc).

Jens




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing 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.