Page 1 of 1
Panelgadget bug or feature?
Posted: Wed Jan 10, 2018 10:00 am
by chi
The PanelGadget is spamming static controls (creating + destroying) and thus is causing massive GPU usage and flickering on resize.
I guess those controls are intended to mimic a container, but something fishy is going on here

. They are even created when you only hover over buttons inside a PanelGadget...
tested with 5.62b1 and 5.31 (x86)

Re: Panelgadget bug or feature?
Posted: Wed Jan 10, 2018 10:29 am
by Fred
could you try on a panel of a non PureBasic app ?
Re: Panelgadget bug or feature?
Posted: Wed Jan 10, 2018 10:46 am
by chi
Already did and no such thing. Seems to be PB specific. You are using static controls as container, maybe there is some faulty code in the area of creating those container?
Re: Panelgadget bug or feature?
Posted: Wed Jan 10, 2018 11:11 am
by chi
here is an example:
Code: Select all
If OpenWindow(0, 0, 0, 322, 220, "PanelGadget", #WS_OVERLAPPEDWINDOW | #PB_Window_ScreenCentered )
PanelGadget(0, 8, 8, 306, 203)
AddGadgetItem(0, -1, "Panel 1")
ButtonGadget(1, 10, 15, 80, 24,"Button 1")
ButtonGadget(2, 95, 15, 80, 24,"Button 2")
CloseGadgetList()
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
windowdetective
also: it only seems to affect the button class
Re: Panelgadget bug or feature?
Posted: Wed Jan 10, 2018 3:24 pm
by skywalk
Using MS Spy++ with your example code, I do not see the same traffic?
PB v561x64 on Windows 10 Pro x64.
Is this only related to x86?
Re: Panelgadget bug or feature?
Posted: Wed Jan 10, 2018 9:44 pm
by chi
skywalk wrote:Using MS Spy++ with your example code, I do not see the same traffic?
PB v561x64 on Windows 10 Pro x64.
Is this only related to x86?
Nope, also on x64!
Following (partly) code was generated when hovering over a button inside a PB panelgadget (Win7 x64, PB 5.62b1 x64)
Code: Select all
CreateWindowExW ( 0, "STATIC", NULL, WS_CHILD, 98, 38, 80, 24, 0x0000000000020694, NULL, 0x0000000140000000, NULL )
DefWindowProcW ( 0x000000000018063e, WM_NCCREATE, 0, 1238000 )
DefWindowProcW ( 0x000000000018063e, WM_NCCALCSIZE, 0, 1238096 )
GetParent ( 0x000000000018063e )
EnableThemeDialogTexture ( 0x0000000000020694, ETDT_ENABLE )
DefWindowProcW ( 0x000000000018063e, WM_MOVE, 0, 2490466 )
CallWindowProcW ( 0x0000000140002bf4, 0x0000000000020694, WM_PARENTNOTIFY, 1, 1574462 )
CallWindowProcW ( 0x000007fefb00ee08, 0x0000000000020694, WM_PARENTNOTIFY, 1, 1574462 )
DefWindowProcW ( 0x0000000000020694, WM_PARENTNOTIFY, 1, 1574462 )
DrawThemeParentBackground ( 0x000000000018063e, 0xffffffffa1011414, NULL )
CallWindowProcW ( 0x0000000140002bf4, 0x0000000000020694, WM_ERASEBKGND, 18446744072115786772, 0 )
CallWindowProcW ( 0x000007fefb00ee08, 0x0000000000020694, WM_ERASEBKGND, 18446744072115786772, 0 )
CallWindowProcW ( 0x0000000140002bf4, 0x0000000000020694, WM_PRINTCLIENT, 18446744072115786772, 4 )
CallWindowProcW ( 0x000007fefb00ee08, 0x0000000000020694, WM_PRINTCLIENT, 18446744072115786772, 4 )
GetClientRect ( 0x0000000000020694, 0x000000000012dcc0 )
DrawThemeParentBackground ( 0x0000000000020694, 0xffffffffa1011414, NULL )
GetPropW ( 0x000000000002069a, "PB_GadgetStack_5368709120" )
GlobalFindAtomW ( "PB_GadgetStack_5368709120" )
CallWindowProcW ( 0x0000000140004e40, 0x000000000002069a, WM_ERASEBKGND, 18446744072115786772, 0 )
GetPropW ( 0x000000000002069a, "PB_WindowID" )
GlobalFindAtomW ( "PB_WindowID" )
GetPropW ( 0x000000000002069a, "PB_MDI_Gadget" )
GlobalFindAtomW ( "PB_MDI_Gadget" )
DefWindowProcW ( 0x000000000002069a, WM_ERASEBKGND, 18446744072115786772, 0 )
GetPropW ( 0x000000000002069a, "PB_GadgetStack_5368709120" )
GlobalFindAtomW ( "PB_GadgetStack_5368709120" )
CallWindowProcW ( 0x0000000140004e40, 0x000000000002069a, WM_PRINTCLIENT, 18446744072115786772, 4 )
GetPropW ( 0x000000000002069a, "PB_WindowID" )
GlobalFindAtomW ( "PB_WindowID" )
GetPropW ( 0x000000000002069a, "PB_MDI_Gadget" )
GlobalFindAtomW ( "PB_MDI_Gadget" )
DefWindowProcW ( 0x000000000002069a, WM_PRINTCLIENT, 18446744072115786772, 4 )
DrawThemeBackground ( 0x0000000000020001, 0xffffffffa1011414, 9, 0, 0x000000000012db90, NULL )
GetFocus ( )
DestroyWindow ( 0x000000000018063e )
Re: Panelgadget bug or feature?
Posted: Wed Jan 10, 2018 10:14 pm
by skywalk
Hi chi,
Are you seeing those messages on MS SPY++ or just using Window Detective?
Is Window Detective x64 app or only 32-bit?
I'm still not seeing "CreateWindowExW ( 0, "STATIC"..." with SPY++?
EDIT: Oops, if I SPY++ threads, I now see WM_CREATE and WM_DESTROY traffic.
I previously selected just Windows messages.
Re: Panelgadget bug or feature?
Posted: Thu Jan 11, 2018 12:42 am
by chi
I only found this behavior because of the visual representation of opening/closing windows in Window Detective (x86 only)... Would've missed it in Spy++

Re: Panelgadget bug or feature?
Posted: Sun Jan 14, 2018 6:45 am
by chi
The bug is also
visually noticeable with a statusbar!
(move to the bug section?)
Without the panel and buttons the statusbar stays above the gadget while resizing, with the panel there is clearly z-fighting going on and with the buttons enabled, we also get those create/destroy messages in WinDetectiv back.
So maybe the main suspect is the static control?
Code: Select all
If OpenWindow(0, 0, 0, 322, 220, "PanelGadget", #WS_OVERLAPPEDWINDOW | #PB_Window_ScreenCentered )
CreateStatusBar(0, WindowID(0))
PanelGadget(0, 8, 8, 306, 183)
;AddGadgetItem(0, -1, "Panel 1")
;ButtonGadget(1, 10, 15, 80, 24,"Button 1")
;ButtonGadget(2, 95, 15, 80, 24,"Button 2")
CloseGadgetList()
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Re: Panelgadget bug or feature?
Posted: Sun Jan 14, 2018 8:29 am
by Dude
Maybe I'm wrong, but didn't Fred saying using unofficial flags like #WS_OVERLAPPEDWINDOW to override the #PB_Window flags are not considered bugs?
Re: Panelgadget bug or feature?
Posted: Sun Jan 14, 2018 8:56 am
by chi
Dude wrote:Maybe I'm wrong, but didn't Fred saying using unofficial flags like #WS_OVERLAPPEDWINDOW to override the #PB_Window flags are not considered bugs?
Nothing wrong with #WS_OVERLAPPEDWINDOW and the bug has to do with the container of the PanelGadget
Code: Select all
Debug #WS_OVERLAPPEDWINDOW
Debug #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget
Re: Panelgadget bug or feature?
Posted: Sun Jan 14, 2018 9:13 am
by Dude
Okay, I see.
This seems to solve the problem, and keeps the StatusBar on top at all times:
Code: Select all
If OpenWindow(0, 0, 0, 322, 220, "PanelGadget", #WS_OVERLAPPEDWINDOW | #PB_Window_ScreenCentered )
sb=CreateStatusBar(0, WindowID(0))
PanelGadget(0, 8, 8, 306, 183)
AddGadgetItem(0, -1, "Panel 1")
ButtonGadget(1, 10, 15, 80, 24,"Button 1")
ButtonGadget(2, 95, 15, 80, 24,"Button 2")
CloseGadgetList()
BringWindowToTop_(sb)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Re: Panelgadget bug or feature?
Posted: Sun Jan 14, 2018 10:00 am
by chi
Thanks, but my example with the statusbar was to show off the actual bug I explained in the first post... Nothing more

Re: Panelgadget bug or feature?
Posted: Sun Jan 14, 2018 11:31 am
by Dude
Okay... I'll just exit this thread now.

Re: Panelgadget bug or feature?
Posted: Mon Jan 15, 2018 7:23 am
by chi
@Fred: May I suggest using the class "#32770" (Dialog box) instead of #WC_STATIC! This seems to be the most common 'container' for such panels...