ResizeWindow() - a known issue with Windows 10?

Windows specific forum
StarWarsFan
Enthusiast
Enthusiast
Posts: 169
Joined: Sat Mar 14, 2015 11:53 am

ResizeWindow() - a known issue with Windows 10?

Post by StarWarsFan »

Hey friends!
Hope you are all doing fine and C19 does not bite you!

Got this issue: I found out that some code that I wrote which resizes a window depending on how much dynamic data (a list) is shown
- works well on Windows 7
- but totally screws up the display on Windows 10
I have melted down the issue to be related to the command "ResizeWindow()". Everything else works well.

Before I begin the discussion I wish to ask: Is this a known bug?
Image - There is usually a lot of "try this, maybe do that" but ONLY an example that one can test for themself and get an immediate result actually brings people forward.
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: ResizeWindow() - a known issue with Windows 10?

Post by BarryG »

StarWarsFan wrote:Is this a known bug?
Short: No.
Long: We need to see some code.
StarWarsFan
Enthusiast
Enthusiast
Posts: 169
Joined: Sat Mar 14, 2015 11:53 am

Re: ResizeWindow() - a known issue with Windows 10?

Post by StarWarsFan »

Hey Barry! Nice to see you again!

Okay, then let me get home and post some code (Got that code at home on laptop).
Image - There is usually a lot of "try this, maybe do that" but ONLY an example that one can test for themself and get an immediate result actually brings people forward.
User avatar
Kiffi
Addict
Addict
Posts: 1353
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: ResizeWindow() - a known issue with Windows 10?

Post by Kiffi »

StarWarsFan wrote:Okay, then let me get home and post some code
Please only post executable code that is as short as possible and with which we can reproduce your problem.
Hygge
StarWarsFan
Enthusiast
Enthusiast
Posts: 169
Joined: Sat Mar 14, 2015 11:53 am

Re: ResizeWindow() - a known issue with Windows 10?

Post by StarWarsFan »

I was experimenting with ResizeWindow() to display a little "window-animation". Enlarging the window to show more data.
This works fine under Win7, it does not on Win10.

The code that I use on Win7 is:

Code: Select all

