StickyWindow() broken in 6.01 compared to 6.00

Post bugreports for the Windows version here
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

StickyWindow() broken in 6.01 compared to 6.00

Post by BarryG »

Hi, something has changed with StickyWindow() in 6.01 compared to 6.00, where it causes either a flicker of some gadgets or the gadgets not to appear at all, when used repeatedly. Here's how I've had to change my code to fix it to how 6.00 worked:

Code: Select all

;StickyWindow(#win,0) ; This makes no gadgets show on my window with 6.01, but it worked with 6.00 normally.
SetWindowPos_(WindowID(#win),#HWND_NOTOPMOST,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE) ; So I do this with 6.01 instead.
Here's a snippet that shows it. Don't judge the code or logic - if it worked in 6.00, it should be flickerless in 6.01 too.

Code: Select all

If OpenWindow(0, 500, 200, 195, 60, "test", #PB_Window_SystemMenu)
  TextGadget(0,10,10,200,50,"This text will flicker with 6.01")
  Repeat
    Event = WindowEvent()
    If Event = 0
      Sleep_(1)
      StickyWindow(0,1) ; Causes repeated flickering in 6.01 LTS, but not in 6.00 LTS.
      ;SetWindowPos_(WindowID(0),#HWND_TOPMOST,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE) ; No flickering in either version.
    ElseIf Event = #PB_Event_CloseWindow
      Quit = 1
    EndIf
  Until Quit = 1
EndIf
So basically, I'm recommending the StickyWindow() code go back to however it worked with 6.00 again.
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: StickyWindow() broken in 6.01 compared to 6.00

Post by Thunder93 »

Yes. that surely flickers!
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: StickyWindow() broken in 6.01 compared to 6.00

Post by BarryG »

Yep. The new v6.01 code for StickyWindow() is obviously doing something else and not just SetWindowPos_() alone anymore. That's all it should be doing, as my example shows.
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: StickyWindow() broken in 6.01 compared to 6.00

Post by mk-soft »

Why do you call StickyWindow in the event loop? It does not belong there.
So nothing flickers ...

Code: Select all

If OpenWindow(0, 500, 200, 195, 60, "test", #PB_Window_SystemMenu)
  StickyWindow(0,1) ; Causes repeated flickering in 6.01 LTS, but not in 6.00 LTS.
  
  TextGadget(0,10,10,200,50,"This text will flicker with 6.01")
  Repeat
    Event = WindowEvent()
    If Event = 0
      ;Sleep_(1)
      ;StickyWindow(0,1) ; Causes repeated flickering in 6.01 LTS, but not in 6.00 LTS.
      ;SetWindowPos_(WindowID(0),#HWND_TOPMOST,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE) ; No flickering in either version.
    ElseIf Event = #PB_Event_CloseWindow
      Quit = 1
    EndIf
  Until Quit = 1
EndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: StickyWindow() broken in 6.01 compared to 6.00

Post by Caronte3D »

I think the current aproach is the correct one, in the past versions the SticyWindow not function in some cases and we was need to call it twice with 0 and 1 tog really put the window top most.
Also you don't need to call it constantly as mk-soft said :wink:
Post Reply