Has anyone experienced these problems??
Regards,
Manolis Perrakis
Hi,
I've experienced problem 2) (Delphi 7, Windows XP pro);
A little workaround may be to activate the form wich should be "deactivated"
by the modal window just before the call that makes appear this modal
window.
This wrong behaviour appears when there is a delay between the call to the
function that invokes the modal window and its effective execution ( in my
app I was getting some data from the web to be displayed in a modal window).
I've not investigated this problem but it could be related to threads
synchronization in the update of GUI ... I don't know.
Best regards,
Federico Blaseotto
Russ
"Manolis" <manolo_...@yahoo.gr> wrote in message
news:43945780$1...@newsgroups.borland.com...
> I have a large project built in Delphi 7 with 16 packages and hundreds
> of forms. My application consists of a main window and all the other
> forms have the form style property set to StayOnTop.
Why are you doing that? StayonTop forms should be used very sparingly. If
you want to keep your secondary forms on top of the main form even if focus
is set to the main form do it this way:
Override the CreateParams method of the secondary forms like this:
procedure TForm2.CreateParams(Var params: TCreateParams);
begin
inherited CreateParams( params );
params.WndParent := Application.Mainform.handle;
end;
This is not completely failsafe, you have to avoid changes to the main forms
styles (border, bordericon, formstyle) that would force the VCL to recreate
the window handle. If this ever happens the Z-order link between the forms would
be lost. You could guard against this by overriding the main forms CreateWnd
method. Call the inherited method first and then iterate over the list of open
forms in Screen.Forms (skipping the main form, of course) and call their
RecreateWnd method to force them to recreate their own window handle as well.
That calls CreateParams again and reestablishes the link.
This will take care of your problems 1 and 2. 3 is an XP-specific problem
caused by a system feature (some would call it a bug, but it is by design <g>)
called window ghosting. It strikes when your main thread does not process
messages for a few seconds. The OS then thinks your app is hung, hides its
windows (all of them) and creates a fake of the main window so the user has
something to play with (he can move it around and minimize it, for example,
to get it out of the way).
The proper way to deal with this is not to block your main thread for more
than a few hundred milliseconds. But that can require a significant redesign,
since you need to move time-intensive operations into secondary threads.
The usual (lazy) way is to use DisableProcessWindowsGhosting, search the
newsgroup archives for it to find examples of use and some background
info on the problems.
Your problem 4 is something i have not seen mentioned before on these groups.
It may be connected to 3.
--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
I tried to use the recreateWnd but I'm not sure how to use it.
How do I the RecreateWnd method for each form?
The Code I wrote was:
procedure TFrmMainForm.CreateWnd;
Var
I:Integer;
begin
inherited CreateWnd();
for I := 0 to Screen.FormCount do // Iterate
begin
if Screen.Forms[i].Name<>'FrmMainForm' then
begin
//(Application.FindComponent(Screen.Forms[i].Name ) as TForm).
??????????????????????
ReCreateWnd;
end;
end; // for
end;
Can you please tell me how to proper write this code??
Regards,
Manolis
Regards,
Manolis
The show desktop function seems to actually minimize your application
in your case, but it does not get properly restored. You can fix that
by adding a handler to the Application.OnActivate event (i used a
TApplicationEvents object in the main form for the test).
procedure TForm1.ApplicationEvents1Activate(Sender: TObject);
begin
if IsIconic(Application.handle) then
Application.restore;
end;
Regards,
Manolis
"Peter Below (TeamB)" <10011...@compuXXserve.com> wrote:
>In article <4395426f$1...@newsgroups.borland.com>, Manolis wrote:
>>
>> The behavior of the main form which is hided if I use
>> the desktop icon can be restored if I right click on
>> the task bar on the application tab and choose restore.
>> How can I avoid this??
>
>The show desktop function seems to actually minimize your application
>in your case, but it does not get properly restored. You can fix that
>by adding a handler to the Application.OnActivate event (i used a r
When the application is minimized the main form gets hidden. That should
also hide all windows it owns on the API level. If that does not happen
XP is worse than i though at handling Z-order relationships between windows.
Application has OnMinimize and OnRestore events you could use to manually
hide and show your secondary forms, but that should ne necessary. I've no
idea why you have problems here, sorry. And i'm running out of time today...