Band Resizing and setting .Visible locks up display

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Test Always
Newbie
Newbie
Posts: 16
Joined: Mon Dec 05, 2016 12:00 am

Band Resizing and setting .Visible locks up display

Post by Test Always » Tue Apr 11, 2017 2:56 pm

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
Attachments
UI Lock Up.zip
(2.08 KiB) Downloaded 662 times

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Band Resizing and setting .Visible locks up display

Post by Yeray » Wed Apr 12, 2017 9:15 am

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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Test Always
Newbie
Newbie
Posts: 16
Joined: Mon Dec 05, 2016 12:00 am

Re: Band Resizing and setting .Visible locks up display

Post by Test Always » Wed Apr 12, 2017 11:29 pm

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;

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Band Resizing and setting .Visible locks up display

Post by Yeray » Thu Apr 13, 2017 8:01 am

Hello,

Here is what I'm getting:
2017-04-13_09-58-41.zip
(204.2 KiB) Downloaded 711 times
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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Test Always
Newbie
Newbie
Posts: 16
Joined: Mon Dec 05, 2016 12:00 am

Re: Band Resizing and setting .Visible locks up display

Post by Test Always » Mon Apr 17, 2017 4:15 pm

(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
Attachments
UI Lock Up.zip
(2.3 KiB) Downloaded 676 times

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Band Resizing and setting .Visible locks up display

Post by Yeray » Thu Apr 20, 2017 7:25 am

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;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply