Recent

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

wp

  • Hero Member
  • *****
  • Posts: 10641
Re: Controls inside the form disappear in execution.
« Reply #30 on: January 26, 2023, 10:40:32 am »
5. Click ten times or so inside the TGroupBox
"inside the TGroupBox" - does this mean: "on the controls" or "somewhere, but not on the controls"?

GetMem

  • Hero Member
  • *****
  • Posts: 4024
Re: Controls inside the form disappear in execution.
« Reply #31 on: January 26, 2023, 10:48:59 am »
5. Click ten times or so inside the TGroupBox
"inside the TGroupBox" - does this mean: "on the controls" or "somewhere, but not on the controls"?
Somewhere, but not on the controls.

tetrastes

  • Sr. Member
  • ****
  • Posts: 347
Re: Controls inside the form disappear in execution.
« Reply #32 on: January 26, 2023, 10:58:06 am »
6. Click a few times the taskbar. It will only work if you click the taskbar, the empty part of the taskbar

If I create a shortcut to a program on the desktop and launch it from the shortcut, this behavior is also displayed when clicking on an empty space on the desktop.

GetMem

  • Hero Member
  • *****
  • Posts: 4024
Re: Controls inside the form disappear in execution.
« Reply #33 on: January 26, 2023, 11:05:58 am »
6. Click a few times the taskbar. It will only work if you click the taskbar, the empty part of the taskbar

If I create a shortcut to a program on the desktop and launch it from the shortcut, this behavior is also displayed when clicking on an empty space on the desktop.
OK, good to know. Thanks!

wp

  • Hero Member
  • *****
  • Posts: 10641
Re: Controls inside the form disappear in execution.
« Reply #34 on: January 26, 2023, 11:08:22 am »
OK, now I can reproduce it (Win11, Laz/main+fpc3.2.2 (32bit), Laz 2.2.4+fpc3.2.2 (64bit), Laz 2.0.12+fpc3.2.0, Laz 1.8.4+fpc3.0.2, Laz 1.4.4+fpc 2.6.4)

I click the same spot of the groupbox not covered by a control about 10 times, then click on an empty spot in the taskbar, and the controls in the groupbox disappear (the groupbox border remains). A click back into the groupbox is not necessary.

In the Laz versions older than 2.0, the DoubleBuffered propery is not published and is off by default. But in the default state, and when I activate it in FormCreate, I get the same behaviour essentially, but now the areas in the groupbox covered by the controls are painted as black rectangles. When i move the mouse over these areas (without any button pressed) the controls re-appear. This happens also in the newer versions in which the black rectangles do not appear.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 1181
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Controls inside the form disappear in execution.
« Reply #35 on: January 26, 2023, 11:09:07 am »
If I set DoubleBuffered to False the issue is gone.
Sadly not. Just de-/activate window more often and you get same issue.
I turned DoubleBuffer to False for everything = issue is there.
(...With my fix it is gone...)
« Last Edit: January 26, 2023, 11:11:31 am by KodeZwerg »
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

tetrastes

  • Sr. Member
  • ****
  • Posts: 347
Re: Controls inside the form disappear in execution.
« Reply #36 on: January 26, 2023, 12:27:42 pm »
If I set DoubleBuffered to False the issue is gone.
Sadly not. Just de-/activate window more often and you get same issue.
I turned DoubleBuffer to False for everything = issue is there.
(...With my fix it is gone...)

Try
Code: Pascal  [Select][+][-]
  1. Application.DoubleBuffered := adbFalse;    // Add this
  2. Application.Initialize;

and set ParentDoubleBuffered to True for everything.
« Last Edit: January 26, 2023, 12:38:55 pm by tetrastes »

GetMem

  • Hero Member
  • *****
  • Posts: 4024
Re: Controls inside the form disappear in execution.
« Reply #37 on: January 26, 2023, 01:45:29 pm »
Good! Then everyone is able to reproduce it.
It looks like WM_Paint issue. Just to prove it, I made a low level mouse hook(attachment1), when the taskbar is clicked, the GroupBox is repainted by force. With this workaround the issue is gone, however this is not a solution.

PS: Apparently we are not the only ones who bumped into this bug(attachment 2).

wp

  • Hero Member
  • *****
  • Posts: 10641
Re: Controls inside the form disappear in execution.
« Reply #38 on: January 26, 2023, 03:11:13 pm »
when the taskbar is clicked[...]
It's not only the taskbar. It happens also when I click into an IDE form rather than the taskbar.

GetMem

  • Hero Member
  • *****
  • Posts: 4024
Re: Controls inside the form disappear in execution.
« Reply #39 on: January 26, 2023, 03:28:09 pm »
when the taskbar is clicked[...]
It's not only the taskbar. It happens also when I click into an IDE form rather than the taskbar.
Sure, it's not about the taskbar. With my demo project, I only wanted to prove that is a repaint issue.
If somebody wants to take a look, the painting process is in: lazarus\lcl\include\wincontrol.inc, but be prepared to get dizzy.

jamie

  • Hero Member
  • *****
  • Posts: 5171
Re: Controls inside the form disappear in execution.
« Reply #40 on: January 27, 2023, 01:39:43 am »
Can someone drop a TComboBox on the form using csSIMPLE style and stretch it out vertically and add some items.

 conduct the test you have been doing to see if that also disappears?
The only true wisdom is knowing you know nothing

Ecsa

  • New Member
  • *
  • Posts: 13
Re: Controls inside the form disappear in execution.
« Reply #41 on: January 27, 2023, 04:02:37 am »
Hello and thank you all for your help, as I mentioned in some messages I have the problem from Windows 7 to Windows 11 updated to the latest build and in all of them there is the problem that the controls disappear and to make them appear you have to pass the mouse over them controls but they all look horrible or minimize and restore the form window, it's kind of annoying, with the solution that they gave me at the beginning for the project that I shared if it worked for a moment but the problem is there. Hopefully some developer in charge of lazarus will come to see this problem and fix it in a future update.

And if it is not necessarily clicking on the taskbar and it even happens if another window is placed in the foreground then when minimizing to see the form the problem occurs.

GetMem

  • Hero Member
  • *****
  • Posts: 4024
Re: Controls inside the form disappear in execution.
« Reply #42 on: January 28, 2023, 05:28:24 am »
@jamie
Quote
Can someone drop a TComboBox on the form using csSIMPLE style and stretch it out vertically and add some items.
The issue is visible with or without a TComboBox. Style, align does not matter.

jamie

  • Hero Member
  • *****
  • Posts: 5171
Re: Controls inside the form disappear in execution.
« Reply #43 on: January 28, 2023, 04:40:32 pm »
a little testing here.

 How is it a TGroupbox with nothing in it, receives a LM_KILLFOCUS when you click on it?

 For which the message handler simply calls the EXIT this not passing it onto the inherited winProc.

The only true wisdom is knowing you know nothing

jamie

  • Hero Member
  • *****
  • Posts: 5171
Re: Controls inside the form disappear in execution.
« Reply #44 on: January 28, 2023, 05:53:22 pm »

 This is what i did and for the simple test app the @GetMem posted after I commented out this invalidate within.

In the WinControl.inc file I inserted a "Invalidate" in the LM_KILLFOCUS message.

Code: Pascal  [Select][+][-]
  1.     LM_KILLFOCUS:
  2.       begin
  3.         //DebugLn(Format('Trace:[TWinControl.WndPRoc] %s --> _KILLFOCUS', [ClassName]));
  4.         if csFocusing in ControlState then
  5.         begin
  6.           {$IFDEF VerboseFocus}
  7.           DebugLn('TWinControl.WndProc LM_KillFocus during focusing ',Name,':',ClassName);
  8.           {$ENDIF}
  9.           Exit;
  10.         end;
  11.         Invalidate;//<<< added JP.
  12.         Message.Result:=0;
  13.       end;                  
  14.  

This is in the TWinControl.WindProc....

 Here is seems to work well.

Maybe others can fully test this with complete apps.

The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018