Panelgadget bug or feature?

Everything else that doesn't fall into one of the other PB categories.
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Panelgadget bug or feature?

Post 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)
Image
Et cetera is my worst enemy
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Panelgadget bug or feature?

Post by Fred »

could you try on a panel of a non PureBasic app ?
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Panelgadget bug or feature?

Post 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?
Et cetera is my worst enemy
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Panelgadget bug or feature?

Post 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
Et cetera is my worst enemy
User avatar
skywalk
Addict
Addict
Posts: 3972
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Panelgadget bug or feature?

Post 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?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Panelgadget bug or feature?

Post 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 )
Et cetera is my worst enemy
User avatar
skywalk
Addict
Addict
Posts: 3972
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Panelgadget bug or feature?

Post 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.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Panelgadget bug or feature?

Post 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++ ;)
Et cetera is my worst enemy
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Panelgadget bug or feature?

Post 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
Et cetera is my worst enemy
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Panelgadget bug or feature?

Post 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?
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Panelgadget bug or feature?

Post 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
Et cetera is my worst enemy
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Panelgadget bug or feature?

Post 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
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Panelgadget bug or feature?

Post by chi »

Thanks, but my example with the statusbar was to show off the actual bug I explained in the first post... Nothing more ;)
Et cetera is my worst enemy
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Panelgadget bug or feature?

Post by Dude »

Okay... I'll just exit this thread now. :)
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Panelgadget bug or feature?

Post 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...
Et cetera is my worst enemy
Post Reply