Recent

Author Topic: Double show of form  (Read 3550 times)

saisim

  • New Member
  • *
  • Posts: 16
Double show of form
« on: May 25, 2017, 02:44:31 pm »
Hi, All!

I recompiled my program from Lazarus 1.0.14 + fpc 2.6.2 to Lazarus 1.6.4 + fpc 3.0.2.

And I got a bug such as:
When I close one of forms of my application the form is shown again, then I close the form again then the forms closes normal.
I show forms in my application as ShowModal.
I didn't change any line of the source, recompile only with same libraries.
How to remove the bug?

OS: Linux x86_64 + QT.

Thank you.

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Double show of form
« Reply #1 on: May 25, 2017, 05:47:42 pm »
You must show us part of your code. I'm using qtlcl for years and never had such problems.

saisim

  • New Member
  • *
  • Posts: 16
Re: Double show of form
« Reply #2 on: May 25, 2017, 06:06:33 pm »
You must show us part of your code. I'm using qtlcl for years and never had such problems.

// FormShow from OwnerForm

procedure TfmClassAGroup1.FormShow(Sender: TObject);
begin
Self.BorderStyle := bsNone; // Edited
Self.BorderIcons := [biSystemMenu];

Image1.Picture.Bitmap := GetItemImage('CAG1I1');
Image2.Picture.Bitmap := GetItemImage('CAG1I2');
Image3.Picture.Bitmap := GetItemImage('CAG1I3');
Image4.Picture.Bitmap := GetItemImage('CAG1I4');
Image5.Picture.Bitmap := GetItemImage('CAG1I5');
Image6.Picture.Bitmap := GetItemImage('CAG1I6');
Image7.Picture.Bitmap := GetItemImage('CAG1I7');
end;

// ShowModal from OwnerForm

procedure TfmClassAGroup1.ProgramItem4Click(Sender: TObject);
begin
Bolts.SetItemCode('CAG1I4');
Bolts.ShowModal;
end;

// FormShow in call Form

procedure TBolts.FormShow(Sender: TObject);
var
OvenNum : integer;
i : integer;
begin
Self.BorderStyle := bsSingle;

for i := 0 to ComponentCount - 1 do if Components is TEdit then TEdit(Components).OnChange := NumEditOnChange;

Image1.Picture.Bitmap := GetItemImage('Bolts_big');
Image2.Picture.Bitmap := GetItemImage('Bolts_small');

DiameterOfPin.SetFocus;
SetBallastWeight('0');

with dmMixCalc.imgList do
  begin
    GetBitmap(0, btPrintForm.Glyph);
    GetBitmap(1, btClose.Glyph);
    GetBitmap(6, btSaveDB.Glyph);
    GetBitmap(7, btCalculate.Glyph);
  end;

lbExpMixPerKgGr.Visible := StrToBool(GetSavedParam('ShowGrPerKg'));
ibxExpPerKg.Visible := StrToBool(GetSavedParam('ShowGrPerKg'));
end;


« Last Edit: May 25, 2017, 07:02:24 pm by saisim »

saisim

  • New Member
  • *
  • Posts: 16
Re: Double show of form
« Reply #3 on: May 25, 2017, 06:47:56 pm »
When I close form TBolts or any other (I have around 100 forms such as in my app) the form closed and shown again.

The problem on all forms like this.

When I compile in Lazarus 1.0.4 + fpc 2.6.2 I don'h have this problem.

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Double show of form
« Reply #4 on: May 25, 2017, 07:00:08 pm »
Try to remove Self.BorderStyle := bsSingle from FormShow(), that (maybe) can cause problem...

saisim

  • New Member
  • *
  • Posts: 16
Re: Double show of form
« Reply #5 on: May 25, 2017, 07:12:08 pm »
Try to remove Self.BorderStyle := bsSingle from FormShow(), that (maybe) can cause problem...

I checked - it's same;

saisim

  • New Member
  • *
  • Posts: 16
Re: Double show of form
« Reply #6 on: May 25, 2017, 07:59:51 pm »
Please see video here: https://youtu.be/8LKr_t8Retk.

balazsszekely

  • Guest
Re: Double show of form
« Reply #7 on: May 25, 2017, 08:46:44 pm »
It's very hard to say something useful without seeing the code. Probably you have one or more event assigned to the button which opens the form. Somehow the event is triggered again when you close the form. As a quick test, disable the button before you open the form, more over you should set the focus to another control. This is just for testing purposes. If the form does not open again you know where problem is.

PS: Another idea, maybe somehow the form open twice. So you have to instances open...

saisim

  • New Member
  • *
  • Posts: 16
Re: Double show of form
« Reply #8 on: May 25, 2017, 10:35:23 pm »
I found the reason: error in event OnMouseDown in component TImage.

Thank you.

 

TinyPortal © 2005-2018