Link to home
Start Free TrialLog in
Avatar of iced
iced

asked on

TPanel as WS_POPUP

I have developed a messaging component derived from a TPanel. The Owner
and Parent at Create time is Applciation.MainForm. To pop it up anywhere
on the screen I overwrite the CreateParams method:

inherited CreateParams( Params);
Params.Style := ( Params.Style or WS_POPUP ) and ( not WS_CHILD );

This way I can pop up the window anywhere on the screen and the focus
does not switch from the current active form to the derived TPanel. Just
before display I set the Parent of my TPanel derivative to
Screen.ActiveForm... that way, when it is dismissed the focus remains on
the most recently active form. Just before destruction the Parent is set
back to Application.MainForm, otherwise exceptions come up.

Everything is great as long as the MainForm does not have a sizeable
border. If it does, although the TPanel derivative pops up in the
correct spot, the MainForm automatically creates slide bars to the right
and bottom. It seems that Delphi *thinks* the component is actually
located far to the lower right. This was confirmed when I compiled it as
a component and dropped it on the form. The six little black resizing
spots showed up in one spot, but the actual image showed up in another
spot in the upper left!

If I show and hide the TPanel using the API call ShowWindow, everything
is ok in the sense that the window shows up in the corect spot with no
auto slide bars being created. (Of course all the Delphi components on
my TPanel derviative fail to appear - they never get a paint notice.)
The curious behavior I cannot overcome starts somewhere in the call to
make the TPanel derviative Visible = true.

I have changed the ControlState to remove csAlignmentRequested, (or
whatever that set value is called) adn it did not help matters.
ASKER CERTIFIED SOLUTION
Avatar of mirek071497
mirek071497

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mirek071497
mirek071497

is anybody there
Hi ..

This really resolve you'r problem. Try!
holiday,holiday but now is 18 sept !