Page 1 of 1

Setwindowfullscreen (window, state)

Posted: Tue Aug 08, 2017 6:19 pm
by Justin
A system to set a window to full screen and going back to normal state. Currently we can have fullscreen using borderless style but we can't go back.

Re: Setwindowfullscreen (window, state)

Posted: Tue Aug 08, 2017 6:51 pm
by Mijikai
Have u tried these:

Code: Select all

SetWindowState(Window,#PB_Window_Maximize)
SetWindowState(Window,#PB_Window_Normal)

Re: Setwindowfullscreen (window, state)

Posted: Tue Aug 08, 2017 7:51 pm
by Justin
No, fullscreen means covering the whole desktop including the taskbar the window has not title or borders either. A lot of programs have this option, if you use Internet explorer hit F11.
So we need #PB_Window_Fullscreen flag for SetWindowState().

Re: Setwindowfullscreen (window, state)

Posted: Tue Aug 08, 2017 8:08 pm
by Mijikai
Like this?

Code: Select all

If OpenWindow(#Null,#Null,#Null,#Null,#Null,#Null$,#PB_Window_BorderLess)
  SetWindowState(#Null,#PB_Window_Maximize)
  StickyWindow(#Null,#True)
  If ButtonGadget(1,10,10,30,30,"X")
    Repeat:Until WaitWindowEvent() = #PB_Event_Gadget
  EndIf
EndIf

Re: Setwindowfullscreen (window, state)

Posted: Tue Aug 08, 2017 10:47 pm
by Justin
But like i said in my first post the point is being able to toggle between normal and fullscreen.

Re: Setwindowfullscreen (window, state)

Posted: Tue Aug 08, 2017 11:28 pm
by Mijikai
So this is not an option?

Code: Select all

Procedure FullScreen(Window.i,Toggle.b)
  StickyWindow(Window,Toggle)
  If Toggle
    SetWindowState(Window,#PB_Window_Maximize)
  Else
    SetWindowState(Window,#PB_Window_Normal)
  EndIf 
EndProcedure

Flag = #True
If OpenWindow(#Null,#Null,#Null,400,400,#Null$,#PB_Window_BorderLess)
  SetWindowState(#Null,#PB_Window_Maximize)
  StickyWindow(#Null,#True)
  If ButtonGadget(1,10,10,30,30,"X") And ButtonGadget(2,10,50,80,30,"TOGGLE")
    Repeat
      If WaitWindowEvent() = #PB_Event_Gadget
        Select EventGadget()
          Case 2
            If Flag
              Flag = #False
            Else
              flag = #True
            EndIf
            FullScreen(#Null,Flag)
          Case 1
            Break 
        EndSelect
      EndIf
    ForEver
  EndIf
EndIf

Re: Setwindowfullscreen (window, state)

Posted: Wed Aug 09, 2017 2:42 am
by kenmo
That doesn't toggle the Borderless flag, which was mentioned in the first post.

It's definitely possible with Windows API, I think you toggle the #GWL_STYLE bits, but I'll leave that to someone better with API.


Also, I would NOT set StickyWindow... try F11 fullscreen in Firefox, Chrome, etc., they do not sticky the window on top.