Mattias Gaertner schrieb:

Current ShowControl:
Set Visible of one control to true and switches active parent Pages.

Wanted:
A method to set Visible of control and all its parents to true,
switches active parent Pages, optionally changes Z-Order, optionally
calls BringToFront on top level form, optionally scrolls parent
controls, optionally moves top level form into monitor bounds,
optionally moves top level form to current monitor.

Dunno how you want to make all this depending on *one* boolean parameter ;-)

ShowControl already is recursive, and a BringToFront parameter is meaningful only to the top-level Parent. This lead me to a new suggestion:

- Add a procedure (or method) that stores additional parameter(s) in a static location, and make it call ShowControl (as is). - Update TWinControl.ShowControl to evaluate and finally reset all the options.

This allows to introduce parameters like:
- MakeVisible (applicable to all controls)
- BringToFront (applicable in top-level controls)
- MakeFullyVisible (move top level form into monitor bounds)
- whatever else you like[1] ;-)

This solution
- doesn't require any changes to the ShowControl overrides,
- doesn't change the behaviour of ShowControl when called from other places, and
- all options are handled in only one place: TWinControl.ShowControl.

[1] You can add ScrollIntoView, if you like, by overriding ShowControl in TScrollingWinControl.

When the options are passed as a set, it's easy to clear all options at once (ShowOptions:=[];), after ShowControl reached the top level form.

When the options are added to the non-virtual TControl.Show (default=[]), no new method has to be introduced at all :-)

DoDi


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to