Setwindowfullscreen (window, state)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Setwindowfullscreen (window, state)

Post 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.
User avatar
Mijikai
Addict
Addict
Posts: 1517
Joined: Sun Sep 11, 2016 2:17 pm

Re: Setwindowfullscreen (window, state)

Post by Mijikai »

Have u tried these:

Code: Select all

SetWindowState(Window,#PB_Window_Maximize)
SetWindowState(Window,#PB_Window_Normal)
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Re: Setwindowfullscreen (window, state)

Post 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().
User avatar
Mijikai
Addict
Addict
Posts: 1517
Joined: Sun Sep 11, 2016 2:17 pm

Re: Setwindowfullscreen (window, state)

Post 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
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Re: Setwindowfullscreen (window, state)

Post by Justin »

But like i said in my first post the point is being able to toggle between normal and fullscreen.
User avatar
Mijikai
Addict
Addict
Posts: 1517
Joined: Sun Sep 11, 2016 2:17 pm

Re: Setwindowfullscreen (window, state)

Post 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
User avatar
kenmo
Addict
Addict
Posts: 2033
Joined: Tue Dec 23, 2003 3:54 am

Re: Setwindowfullscreen (window, state)

Post 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.
Post Reply