Recent

Author Topic: Restore form from resize  (Read 382 times)

eldonfsr

  • Hero Member
  • *****
  • Posts: 526
Restore form from resize
« on: November 02, 2024, 07:27:52 pm »
Hello i have a form after maximized and click on restore button on top screen send this error
some body can tell me lite about this i don't idea because i don't fire any event just maximize and restore the size of form..

jamie

  • Hero Member
  • *****
  • Posts: 6735
Re: Restore form from resize
« Reply #1 on: November 02, 2024, 07:46:45 pm »
are you doing something in the "ReSize" event?
The only true wisdom is knowing you know nothing

eldonfsr

  • Hero Member
  • *****
  • Posts: 526
Re: Restore form from resize
« Reply #2 on: November 02, 2024, 08:50:08 pm »
Yes but trigger when click to restore
here is the cde
Code: Pascal  [Select][+][-]
  1. procedure TFormMain.FormResize(Sender: TObject);
  2. Var NH:Integer;
  3. begin
  4.           NH:=JvSpStation1.Height-Sbar1.Height-PBtnsAPs1.Height-Label1.Height -Panel2.Height;
  5.           if( PanelChart.Visible= false) then begin
  6.               mtERMsP1.Height:=NH-20 ;
  7.           end else begin
  8.              NH:=NH-PanelChart.Height;
  9.              mtERMsP1.Height:=NH ;
  10.           end;
  11.  end;  
  12.  

jamie

  • Hero Member
  • *****
  • Posts: 6735
Re: Restore form from resize
« Reply #3 on: November 02, 2024, 09:29:55 pm »
That event is not a place to be doing such things.

when you change the size of a component it loops because just about everything twitch in a control ends up triggering that.

You have two options.

 Put a block on that function..

Const B:Busy = false

if B then exit else B := True;

 do your code.

B := False;

or/...

Try using the OChangeBounds event instead.



The only true wisdom is knowing you know nothing

eldonfsr

  • Hero Member
  • *****
  • Posts: 526
Re: Restore form from resize
« Reply #4 on: November 03, 2024, 03:36:39 am »
Ok i made changes to OnchangeBounds but still same problem

i create a function where like that and still with same problem

or don't understand  what you sad..

 
Code: Pascal  [Select][+][-]
  1. procedure TFormMain.FormChangeBounds(Sender: TObject);
  2. Var NH:Integer;
  3. begin
  4.   TerminalSize(Sender);
  5. end;
  6. Function TFormMain.TerminalSize(Sender:TObject);
  7. Var NH:Integer;
  8. begin
  9.           NH:=JvSpStation1.Height-Sbar1.Height-PBtnsAPs1.Height-Label1.Height -Panel2.Height;
  10.           if( PanelChart.Visible= false) then begin
  11.               mtERMsP1.Height:=NH-20 ;
  12.           end else begin
  13.              NH:=NH-PanelChart.Height;
  14.              mtERMsP1.Height:=NH ;
  15.           end;
  16.  /code]

jamie

  • Hero Member
  • *****
  • Posts: 6735
Re: Restore form from resize
« Reply #5 on: November 03, 2024, 09:55:26 pm »
Code: Pascal  [Select][+][-]
  1. Procedure OnResize(.....);
  2. Const Busy:Boolean= Flase;
  3. Begin
  4.  if Busy then Exit else Busy := true;
  5.  //Do your resize Code here.
  6.  
  7. Busy := False;
  8. End;
  9.  
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018