I have a series of panels, each with a number of controls, that are on top
of each other. If I set the visible property to false for some controls
that are on a panel that is not visible, the property gets set correctly
(the control's visible property = false), but when the panel that contains
the control is make visible, the control is visible. Setting the visible
property of the control to false at this point does nothing (since it's
already false I guess), the control is still visible. In order to actually
make the control disappear, the visible property has to be set to true, then
to false again.
To capture all possibilities, when a panel is made visble, I have to set all
of its controls to visible=true and then visible=false and then set the
controls I actually want to see to true. This of course looks really bad to
the user, with controls flashing all over the place.
This didn't happen with D7. Has anyone seen this behavior before and is it
a known bug?
Dan
If the panel is invisible when you make the control invisble, then when the
panel is made visible, not only is the control visible, but you can't make
it invisible until you first set the control's visible property to true.
Is that confusing enough? I can upload the code if anyone cares, not sure
about protocol ... I'm only a very occasional programmer (when my boss tells
me I'm a programmer) and full time, behind-schedule engineer. This new
behavior totally blew my mind for a day and a half. If it's not a bug, it
sure is a confusing way to handle such things.
"DJSox" <thesox...@verizon.net> wrote in message
news:465665ab$1...@newsgroups.borland.com...
Try adding this code before the visibility-stuff:
SendMessage(pGrid.Handle, WM_SETREDRAW, 0, 0); // disable redrawing
and these lines after is:
SendMessage(pGrid.Handle, WM_SETREDRAW, 1, 0); // enable redrawing
RedrawWindow(pGrid.Handle, nil, 0, RDW_UPDATENOW or RDW_INVALIDATE or
RDW_ALLCHILDREN); // executing the redraw
Tiedo
Thanks for the code, it certainly helps with the "flashing". Now there is
just a slight delay ... much less annoying.
I've avoided using Windows API calls, mainly because I know nothing about
them and my few books barely mention them. Where is the best information on
such things? The Delphi help doc will explain the syntax if you know what
you're looking for, but where is this type of stuff explained?
Thanks again,
Paul
"Tiedo Kruisselbrink" <tiedo_kru...@aon.nl> wrote in message
news:4656...@newsgroups.borland.com...
FWIW, it seems to work OK in D2006. Just guessing - maybe it's related to
the anti-flicker mods that Steve Trefethen did for D2007?
http://www.stevetrefethen.com/blog/default,date,2007-02-08.aspx
--
Chris Burrows
CFB Software
http://www.cfbsoftware.com/gpcp
You're writing programs for Windows. The Windows API is what you'll have
to use. There's no getting around it. You can avoid it for a little
while, but you need to take the plunge eventually.
> Where is the best information on
> such things? The Delphi help doc will explain the syntax if you know what
> you're looking for, but where is this type of stuff explained?
It's Microsoft's API, so get your information from Microsoft.
http://msdn2.microsoft.com/library/
Tiedo demonstrated two API functions, SendMessage and RedrawWindow, so
begin your reading with the documentation for those two functions. (Read
from MSDN, not from the Delphi help files.) When you read about
SendMessage, you'll see that its behavior is dependent on the message
it's told to send, which in this case is wm_SetRedraw, so read about
that, too. The pages for wm_SetRedraw and RedrawWindow will probably
have links to pages that provide an overview or how the OS paints windows.
Then you'll have to remember that you're using Delphi, and MSDN doesn't
tell you anything about how Delphi does stuff. But you have the VCL
source code, which tells you a _lot_ about how Delphi works. When
debugging your code, don't be afraid to step through the VCL code. It's
going to have lots of calls to API functions, but you already know where
to look to find out how those work.
--
Rob
In fact the UpdateControlState in the VCL differs slightly:
Delphi 2007:
procedure TWinControl.UpdateControlState;
var
Control: TWinControl;
begin
Control := Self;
while Control.Parent <> nil do
begin
Control := Control.Parent;
if not Control.Showing then
begin
FShowing := False;
Exit;
end;
end;
...
end;
In Delphi 2006 the line "FShowing := False;" is missing.
Maybe "Showing:=false" would be correct here (?)
I do not understand completely the roles of FShowing etc. but this may be
the cause. And it shows that the problem only occurs when the control is not
visible.
So, besides the solutions of the prior post you can also do the following,
assuming your Panel is Panel1:
(only when setting visible to true:)
for i:=0 to Panel1.ControlCount-1 do Panel1.Controls[i].visible:=not
Panel1.Controls[i].visible;
Panel1.Visible:=true;
for i:=0 to Panel1.ControlCount-1 do Panel1.Controls[i].visible:=not
Panel1.Controls[i].visible;
Then everything seems ok.
Andreas
"Paul Reeves" <paul....@comcast.net> schrieb im Newsbeitrag
news:4655...@newsgroups.borland.com...
I like the "reverse the visibility twice" concept, much more clever and
efficient than what I was doing.
Paul
"Andreas Lindae" <a...@lindae.de> wrote in message
news:465714c2$1...@newsgroups.borland.com...
Thanks for the tips. I'm much less reluctant to dig into it now that I see
how useful it is.
Paul
"Rob Kennedy" <m...@privacy.net> wrote in message
news:46568f40$1...@newsgroups.borland.com...
---
Thanks for the QC report #46591. From the roadshows I learned that Codegear
now really looks at QC. And Delphi is a great "concept and system" which we
all have to support and we have to help Codegear to make it better!
The only issue with the report is the assignment of the "project". It
should not be "Quality Central". Better is "Delphi". Maybe you can change
that afterwards (I don't know).
Cheers
Andreas
"Paul Reeves" <paul....@comcast.net> schrieb im Newsbeitrag
news:465731d0$1...@newsgroups.borland.com...