yab | yet another Basic for HAIKU
Fullscreen programs - Printable Version

+- yab | yet another Basic for HAIKU (https://yab.orgfree.com/forum)
+-- Forum: Programming in yab (https://yab.orgfree.com/forum/forumdisplay.php?fid=1)
+--- Forum: Snippets (https://yab.orgfree.com/forum/forumdisplay.php?fid=3)
+--- Thread: Fullscreen programs (/showthread.php?tid=85)



Fullscreen programs - clasqm - 04-04-2017

This will appear as an appendix in the next version of Programming with yab.

Yab does not have a built-in facility to write apps that run in a formal fullscreen mode. But we can fake it! Writing such a program is not very difficult. It boils down to the following steps:

1, Find out the dimensions of the screen using the PEEK command
2. Create a window from 0, 0 to those dimensions, in other words, cover the entire screen with a window.
3. Remove all the window decor with WINDOW SET
4. Continue writing the rest of the program.

That's all there is to it, really! The following little demo shows how to do this.

Code:
#!yab
doc Fullscreen demo
OpenWindow()

// Main Message Loop
dim msg$(1)
while(not leavingLoop)
//This is a dummy loop just to stop the demo from closing
wend
end
// Setup the main window here
sub OpenWindow()
local xw, yh
xw = peek("desktopwidth")
yh = peek ("desktopheight")
    window open 0,0 to xw,yh, "MainWindow", "Main Window"
    window set "MainWindow", "look", "no-border"
end sub

In an actual program, though, I would do one thing differently. Those values for xw and yh - I am going to need them all over the place once I start placing widgets on this window. So just this once, I would consider making them global rather than local variables. Global variables are not intrinsically evil: if you know what you are doing, a good mixture of global and local variables is perfectly acceptable.

This is of course just a regular application that happens to take up the entire screen. Other apps can hide behind it or come up in front of it. A true full-screen mode is provided by the operating system and prevents that from happening.

There is a way to specify that a yab app should always remain on top (see the documentation for WINDOW SET), but that is normally a bad idea when you are working full-screen. You would prevent your user from getting to Tracker or the Deskbar, for one thing. If you are going to do that, make sure to provide an obvious way to minimize or close your app. Yes, you will need to do it - you can't just leave it to the window tab, because we removed it!

But what if you want your program to toggle between a window and full screen? WINDOW SET can help you there too: it has a range of options for moving and resizing your window.


RE: Fullscreen programs - lelldorin - 05-29-2020

In know this if am old discussion ;-)

Yab do fullscrern if you select the fullscreen Button in the tab.

With the window Settings you can declaire fullscreen.
The Widgets on the window need to get Layout options, look here:

http://old.besly.de/menu/search/archiv/dev/yab_layout_eng.html


Free Web Hosting