It is currently Sat Oct 31, 2020 11:32 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Solved: Creating WindowedScreen fails on Catalina OS, PB572
PostPosted: Tue Jun 02, 2020 9:47 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Apr 05, 2020 11:28 am
Posts: 284
Location: Pandora
Hi,
can you try this.

Crashes, but not at every run, but almost always on Catalina MacOS and PB 5.72

Best regards Saki

Code:
InitSprite()
Define wID=OpenWindow(1 , 0 , 0 , 100 , 100 , "" ,  #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(1) , 0 , 0 , 100 , 100)

; The creation of the screen fails, so StartDrawing fails, but not at every run
If Not StartDrawing(ScreenOutput())
  Debug "Fail"
  End
EndIf
StopDrawing()

Debug "OK"
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

_________________
地球上の平和


Last edited by Saki on Tue Jun 02, 2020 5:32 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Creating WindowedScreen fails on Catalina OS and PB 5.7
PostPosted: Tue Jun 02, 2020 1:16 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Apr 05, 2020 11:28 am
Posts: 284
Location: Pandora
Its very strange, so it works :

Added #PB_Window_Invisible , thats all

Code:
InitSprite()

Define wID=OpenWindow(#PB_Any , 0 , 0 , 100 , 100 , "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_Invisible)

OpenWindowedScreen(WindowID(wID) , 0 , 0 , 100 , 100)

; The creation of the screen fails, so StartDrawing fails, but not at every run

If Not StartDrawing(ScreenOutput())
  Debug "Fail"
  End
EndIf
StopDrawing()

Debug "OK"

HideWindow(wID, 0)

Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow

_________________
地球上の平和


Top
 Profile  
Reply with quote  
 Post subject: Re: Creating WindowedScreen fails on Catalina OS and PB 5.7
PostPosted: Tue Jun 02, 2020 2:54 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2689
Location: Germany
Always check if the function was successful ...

It's work (PB example)

Update
Code:
If InitSprite() = 0
  MessageRequester("Error", "Can't open screen & sprite environment!", 0)
  End
EndIf

If OpenWindow(0, 0, 0, 220, 160, "A screen in a window...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ButtonGadget(0, 170, 135, 45, 20, "Quit")
  ; Dispatch Events befor open screen
  While WindowEvent() : Wend
 
  If OpenWindowedScreen(WindowID(0), 0, 0, 160, 160)
    CreateSprite(0, 20, 20)
    If StartDrawing(SpriteOutput(0))
      Box(0, 0, 20, 20, RGB(255, 0, 155))
      Box(5, 5, 10, 10, RGB(155, 0, 255))
      StopDrawing()
    EndIf
  Else
    MessageRequester("Error", "Can't open windowed screen!", 0)
    End
  EndIf
EndIf

direction = 2
Repeat
  ; Es ist sehr wichtig, alle im Queue befindlichen Ereignisse während jedes Frames abzuarbeiten
  ;
  Repeat
    Event = WindowEvent()
   
    Select Event
      Case #PB_Event_Gadget
        If EventGadget() = 0
          End
        EndIf
       
      Case #PB_Event_CloseWindow
        End
    EndSelect
  Until Event = 0
 
  FlipBuffers()
  ClearScreen(RGB(0, 0, 0))
  DisplaySprite(0, x, x)
  x + direction
  If x > 140 : direction = -2 : EndIf
  If x < 0   : direction =  2 : EndIf
  Delay(1)
ForEver

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Last edited by mk-soft on Tue Jun 02, 2020 4:01 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Creating WindowedScreen fails on Catalina OS and PB 5.7
PostPosted: Tue Jun 02, 2020 3:53 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Apr 05, 2020 11:28 am
Posts: 284
Location: Pandora
Hi, many thanks for testing mk-soft

Its my old machine i think

Best regards Saki

_________________
地球上の平和


Top
 Profile  
Reply with quote  
 Post subject: Re: Creating WindowedScreen fails on Catalina OS and PB 5.7
PostPosted: Tue Jun 02, 2020 4:05 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2689
Location: Germany
I don't think your machine is too old, because Catalina running on your machine.
It failed once with me too. Maybe you have to process all events before creating the screen.

Code above an update.

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: Creating WindowedScreen fails on Catalina OS and PB 5.7
PostPosted: Tue Jun 02, 2020 4:18 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Apr 05, 2020 11:28 am
Posts: 284
Location: Pandora
Hi, thanks mk-soft,
it is strange, it fails, but its not important, init with #PB_Window_Invisible and it works fine.
I have another codes that uses the screen that worked,
so I could easily compare to find fast the cause.

Best regards Saki

_________________
地球上の平和


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye