Wednesday, January 7, 2009

Re: [advanced_delphi] Re: Subcomponent of TWincontrol scroll too...

I see,. Well there must be another type of scroll message. I have seen wm_scroll in source code, you could try catching that one too.

dave

--- On Wed, 1/7/09, neomavez <neomavez@hotmail.com> wrote:
From: neomavez <neomavez@hotmail.com>
Subject: [advanced_delphi] Re: Subcomponent of TWincontrol scroll too...
To: advanced_delphi@yahoogroups.com
Date: Wednesday, January 7, 2009, 6:30 AM

Hi!! David, thanks for the answer.

David Smith escribió:
> Your original code showed TButton.parent := self, not Treeview.

Yes, that "Self" means TreeView (the code is a constructor of
descendant of the TTreeView I want to make).

My code says:

constructor TMyTree.Create( AOwner: TComponent);
begin
inherited;
bt := TButton.Create( Self) ;
bt.Parent := Self ;
btAll.SetSubCompone nt(True) ;

(TMyTRee is a descendent of TTreeView)

> so let me get this straight: you want the button to
> scroll out of sight when you scroll down on the
> treeview, or to stay in view?

I would like to make a component of this type: A TTreeView containing
a little button inside it (within?). To do this today, I have to use
frames: I have a TFrame containing a TTreeView and a Button.

> If you want it to stay in view then it's going to
> be an independent button from the treeview, like
> if it's on a toolbar above the treeview.

Yes, I want to remain visible even when the TTreeView scroll.

The main problem is that I construct my own button and the component
must be part of that component. Therefore, answering your later mail,
I can not Create the button as part of the form.
All works fine, but when MyTRee scroll, the button seems to move,
until I call Repaint. That's why I do the following (something like this)

//////////// /////////

TMyTree = class(TTreeView)
private
bt : TButton ;
protected
.....
procedure TreeWndProc( var Message: TMessage);

//////////// /////////

constructor TMyTree.Create( AOwner: TComponent);
begin
inherited;

OldWndProc := Self.WindowProc;
Self.WindowProc := TreeWndProc ;

btAll := TButton.Create( Self) ;

//////////// /////////

procedure TBuildFCtree. TreeWndProc( var Message: TMessage);
begin

OldWndProc(Message) ;
if Message.Msg = WM_VSCROLL then begin
Self.Invalidate ;
end ;

end;

This code works fine, Each time you click on the scroll bar, the
TreeView repaint itself.
But if I move down with keys up or down (Assuming that the number of
items beyond the bottom of the component) WM_VSCROLL is not received
=> The component not repaint Itself. Should I catch another message?

Thanks very much.
Neo


__._,_.___

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

0 comments: