Recent

Author Topic: Controls inside the form disappear in execution.  (Read 8423 times)

tetrastes

  • Sr. Member
  • ****
  • Posts: 481
Re: Controls inside the form disappear in execution.
« Reply #15 on: January 25, 2023, 08:18:57 pm »
The issue is reproduced at my Win10 Laz 2.2.4 fpc 3.2.2.
I have discovered that it is linked with DoubleBuffered somehow, maybe because TListView and TProgressBar have not DoubleBuffered property.
I have set GroupBox1 DoubleBuffered property to False, and the issue goes away.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2065
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Controls inside the form disappear in execution.
« Reply #16 on: January 25, 2023, 08:23:25 pm »
The issue is reproduced at my Win10 Laz 2.2.4 fpc 3.2.2.
I have discovered that it is linked with DoubleBuffered somehow, maybe because TListView and TProgressBar have not DoubleBuffered property.
I have set GroupBox1 DoubleBuffered property to False, and the issue goes away.
That I also tried, keep doing activate/deactivate the window and you see the error again. At least there is another person that can confirm that strange behaviour.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

tetrastes

  • Sr. Member
  • ****
  • Posts: 481
Re: Controls inside the form disappear in execution.
« Reply #17 on: January 25, 2023, 08:51:12 pm »
I believe it willingly, but I don't have enough patience...

Ecsa

  • New Member
  • *
  • Posts: 13
Re: Controls inside the form disappear in execution.
« Reply #18 on: January 25, 2023, 09:00:19 pm »
Buena suerte y de nada // Good luck and you're welcome
I just applied it to another form from another project and the same problem doesn't work, I'm going to remove the groupbox so I don't see that bug, anyway, thank you very much for your support.  :'(

Ecsa

  • New Member
  • *
  • Posts: 13
Re: Controls inside the form disappear in execution.
« Reply #19 on: January 25, 2023, 09:05:41 pm »
The issue is reproduced at my Win10 Laz 2.2.4 fpc 3.2.2.
I have discovered that it is linked with DoubleBuffered somehow, maybe because TListView and TProgressBar have not DoubleBuffered property.
I have set GroupBox1 DoubleBuffered property to False, and the issue goes away.

I just set DoubleBuffered to false and I get the same problem, the controls disappear that if I have to do the process of clicking on the form multiple times, then click outside the form (Windows taskbar.)

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2065
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Controls inside the form disappear in execution.
« Reply #20 on: January 25, 2023, 09:34:50 pm »
Buena suerte y de nada // Good luck and you're welcome
I just applied it to another form from another project and the same problem doesn't work, I'm going to remove the groupbox so I don't see that bug, anyway, thank you very much for your support.  :'(
I am sorry that my fix did not worked on your other projects  :'( I tried best to help  :-[
« Last Edit: January 25, 2023, 10:42:30 pm by KodeZwerg »
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Controls inside the form disappear in execution.
« Reply #21 on: January 25, 2023, 09:37:00 pm »
It is likely that, that the control that you assume to contain other controls did not have focus at the time you added the other controls.

Example: when you want to put controls on a panel, make sure the panel has focus (the squares around the corners and the middles) before you add the controls visually. Otherwise the owner becomes the form itself, and not the panel and that may hide the controls. (same goes for Delphi, but Delphi behaves a bit better than Lazarus that can mix-up order quite easily: meaning last added control does not have the same z-order as you would expect (LIFO), so in Delphi it mostly "looks" OK, but it isn't either: same programmer mistake).
This is a "pitfall" for screendrawers sorry, beginners, but not usually for programmers.
You can test that while debugging by testing the parent control. If that is the form and not the panel... then you have the issue as I described above.
« Last Edit: January 25, 2023, 09:52:56 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

tetrastes

  • Sr. Member
  • ****
  • Posts: 481
Re: Controls inside the form disappear in execution.
« Reply #22 on: January 25, 2023, 10:11:30 pm »
You can test that while debugging by testing the parent control. If that is the form and not the panel... then you have the issue as I described above.
This is not the case. The parent of all controls is GroupBox1, what you can easily see in Object Inspector.
By the way, I don't have this issue with TPanel, only with TGroupBox.

Ecsa

  • New Member
  • *
  • Posts: 13
Re: Controls inside the form disappear in execution.
« Reply #23 on: January 25, 2023, 10:20:40 pm »
It is likely that, that the control that you assume to contain other controls did not have focus at the time you added the other controls.

Example: when you want to put controls on a panel, make sure the panel has focus (the squares around the corners and the middles) before you add the controls visually. Otherwise the owner becomes the form itself, and not the panel and that may hide the controls. (same goes for Delphi, but Delphi behaves a bit better than Lazarus that can mix-up order quite easily: meaning last added control does not have the same z-order as you would expect (LIFO), so in Delphi it mostly "looks" OK, but it isn't either: same programmer mistake).
This is a "pitfall" for screendrawers sorry, beginners, but not usually for programmers.
You can test that while debugging by testing the parent control. If that is the form and not the panel... then you have the issue as I described above.

Understanding that when adding a control I must have the main control selected, as in this case it is a groupbox, for which I create another project and make sure that the groupbox is in focus to add the new control and the same thing happens when clicking inside the groupbox control and then outside the form window hides all the controls.

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: Controls inside the form disappear in execution.
« Reply #24 on: January 25, 2023, 10:51:02 pm »
Application.ProcessMessages in the OnDeactivate event?
The only true wisdom is knowing you know nothing

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2065
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Controls inside the form disappear in execution.
« Reply #25 on: January 25, 2023, 11:47:16 pm »
Application.ProcessMessages in the OnDeactivate event?
Sadly not.
First Image = How it really should look
Second = after a few times de-/activate the window
Third = shows the code

For me just my disabled "fix" (also visible on third image) is working and currently I do not understand why that is not working for Ecsa.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

440bx

  • Hero Member
  • *****
  • Posts: 4029
Re: Controls inside the form disappear in execution.
« Reply #26 on: January 26, 2023, 03:06:18 am »
I've run and tested, strange thing is, when I build on my own, all works like it should,
Same here.


importing and running your demo shows me same behaviour.
I don't understand this part.  Importing what and running what ?... his zip file does not contain an executable (at least not the one I downloaded.)  How did you run "his demo" (presuming you mean "his executable" an executable _he_, not you, created ?.)  What am I missing ?

One test I'd like to see done is, for the OP to provide an executable that exhibits the problem on his system(s).  I'd like someone with the same version of Windows, FPC and Lazarus as the OP to produce an executable.

It would be very interesting to see, if those two _expected to be identical executables_, behave the same way or differently on the OP's system as well as forum member's systems.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Controls inside the form disappear in execution.
« Reply #27 on: January 26, 2023, 10:01:11 am »
Could those who see this issue tell us the exact operating system they are using? Couldn't it be that this is due to one of the many bugs introduced by Microsoft after Win 7 and which are now gradually removed?

Mine is Win-11 Home (64 bit) Version 22H2, Build 22621.1105, and I also have a Win-7 Pro Service Pack 1 (32 bit) on a VM. None of them shows the issue.

tetrastes

  • Sr. Member
  • ****
  • Posts: 481
Re: Controls inside the form disappear in execution.
« Reply #28 on: January 26, 2023, 10:06:26 am »
Could those who see this issue tell us the exact operating system they are using? Couldn't it be that this is due to one of the many bugs introduced by Microsoft after Win 7 and which are now gradually removed?

Mine is Win-11 Home (64 bit) Version 22H2, Build 22621.1105, and I also have a Win-7 Pro Service Pack 1 (32 bit) on a VM. None of them shows the issue.

Win-10 Home (64 bit) Version 22H2, Build 19045.2486

balazsszekely

  • Guest
Re: Controls inside the form disappear in execution.
« Reply #29 on: January 26, 2023, 10:13:00 am »
Could those who see this issue tell us the exact operating system they are using? Couldn't it be that this is due to one of the many bugs introduced by Microsoft after Win 7 and which are now gradually removed?

Mine is Win-11 Home (64 bit) Version 22H2, Build 22621.1105, and I also have a Win-7 Pro Service Pack 1 (32 bit) on a VM. None of them shows the issue.
I can reproduce the issue with every Lazarus/FPC version I have, both on win10 and win11. The issue is more serious then I thought: TGroupBox, TRadioGroup, TCheckBox are all affected. It's related to the DoubleBuffered property, as mentioned in one of the previous posts. If I set DoubleBuffered to False the issue is gone.
Step to reproduce:
1. Drop a TGroupBox to a from
2. Make sure Doubebuffered is true
3. Drop random controls inside TGroupBox
4. Run application
5. Click ten times or so inside the TGroupBox
6. Click a few times the taskbar. It will only work if you click the taskbar, the empty part of the taskbar
7. Click the TGroupBox again
Repeat 5 -> 7 until you see the issue.

PS: Similar application created with delphi don't show this behaviour.
PS: I will soon test it on win7....the issue is present on win7 too.
« Last Edit: January 26, 2023, 10:22:11 am by GetMem »

 

TinyPortal © 2005-2018