Forms

105 views
Skip to first unread message

Franky

unread,
Jan 7, 2000, 3:00:00 AM1/7/00
to
how can i give every form of my a spot on the taskbar compiled in one
single exe file?

Franky

Peter Below

unread,
Jan 8, 2000, 3:00:00 AM1/8/00
to
In article <856hjn$sa...@bornews.borland.com>, Franky wrote:
> how can i give every form of my a spot on the taskbar compiled in one
> single exe file?
>
Franky,

If you want to have a separate taskbar button for each secondary window
you have two options:

1. override the CreateParams method of each secondary form and add the
WS_EX_APPWINDOW style:

procedure TForm2.CreateParams(Var params: TCreateParams);
begin
inherited CreateParams( params );
params.ExStyle := params.ExStyle or WS_EX_APPWINDOW;
end;

If you click on a secondary forms taskbar button while another app is
active this will still bring all the applications forms to front. If you
do not want that there is option

2. reparent the secondary forms to the desktop

procedure TForm2.CreateParams(Var params: TCreateParams);
begin
inherited CreateParams( params );
params.ExStyle := params.ExStyle or WS_EX_APPWINDOW;
params.WndParent := GetDesktopwindow;
end;

Note that this can cause some problems with modal forms shown from
secondary forms. If the user switches away from the app while a modal
form is up and then back to the form that showed it the modal form may
hide beneath the form. It is possible to deal with this by making sure
the modal form is parented to the form that showed it (using
params.WndParent as above) but this is not possible with the standard
dialogs from the Dialogs unit and exceptions, which need more effort to
get them to work right (basically handling Application.OnActivate,
looking for modal forms parented to Application via GetLastActivepopup
and bringing them to the top of the Z-order via SetWindowPos).

Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Sent using Virtual Access 5.00 - download your freeware copy now
http://www.atlantic-coast.com/downloads/vasetup.exe

Glynn

unread,
Jan 8, 2000, 3:00:00 AM1/8/00
to
You told me about this a few weeks ago, Peter, and warned me about some
problems with windows hiding themselves. It took me awhile to find out what
you meant, but it all came home this morning when I was writing a new
descendant of my base form. For me the solution was to write something like
this -

procedure TForm2.CreateParams(Var params: TCreateParams);
begin
inherited CreateParams( params );

If (NOT (csDesigning in ComponentState)) then begin


params.ExStyle := params.ExStyle or WS_EX_APPWINDOW;
end;

Regards,
Glynn

Peter Below (TeamB) <10011...@compuXXserve.com> wrote in message
news:VA.0000457...@antispam.compuserve.com...

Reply all
Reply to author
Forward
0 new messages