Page 1 of 1
Weird Flickering [SOLVED]
Posted: Fri Sep 30, 2022 12:17 pm
by daveb
I intended to use this code as part of a small Windows program I am writing.
Code: Select all
EnableExplicit
Define.i a, event
If OpenWindow(0, 0, 0, 500, 250, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
PanelGadget(1, 10, 10, 480, 230)
For a = 1 To 5
AddGadgetItem(1, -1, "Panel Tab " + Str(a), 0, 0)
Next
CloseGadgetList()
SendMessage_(GadgetID(1), #TCM_SETCURSEL, 1, 0) ; Value of 1 selects tab 2
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
EndIf
On first run tab 2 is selected, but selecting any tab except tab 1, the panels of tabs 2, 3, 4 & 5 flicker. The flickering only stops when tab 1 has been selected. Any thoughts about what might be causing this flicker?
TIA
Dave
Re: Weird Flickering
Posted: Fri Sep 30, 2022 12:52 pm
by BarryG
Confirmed here. It seems that WaitWindowEvent() is still receiving triggering events, as shown by the below. Run the code, click tab 3 and then DON'T move the mouse or do anything for a few moments. The Debug Output keeps showing "n" getting incremented for some reason.
But, why are you using SendMessage instead of "SetGadgetState(1, 1)"? Then you don't get the flickering.
Code: Select all
EnableExplicit
Define.i a, event, n
If OpenWindow(0, 0, 0, 500, 250, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
PanelGadget(1, 10, 10, 480, 230)
For a = 1 To 5
AddGadgetItem(1, -1, "Panel Tab " + Str(a), 0, 0)
Next
CloseGadgetList()
SendMessage_(GadgetID(1), #TCM_SETCURSEL, 1, 0) ; Value of 1 selects tab 2
Repeat
event = WaitWindowEvent()
n + 1 : Debug n
Until event = #PB_Event_CloseWindow
EndIf
Re: Weird Flickering
Posted: Fri Sep 30, 2022 3:46 pm
by Mesa
If Fred wants to debug this flickering: Everything is fine with windows xp 32b, no problem, no flickering, etc.
M.
Re: Weired Flickering
Posted: Fri Sep 30, 2022 4:16 pm
by Axolotl
Confirmed. I can see this flickering once after first click on Tab3 and wait.
With the help of that stuff (link below) you will see that there is WM_PAINT and some unknown messages received repeatedly.
Hint: Use one of these
Identifiying Windows Events or
these to see what is all about.
Changing this helps at my system:
Code: Select all
;SendMessage_(GadgetID(1), #TCM_SETCURSEL, 1, 0) ; Value of 1 selects tab 2
SetGadgetState(1, 1) ; Value of 1 selects tab 2
BTW: I always wonder about the fact that there are always WM_TIMER messages there, ...
Re: Weird Flickering [SOLVED]
Posted: Fri Sep 30, 2022 4:32 pm
by daveb
Thanks Axolotl, that appears to be the solution.
I started out with the idea that maybe I could use SetGadgetItemState(), but that didn't work for a panel gadget item.
Thanks to everybody for your input.
Regards
Dave