scrollREIN:  ;- scrollREIN
  summe=0
  For x= 1 To 5 : ResizeWindow(#main,WindowX(#main)-1,#PB_Ignore,WindowWidth(#main)+1,#PB_Ignore) : Mydelay(10) : Next : summe +x*1
  For x= 1 To 6 : ResizeWindow(#main,WindowX(#main)-2,#PB_Ignore,WindowWidth(#main)+2,#PB_Ignore) : Mydelay(10) : Next : summe +x*2
  For x= 1 To 8 : ResizeWindow(#main,WindowX(#main)-4,#PB_Ignore,WindowWidth(#main)+4,#PB_Ignore) : Mydelay(10) : Next : summe +x*4
  For x= 1 To 25: ResizeWindow(#main,WindowX(#main)-5,#PB_Ignore,WindowWidth(#main)+5,#PB_Ignore) : Mydelay(10) : Next : summe +x*5
  For x= 1 To 8 : ResizeWindow(#main,WindowX(#main)-4,#PB_Ignore,WindowWidth(#main)+4,#PB_Ignore) : Mydelay(10) : Next : summe +x*4
  For x= 1 To 6 : ResizeWindow(#main,WindowX(#main)-2,#PB_Ignore,WindowWidth(#main)+2,#PB_Ignore) : Mydelay(10) : Next : summe +x*2
  For x= 1 To 5 : ResizeWindow(#main,WindowX(#main)-1,#PB_Ignore,WindowWidth(#main)+1,#PB_Ignore) : Mydelay(10) : Next : summe +x*1
Return

scrollRAUS:  ;- scrollRAUS
  summe=0
  For x= 1 To 5 : ResizeWindow(#main,WindowX(#main)+1,#PB_Ignore,WindowWidth(#main)-1,#PB_Ignore) : Mydelay(10) : Next : summe +x*1
  For x= 1 To 6 : ResizeWindow(#main,WindowX(#main)+2,#PB_Ignore,WindowWidth(#main)-2,#PB_Ignore) : Mydelay(10) : Next : summe +x*2
  For x= 1 To 8 : ResizeWindow(#main,WindowX(#main)+4,#PB_Ignore,WindowWidth(#main)-4,#PB_Ignore) : Mydelay(10) : Next : summe +x*4
  For x= 1 To 25: ResizeWindow(#main,WindowX(#main)+5,#PB_Ignore,WindowWidth(#main)-5,#PB_Ignore) : Mydelay(10) : Next : summe +x*5
  For x= 1 To 8 : ResizeWindow(#main,WindowX(#main)+4,#PB_Ignore,WindowWidth(#main)-4,#PB_Ignore) : Mydelay(10) : Next : summe +x*4
  For x= 1 To 6 : ResizeWindow(#main,WindowX(#main)+2,#PB_Ignore,WindowWidth(#main)-2,#PB_Ignore) : Mydelay(10) : Next : summe +x*2
  For x= 1 To 5 : ResizeWindow(#main,WindowX(#main)+1,#PB_Ignore,WindowWidth(#main)-1,#PB_Ignore) : Mydelay(10) : Next : summe +x*1
Return
Again: The astonishing thing is that this little "animation" works as desired on Win7, but on Win10 it just won't.
Image - There is usually a lot of "try this, maybe do that" but ONLY an example that one can test for themself and get an immediate result actually brings people forward.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8425
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: ResizeWindow() - a known issue with Windows 10?

Post by netmaestro »

Seems to work here on Windows 10:

Code: Select all

Procedure MyDelay(val.i)
  While WindowEvent():Wend
  Delay(val)
EndProcedure

#main=0
OpenWindow(0,0,0,640,480,"",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)

Gosub scrollrein

Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow

End

scrollREIN:  ;- scrollREIN
  summe=0
  For x= 1 To 5 : ResizeWindow(#main,WindowX(#main)-1,#PB_Ignore,WindowWidth(#main)+1,#PB_Ignore) : MyDelay(10) : Next : summe +x*1
  For x= 1 To 6 : ResizeWindow(#main,WindowX(#main)-2,#PB_Ignore,WindowWidth(#main)+2,#PB_Ignore) : MyDelay(10) : Next : summe +x*2
  For x= 1 To 8 : ResizeWindow(#main,WindowX(#main)-4,#PB_Ignore,WindowWidth(#main)+4,#PB_Ignore) : MyDelay(10) : Next : summe +x*4
  For x= 1 To 25: ResizeWindow(#main,WindowX(#main)-5,#PB_Ignore,WindowWidth(#main)+5,#PB_Ignore) : MyDelay(10) : Next : summe +x*5
  For x= 1 To 8 : ResizeWindow(#main,WindowX(#main)-4,#PB_Ignore,WindowWidth(#main)+4,#PB_Ignore) : MyDelay(10) : Next : summe +x*4
  For x= 1 To 6 : ResizeWindow(#main,WindowX(#main)-2,#PB_Ignore,WindowWidth(#main)+2,#PB_Ignore) : MyDelay(10) : Next : summe +x*2
  For x= 1 To 5 : ResizeWindow(#main,WindowX(#main)-1,#PB_Ignore,WindowWidth(#main)+1,#PB_Ignore) : MyDelay(10) : Next : summe +x*1
  Return
BERESHEIT
StarWarsFan
Enthusiast
Enthusiast
Posts: 169
Joined: Sat Mar 14, 2015 11:53 am

Re: ResizeWindow() - a known issue with Windows 10?

Post by StarWarsFan »

That is very astonishing, if not surprising.

The only difference appers to be the delay procedure, I used
Procedure MyDelay(Delay)
Timer= ElapsedMilliseconds() : Repeat : WaitWindowEvent(1) : Until ElapsedMilliseconds()-Timer >= Delay
EndProcedure
=> Did NOT work on Win10 properly

You used:
Procedure MyDelay(val.i)
While WindowEvent():Wend
Delay(val)
EndProcedure
=> Will now test on my second PC

But can anyone explain in detail where exactly I went wrong with my routine? I want to learn!
Image - There is usually a lot of "try this, maybe do that" but ONLY an example that one can test for themself and get an immediate result actually brings people forward.
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ResizeWindow() - a known issue with Windows 10?

Post by mk-soft »

Alternative für OS Windows show AnimateWindow

Link: https://docs.microsoft.com/en-us/window ... matewindow
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
Post Reply