Recent

Author Topic: BTW, there seems to be a bug in the TCoolBar band .  (Read 1051 times)

jamie

  • Hero Member
  • *****
  • Posts: 6090
BTW, there seems to be a bug in the TCoolBar band .
« on: November 22, 2019, 03:58:11 am »
After trying to get clever with a GUI design, I wanted to use  TCoolBar so I could have some bands in there and drop in controls at runtime. Basically a flexible tool bar.. etc


 What I discovered was if you don't have any controls yet on the band and you lift click on it you'll get a crash.

 So to show what I mean.

 Drop a TCoolbar on the form, create one BAND, leave it empty by not assigning any control to it for the events. Run the project and click on the divider of the band that has no control in it.

 You will get a GetPreferrredSize crash..
 
 There is no events that can be queried to avoid this..

 The problem is when I was dynamically changing the controls I would randomly hit the band divider while moving around on the form and crash it..

 I guess this should be corrected.. what do you think ? >:(
The only true wisdom is knowing you know nothing

PaulRowntree

  • Full Member
  • ***
  • Posts: 132
    • Paul Rowntree
Re: BTW, there seems to be a bug in the TCoolBar band .
« Reply #1 on: November 22, 2019, 04:12:49 am »
It seems to work on Laz 1.8.4 Win10
Paul Rowntree
- coding for instrument control, data acquisition & analysis, CNC systems

ASerge

  • Hero Member
  • *****
  • Posts: 2223
Re: BTW, there seems to be a bug in the TCoolBar band .
« Reply #2 on: November 22, 2019, 08:14:13 pm »
I guess this should be corrected.. what do you think ? >:(
I think it should be fixed.
From coolbar.inc:
Code: Pascal  [Select][+][-]
  1. procedure TCustomCoolBar.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  2. var aBand, w, h: Integer;
  3.     newRowBelow, needRecalc, needBandMaximize, aGrabber: Boolean;
  4. begin
  5.   inherited MouseUp(Button, Shift, X, Y);
  6.   if FBandMaximize<>bmNone then begin
  7.     case FBandMaximize of
  8.       bmClick:   needBandMaximize:=true;
  9.       bmDblClick:needBandMaximize:=ssDouble in Shift;
  10.       else       needBandMaximize:=false;
  11.     end;
  12.     if needBandMaximize then begin
  13.       MouseToBandPos(X, Y, aBand, aGrabber);
  14.       if aGrabber then begin
  15.         w:=0;
  16.         h:=0;
  17.         FVisiBands[aBand].control.GetPreferredSize(w,h);
  18. ...
In last line the control is nil.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: BTW, there seems to be a bug in the TCoolBar band .
« Reply #3 on: November 22, 2019, 09:09:49 pm »
In last line the control is nil.
I fixed it in trunk r62283. Please test.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

ASerge

  • Hero Member
  • *****
  • Posts: 2223
Re: BTW, there seems to be a bug in the TCoolBar band .
« Reply #4 on: November 23, 2019, 06:06:30 pm »
I fixed it in trunk r62283. Please test.
I tested already in r62285. All correct.

 

TinyPortal © 2005-2018