Page 1 of 1
Band Resizing and setting .Visible locks up display
Posted: Tue Apr 11, 2017 2:56 pm
by 16579693
In the attached demo when it initially runs resizing the TColorBandTool works fine--the editor gets the end value of the color band.
If the checkbox "Toggle Visibility" is checked and the band is resized, the editor flashes but is never displays the end value until the mouse lets go of resizing the band.
What causes this? How can this be fixed?
Thank you,
Ed Dressel
Re: Band Resizing and setting .Visible locks up display
Posted: Wed Apr 12, 2017 9:15 am
by yeray
Hello,
I'm not sure to understand what's the purpose of the test.
You are calling UpdateLayoutControl everytime the ColorBandTool is resized:
Code: Select all
procedure TForm1.ColorBandResizing(Sender: TObject);
begin
UpdateLayoutControl;
end;
And you are changing the curEndValue visibility every time UpdateLayoutControl is called, if chkToggleVisiblity2 checkbox is checked:
Code: Select all
procedure TForm1.UpdateLayoutControl;
begin
curEndValue.Text := FloatToStr(ColorBand.EndValue);
if chkToggleVisiblity2.Checked then
begin
curEndValue.Visible := not curEndValue.Visible;
// curEndValue.Visible := not curEndValue.Visible;
end;
end;
This makes the curEndValue visibility to change every time the ColorBandTool is resized, and this produces that strange flickering.
Re: Band Resizing and setting .Visible locks up display
Posted: Wed Apr 12, 2017 11:29 pm
by 16579693
It is a very simplified version of a product I have. What has been frustrating is that the band resizing does not occur (it appears locked) when the editor's visibility is updated every time.
I changed the code a little so that it toggles the .Visible property every other time, and it is much better, no matter ow quick I move the mouse. But I still don't understand why the band does not update.
Ed Dressel
Code: Select all
if chkToggleVisiblity2.Checked then
begin
curEndValue.Tag := curEndValue.Tag + 1;
if curEndValue.Tag > 1 then
begin
curEndValue.Visible := not curEndValue.Visible;
curEndValue.Tag := 0;
end;
end;
Re: Band Resizing and setting .Visible locks up display
Posted: Thu Apr 13, 2017 8:01 am
by yeray
Hello,
Here is what I'm getting:
Are you getting the same behaviour?
I see the the value in the TEdit is updated when I resize the ColorBand from the right side, both having the checkbox active or inactive.
I'm not sure to understand what do you find to be blocked.
Re: Band Resizing and setting .Visible locks up display
Posted: Mon Apr 17, 2017 4:15 pm
by 16579693
(Argh... I've replied 2x to this and it isn't saving. Looks liek the attachment was 3k too big).
I reworked the demo so that there are three options for updating the editor:
1) "None" (works fine),
2) "Every Other Time" (works fine), and
3) "Every Time" (does not work fine).
Here is a video of what I am seeing:
http://www.tbinc.com/misc/ToggleVisibleAffect.mp4
Ed Dressel
Re: Band Resizing and setting .Visible locks up display
Posted: Thu Apr 20, 2017 7:25 am
by yeray
Hello,
Changing the TEdit visibility seems to be preventing the TChart (and the TColorBandTool) to be repainted when the TColorBandTool is resized.
Forcing a chart repaint solves it:
Code: Select all
procedure TForm1.UpdateLayoutControl;
var
lToggleFrequency: Integer;
begin
curEndValue.Text := FloatToStr(ColorBand.EndValue);
if comToggleFrequency.ItemIndex <> 0 then
begin
curEndValue.Tag := curEndValue.Tag + 1;
lToggleFrequency := comToggleFrequency.ItemIndex - 1;
if curEndValue.Tag > lToggleFrequency then
begin
curEndValue.Visible := not curEndValue.Visible;
curEndValue.Tag := 0;
Chart1.Draw; //Force a chart repaint
end;
// curEndValue.Visible := not curEndValue.Visible;
end;
end;