Matthias Vandercleyen
asked on
Wincontrol not (correctly) drawn
General Information :
-Delphi XE
-My application consists of a form and a navigationbar. The navigationbar itself is a Wincontrol and contains 2 dropdowns which are both Wincontrols themselves. By clicking on the magnifying glass, a screen pops up. This screen is used to sort the grid which is shown in on the form.
Problem:
As you can see in the screenshots, when I close the popup screen, my navigationbar isn't redrawn correctly. It seems like he doesn't notice that the popup screen is no longer on top of him...
Question:
How can I notify my navigationbar? So it will redraw itself correctly?
popup.png
popupovernavigation.png
popupclosed.png
-Delphi XE
-My application consists of a form and a navigationbar. The navigationbar itself is a Wincontrol and contains 2 dropdowns which are both Wincontrols themselves. By clicking on the magnifying glass, a screen pops up. This screen is used to sort the grid which is shown in on the form.
Problem:
As you can see in the screenshots, when I close the popup screen, my navigationbar isn't redrawn correctly. It seems like he doesn't notice that the popup screen is no longer on top of him...
Question:
How can I notify my navigationbar? So it will redraw itself correctly?
popup.png
popupovernavigation.png
popupclosed.png
Think that problem is how you crate/manage popup form...
the filter is in between your previous and next row buttons
what happens when you switch off the filter ?
what happens when you switch off the filter ?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Geert can make a word or two for a ProcessMessages :-)
... but how you hide itself in OnClose event? maybe that is wrong....
... but how you hide itself in OnClose event? maybe that is wrong....
you bet :)
there is more wrong than seems at that surface
what if your close command hides the filter ?
then it's correctly drawn :)
I'm 100% sure your form gets redrawn when you close the top form.
Otherwise ... you would not be seeing the "Geen filter"
if your bottom form would not be redrawn, then the combo "Geen filter" would only start where the top form was closed
and the contents of the pagecontrol/tabcontrol would not be seen either.
a processmessages is a ridiculous solution
your app handles messages in background anyway.
What the processmessages call does, is just an extra call to something which will happen anyway
it's less intrusive to call the form update procedure
but ... as sinisa indicated ... there is probably something wrong with the showing/hiding/closing of the sub/modal form
there is more wrong than seems at that surface
what if your close command hides the filter ?
then it's correctly drawn :)
I'm 100% sure your form gets redrawn when you close the top form.
Otherwise ... you would not be seeing the "Geen filter"
if your bottom form would not be redrawn, then the combo "Geen filter" would only start where the top form was closed
and the contents of the pagecontrol/tabcontrol would not be seen either.
a processmessages is a ridiculous solution
your app handles messages in background anyway.
What the processmessages call does, is just an extra call to something which will happen anyway
it's less intrusive to call the form update procedure
but ... as sinisa indicated ... there is probably something wrong with the showing/hiding/closing of the sub/modal form
ASKER
In FormClose:
action := caHide
if ( _DoNormalClose ) and ( callerObject is TSMUForm ) then
begin
TSMUForm(callerObject).smu Focus;
TSMUForm(callerObject).doO nShow_OnEn ter(nil);
end
------------
_DoNormalClose = true in this case
doOnShow_OnEnter is used to find which form has the focus and to adjust the functions called by the function keys.
Before showing the form we add some events to it (onshow,onclick,onActivate ,OnKeyDown ,...) and then we use ShowModal to show the form.
action := caHide
if ( _DoNormalClose ) and ( callerObject is TSMUForm ) then
begin
TSMUForm(callerObject).smu
TSMUForm(callerObject).doO
end
------------
_DoNormalClose = true in this case
doOnShow_OnEnter is used to find which form has the focus and to adjust the functions called by the function keys.
Before showing the form we add some events to it (onshow,onclick,onActivate
as i said, there is more wrong under the hood than meets the eye
based on that piece of code you have circular unit reference ...
and ...
focus returns automatically to the previous form when another form is called with showmodal
this is just respecting the z-order of the forms
so, why are you exactly forcing a call to focus, which should be automatic ?
based on that piece of code you have circular unit reference ...
and ...
focus returns automatically to the previous form when another form is called with showmodal
this is just respecting the z-order of the forms
so, why are you exactly forcing a call to focus, which should be automatic ?
ASKER
Forcing the call to focus is done because the smuFocus not only focusses the correct form, but also does some visual changes,... (yellow/orange border,... )
I tried to comment the whole FormClose method, but the problem still exists (when no call to Application.ProcessMessage s is made).
Changing ShowModal to Show does help, but is not what I want to do, because the popup form needs to be modal.
I tried to comment the whole FormClose method, but the problem still exists (when no call to Application.ProcessMessage
Changing ShowModal to Show does help, but is not what I want to do, because the popup form needs to be modal.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The reason for hiding it is/was performance. It will show up much faster when it was hidden.
ah there is the real problem
fix the performance issue and you can throw all your workarounds out of the windows ... :)
fix the performance issue and you can throw all your workarounds out of the windows ... :)
ASKER
So I commented the code in formClose and I did the folowing :
if myParentForm <> posit then posit.showmodal;
posit.Free;
But the problem is still there... Is there another / better way to close the modal form or ... ?
if myParentForm <> posit then posit.showmodal;
posit.Free;
But the problem is still there... Is there another / better way to close the modal form or ... ?
I suggest to create non modal form and set to act like modal one...
if you post some code, i'll post some recommendations
a working sample project with the performance problem would be best
a working sample project with the performance problem would be best
You need to double check that there is no codes/routines affect the appearance, because if it is a redraw issue the other dropdown (greenfilter) should have the same symptoms if it was covered with the popup form. Does it?
Can you show the code you have at the magnifying glass?