Title: How to add a scroll bar component and have it work at in design mode?
Question: The use of CM_DESIGNHITTEST for design-time events...
Answer:
You need to define your own scroll bar class that intercepts the CM_DESIGNHITTEST message.
TMyScrollBar = class (TScrollBar)
Procedure CMDesignHitTest (var Message : TCMDesignHitTest) ;
Message CM_DESIGNHITTEST ;
end ;
Procedure TMyScrollBar.CMDesignHitTest (var Message : TCMDesignHitTest) ;
begin
Message.Result := 1 ;
end ;
When your component creates one of these scroll bars it needs to use
TMyScrollBar.Create (Nil)
rather than
TMyScrollBar.Create (Self)
otherwise the scroll bar will display sizing handles when it is click. This means you need to be sure to explicitly free the scroll bar in your component's destructor.
by
John M. Miano
miano@worldnet.att.net