GUI/Maximum window dimensions: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
(Add XPL0 example.)
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(16 intermediate revisions by 10 users not shown)
Line 22:
{{libheader|GTK}}
{{libheader|GtkAda}}
<langsyntaxhighlight Adalang="ada">with Gtk.Main;
with Glib;
with Gtk.Window; use Gtk.Window;
Line 48:
New_Line;
Hid := Gtk.Main.Quit_Add_Destroy (0, Win);
end Max_Size;</langsyntaxhighlight>
Output (on a 1280 x 800 screen with Windows XP):
<pre>Maximum dimensions of window : W 1280 x H 734
Line 56:
This is a modified example taken from the AutoHotkey documentation for the [http://ahkscript.org/docs/commands/SysGet.htm SysGet] command.
Also, the built in variables [http://ahkscript.org/docs/Variables.htm#Screen A_ScreenHeight] and [http://ahkscript.org/docs/Variables.htm#Screen A_ScreenWidth] contain the width and height of the primary monitor, in pixels.
<langsyntaxhighlight AutoHotkeylang="autohotkey">SysGet, MonitorCount, MonitorCount
SysGet, MonitorPrimary, MonitorPrimary
MsgBox, Monitor Count:`t%MonitorCount%`nPrimary Monitor:`t%MonitorPrimary%
Line 70:
. "`nRight:`t" MonitorRight " (" MonitorWorkAreaRight " work)"
. "`nBottom:`t" MonitorBottom " (" MonitorWorkAreaBottom " work)"
}</langsyntaxhighlight>
'''Output:'''
<pre>Monitor Count: 1
Line 86:
Because Axe is currently (6/22/2015) only available on the TI-83/84 black and white calculators, the screen dimensions are fixed at 96 by 64 pixels.
 
=={{header|BaConBASIC}}==
==={{header|BaCon}}===
Requires BaCon version 4.0.1 or higher, using GTK3.
<langsyntaxhighlight lang="bacon">OPTION GUI TRUE
PRAGMA GUI gtk3
 
Line 115 ⟶ 116:
gui = Define_Window()
ALARM Print_Dimensions, 500
event$ = GUIEVENT$(gui)</langsyntaxhighlight>
{{out}}
Result when executed using my 1600x900 screen:
<pre>1600-838</pre>
 
==={{header|BBC BASIC}}===
{{works with|BBC BASIC for Windows}}
<langsyntaxhighlight lang="bbcbasic"> SPI_GETWORKAREA = 48
DIM rc{l%,t%,r%,b%}
SYS "SystemParametersInfo", SPI_GETWORKAREA, 0, rc{}, 0
PRINT "Maximum width = " ; rc.r% - rc.l%
PRINT "Maximum height = " ; rc.b% - rc.t%</langsyntaxhighlight>
'''Output:'''
<pre>
Line 136 ⟶ 137:
===Windows===
The following implementation has been tested on Windows 8.1, may not work on Linux systems.
<syntaxhighlight lang="c">
<lang C>
#include<windows.h>
#include<stdio.h>
Line 145 ⟶ 146:
return 0;
}
</syntaxhighlight>
</lang>
Output :
<pre>
Line 162 ⟶ 163:
Bounds are the screen's dimensions; working area is the is the region that excludes "taskbars, docked windows, and docked tool bars" (from Framework documentation).
 
<langsyntaxhighlight lang="csharp">using System;
using System.Drawing;
using System.Windows.Forms;
Line 176 ⟶ 177:
Console.WriteLine($"Primary screen working area: {workingArea.Width}x{workingArea.Height}");
}
}</langsyntaxhighlight>
 
{{out}}
Line 184 ⟶ 185:
Alternatively, use the dimensions of a borderless form with WindowState set to FormWindowState.Maximized (i.e. a full-screen window that is shown above the taskbar).
 
<langsyntaxhighlight lang="csharp">using System;
using System.Drawing;
using System.Windows.Forms;
Line 198 ⟶ 199:
}
}
}</langsyntaxhighlight>
 
{{out}}
Line 204 ⟶ 205:
 
=={{header|Creative Basic}}==
<syntaxhighlight lang="creative basic">
<lang Creative Basic>
DEF Win:WINDOW
DEF Close:CHAR
Line 239 ⟶ 240:
 
Output: Maximum drawing area values: width is 1280 and height is 749.
</syntaxhighlight>
</lang>
=={{header|Delphi}}==
{{libheader| Winapi.Windows}}
{{libheader| System.SysUtils}}
{{libheader| Vcl.Forms}}
<syntaxhighlight lang="delphi">
<lang Delphi>
unit Main;
 
Line 274 ⟶ 275:
end;
 
end.</langsyntaxhighlight>
Resources from form:
<langsyntaxhighlight Delphilang="delphi">object Form1: TForm1
OnCreate = FormCreate
end</langsyntaxhighlight>
 
=={{header|EGL}}==
Line 310 ⟶ 311:
</pre>
Usage of the Browser external type in a RuiHandler.
<syntaxhighlight lang="egl">
<lang EGL>
browser Browser{};
bvh int = browser.getViewportHeight();
Line 316 ⟶ 317:
SysLib.writeStdout("ViewportHeight: " + bvh);
SysLib.writeStdout("ViewportWidth: " + bvw);
</syntaxhighlight>
</lang>
Output
<pre>
Line 325 ⟶ 326:
=={{header|FBSL}}==
In the graphics mode, Windows does it all automatically and displays a form that fills the entire area not obscured by the taskbar on your primary monitor:
<langsyntaxhighlight lang="qbasic">#INCLUDE <Include\Windows.inc>
ShowWindow(ME, SW_MAXIMIZE)
BEGIN EVENTS
END EVENTS</langsyntaxhighlight>
 
Alternatively, one can obtain the unobscured area's dimensions using the following console script:
<langsyntaxhighlight lang="qbasic">#APPTYPE CONSOLE
#INCLUDE <Include\Windows.inc>
 
Line 345 ⟶ 346:
PRINT "width = ", rc.Right - rc.Left, ", height = ", rc.Bottom - rc.Top
 
PAUSE</langsyntaxhighlight>
 
A typical output for a 1680x1050 primary monitor will be:
Line 353 ⟶ 354:
 
=={{header|FreeBASIC}}==
<langsyntaxhighlight lang="freebasic">' FB 1.05.0 Win64
 
' Using SystemParametersInfo function in Win32 API
Line 371 ⟶ 372:
Print
Print "Press any key to quit"
Sleep</langsyntaxhighlight>
Output for my machine:
{{out}}
Line 378 ⟶ 379:
</pre>
 
== {{header|GambasFutureBasic}} ==
<syntaxhighlight lang="futurebasic">include "NSLog.incl"
 
CGRect r
r = fn ScreenVisibleFrame( fn ScreenMainScreen )
NSLog(@"x:%.0f, y:%.0f, w:%.0f, h:%.0f",r.origin.x,r.origin.y,r.size.width,r.size.height)
 
HandleEvents</syntaxhighlight>
{{out}}
<pre>
x:0, y:50, w:1728, h:1029
</pre>
 
=={{header|Gambas}}==
 
=== Overview ===
Line 388 ⟶ 402:
From with the project create a form (FMain) with the following properties set:
 
<langsyntaxhighlight lang="gambas">FMain.Maximized = True
FMain.Visible = False ' The form can be invisible</langsyntaxhighlight>
 
From within the projectview, rightclick the FMain form and select Edit class from the contextmenu. This will display a form class file (FMain.class) as follows:
 
<langsyntaxhighlight lang="gambas">PUBLIC SUB _new()
 
END
Line 399 ⟶ 413:
PUBLIC SUB Form_Open()
 
END</langsyntaxhighlight>
 
=== Adding the form resize event ===
Line 405 ⟶ 419:
We can now add a Form_Resize() event to the class file with the necessary code to obtain the screen dimensions as follows:
 
<langsyntaxhighlight lang="gambas">PUBLIC SUB Form_Resize()
PRINT "The maximum window size that can be used without scrolling is "; FMain.Width; " x "; FMain.Height
END</langsyntaxhighlight>
 
=={{header|Gambas}}==
<langsyntaxhighlight lang="gambas">Public Sub Form_Open()
 
Print Desktop.Width
Print Desktop.Height
 
End</langsyntaxhighlight>
Output:
<pre>
Line 424 ⟶ 438:
=={{header|Go}}==
{{libheader|RobotGo}}
<langsyntaxhighlight lang="go">package main
 
import (
Line 442 ⟶ 456:
fmt.Printf("Max usable : %d x %d\n", w, h)
}
}</langsyntaxhighlight>
 
On my machine the figures are:
Line 451 ⟶ 465:
 
=={{header|Groovy}}==
<langsyntaxhighlight lang="groovy">def window = java.awt.GraphicsEnvironment.localGraphicsEnvironment.maximumWindowBounds
 
println "width: $window.width, height: $window.height"</langsyntaxhighlight>
 
=={{header|Haskell}}==
<langsyntaxhighlight Haskelllang="haskell">import Graphics.UI.Gtk
import Control.Monad (when)
import Control.Monad.Trans (liftIO)
Line 507 ⟶ 521:
liftIO $ putStrLn ("The inner window region is now " ++ show x ++
" pixels wide and " ++ show y ++ " pixels tall.")
return True</langsyntaxhighlight>
 
=={{header|Icon}} and {{header|Unicon}}==
Raise and query a hidden window.
<langsyntaxhighlight Iconlang="icon">link graphics
 
procedure main() # Window size
Line 521 ⟶ 535:
 
write("The display size is w=",dw,", h=",dh)
end</langsyntaxhighlight>
 
{{improve|Icon|Need to handle window borders which will vary from system to system and handle or comment on additional requirements.}}
 
=={{header|IWBASIC}}==
<syntaxhighlight lang="iwbasic">
<lang IWBASIC>
DEF Win:WINDOW
DEF Close:CHAR
Line 562 ⟶ 576:
 
Output: Maximum drawing area values: width is 1280 and height is 749.
</syntaxhighlight>
</lang>
 
=={{header|J}}==
 
For this task, we can create a temporary window, and subtract its usable area from its size. This gives us the size (in pixels) used for decorations. Then we can query the screen size and subtract the size of those decorations.
 
For example:
 
<syntaxhighlight lang="j"> (".wd 'qscreen') -&(2 3&{) (wd'pclose') ]-/".'qform',:&wd 'pc a; cc g isidraw; pshow; qchildxywh g'
1348 750</syntaxhighlight>
 
Here, we had a screen with 1366 by 768 pixels (width and height), and space for decorations subtract 18 from each of those dimensions.
 
=={{header|Java}}==
<langsyntaxhighlight lang="java">import java.awt.*;
import javax.swing.JFrame;
 
Line 587 ⟶ 612:
System.out.println("Max available: " + screenSize);
}
}</langsyntaxhighlight>
 
Output:
Line 597 ⟶ 622:
=={{header|Julia}}==
Uses the Gtk library.
<langsyntaxhighlight lang="julia">
win = GtkWindow("hello", 100, 100)
fullscreen(win)
Line 603 ⟶ 628:
println(width(win), " ", height(win))
destroy(win)
</syntaxhighlight>
</lang>
{{output}} <pre>
1920 1080
Line 610 ⟶ 635:
=={{header|Kotlin}}==
{{trans|Java}}
<langsyntaxhighlight lang="scala">// version 1.1
 
import java.awt.Toolkit
Line 633 ⟶ 658:
fun main(args: Array<String>) {
Test()
}</langsyntaxhighlight>
Sample output:
{{out}}
Line 643 ⟶ 668:
 
=={{header|Lingo}}==
<langsyntaxhighlight lang="lingo">put _system.desktopRectList
-- [rect(0, 0, 1360, 768), rect(1360, 0, 2960, 1024)]</langsyntaxhighlight>
 
=={{header|Lua}}==
<syntaxhighlight lang="lua">nw = require("nw")
win = nw:app():window(320, 240)
win:show()
win:maximize()
cw, ch = win:client_size()
print(cw .. " x " .. ch)</syntaxhighlight>
On a 1920 x 1080 screen..
{{out}}
<pre>1920 x 1017</pre>
 
=={{header|M2000 Interpreter}}==
Line 654 ⟶ 690:
We can read twipsX and twipsY as twips per pixel in X and Y direction
 
<syntaxhighlight lang="m2000 interpreter">
<lang M2000 Interpreter>
Module CheckAllMonitors {
mode 16 ' font size
Line 728 ⟶ 764:
}
CheckAllMonitors
</syntaxhighlight>
</lang>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
Example output on a 1280x1024 system.
<langsyntaxhighlight Mathematicalang="mathematica">Differences@Transpose@SystemInformation["Devices"][[1, 2, 1, 1, 2]]
->{{1260, 951}}</langsyntaxhighlight>
 
=={{header|Nim}}==
==={{libheader|Gdk2}}With Gtk2 ===
==={{libheader|Gtk2}}===
Getting the screen size, ignoring borders, is as easy as:
<lang nim>import
<syntaxhighlight lang="nim">import
gtk2, gdk2
 
Line 744 ⟶ 781:
var w = gdk2.screen_width()
var h = gdk2.screen_height()
echo("WxH=",w,"x",h)</langsyntaxhighlight>
{{out}}
<pre>WxH=1280x8001920x1080</pre>
 
==={{libheader|IUP}}===
But getting the real size excluding borders is more difficult, at least with Gtk. We need to draw a window at maximum size and wait enough time before asking for its size. The following program does the job:
<lang nim>import
<syntaxhighlight lang="nim">import glib2, gtk2
 
proc printSize(window: PWindow): guint {.cdecl.} =
var width, height: gint
window.get_size(addr(width), addr(height))
echo "W x H = ", width, " x ", height
main_quit()
 
nim_init()
 
let window = window_new(WINDOW_TOPLEVEL)
window.maximize()
window.show_all()
 
discard g_timeout_add(100, printSize, addr(window[]))
 
main()</syntaxhighlight>
{{out}}
<pre>W x H = 1920 x 1031</pre>
 
===With Gtk3 (gintro)===
{{libheader|gintro}}
This is the translation of Gtk2 program to Gtk3 using “gintro” bindings.
<syntaxhighlight lang="nim">import gintro/[glib, gobject, gtk, gio]
 
var window: ApplicationWindow
 
#---------------------------------------------------------------------------------------------------
 
proc printSize(data: pointer): gboolean {.cdecl.} =
var width, height: int
window.getSize(width, height)
echo "W x H = ", width, " x ", height
window.destroy()
 
#---------------------------------------------------------------------------------------------------
 
proc activate(app: Application) =
## Activate the application.
 
window = app.newApplicationWindow()
window.maximize()
window.showAll()
 
discard timeoutAdd(PRIORITY_DEFAULT, 100, SourceFunc(printSize), nil, nil)
 
#———————————————————————————————————————————————————————————————————————————————————————————————————
 
let app = newApplication(Application, "Rosetta.ScreenSize")
discard app.connect("activate", activate)
discard app.run()</syntaxhighlight>
{{out}}
<pre>W x H = 1920 x 1031</pre>
 
===With IUP===
{{libheader|IUP}}
<syntaxhighlight lang="nim">import
iup
 
Line 769 ⟶ 863:
 
#discard iup.mainloop()
iup.close()</langsyntaxhighlight>
{{out}}
<pre>1280x800
Line 779 ⟶ 873:
 
=={{header|PARI/GP}}==
<syntaxhighlight lang ="parigp">plothsizes()[1..2]</langsyntaxhighlight>
 
=={{header|Perl}}==
==={{libheader|Perl/Tk}}===
<syntaxhighlight lang="perl">
<lang Perl>
use strict;
use warnings;
Line 792 ⟶ 886:
return ($mw->maxsize);
}
</syntaxhighlight>
</lang>
get_size returns (1425,870) here.
 
Line 798 ⟶ 892:
{{trans|Nim}}
{{libheader|Phix/pGUI}}
<!--<syntaxhighlight lang="phix">-->
<lang Phix>include pGUI.e
<span style="color: #008080;">include</span> <span style="color: #000000;">pGUI</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span>
IupOpen()
<span style="color: #7060A8;">IupOpen</span><span style="color: #0000FF;">()</span>
string scrnFullSize = IupGetGlobal("FULLSIZE")
<span style="color: #004080;">string</span> <span style="color: #000000;">scrnFullSize</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupGetGlobal</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"FULLSIZE"</span><span style="color: #0000FF;">)</span>
string scrnSize = IupGetGlobal("SCREENSIZE")
<span style="color: #004080;">string</span> <span style="color: #000000;">scrnSize</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupGetGlobal</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"SCREENSIZE"</span><span style="color: #0000FF;">)</span>
string scrnMInfo = IupGetGlobal("MONITORSINFO")
<span style="color: #004080;">string</span> <span style="color: #000000;">scrnMInfo</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupGetGlobal</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"MONITORSINFO"</span><span style="color: #0000FF;">)</span>
string scrnVScreen = IupGetGlobal("VIRTUALSCREEN")
<span style="color: #004080;">string</span> <span style="color: #000000;">scrnVScreen</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupGetGlobal</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"VIRTUALSCREEN"</span><span style="color: #0000FF;">)</span>
Ihandle dlg = IupDialog(NULL,"SIZE=FULL")
<span style="color: #004080;">Ihandle</span> <span style="color: #000000;">dlg</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupDialog</span><span style="color: #0000FF;">(</span><span style="color: #004600;">NULL</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"SIZE=FULL"</span><span style="color: #0000FF;">)</span>
string scrnXSize = IupGetAttribute(dlg,"MAXSIZE")
<span style="color: #004080;">string</span> <span style="color: #000000;">scrnXSize</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupGetAttribute</span><span style="color: #0000FF;">(</span><span style="color: #000000;">dlg</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"MAXSIZE"</span><span style="color: #0000FF;">)</span>
?{scrnFullSize, scrnSize, scrnMInfo, scrnVScreen, scrnXSize}
<span style="color: #0000FF;">?{</span><span style="color: #000000;">scrnFullSize</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">scrnSize</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">scrnMInfo</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">scrnVScreen</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">scrnXSize</span><span style="color: #0000FF;">}</span>
IupClose()</lang>
<span style="color: #7060A8;">IupClose</span><span style="color: #0000FF;">()</span>
<!--</syntaxhighlight>-->
{{Out}}
<pre>
Line 821 ⟶ 917:
=={{header|PicoLisp}}==
The following works on ErsatzLisp, the Java version of PicoLisp.
<langsyntaxhighlight PicoLisplang="picolisp">(let Frame (java "javax.swing.JFrame" T "Window")
(java Frame 'setExtendedState
(java (public "javax.swing.JFrame" 'MAXIMIZED_BOTH)) )
Line 829 ⟶ 925:
(prinl "Width: " (java (public Size 'width)))
(prinl "Height: " (java (public Size 'height))) )
(java Frame 'dispose) )</langsyntaxhighlight>
Output (on a 1024x768 screen):
<pre>Width: 1010
Height: 735</pre>
 
=={{header|Processing}}==
 
fullScreen() is the recommended approach to draw a window covering the entire screen from Processing 3.0+ onwards. The implementation below first creates a window and then prints the dimensions onto the canvas.
 
<syntaxhighlight lang="java">
//Aamrun, 26th June 2022
 
fullScreen();
fill(0);
textSize(50);
text("Screen Height : " + str(height), 100, 100);
text("Screen Width : " + str(width), 100, 200);
</syntaxhighlight>
 
=={{header|PureBasic}}==
<langsyntaxhighlight PureBasiclang="purebasic">If OpenWindow(0, 0, 0, 5, 5, "", #PB_Window_Maximize + #PB_Window_Invisible)
maxX = WindowWidth(0)
maxY = WindowHeight(0)
CloseWindow(0)
MessageRequester("Result", "Maximum Window Width: " + Str(maxX) + ", Maximum Window Height: " + Str(maxY))
EndIf</langsyntaxhighlight>
Sample output for a screen area 1600 x 1200:
<pre>Maximum Window Width: 1600, Maximum Window Height: 1181</pre>
 
=={{header|Python}}==
<syntaxhighlight lang="python">
<lang Python>
#!/usr/bin/env python3
 
Line 856 ⟶ 966:
font=("Helvetica", 25)).pack() # add a label and set the size to text.
root.mainloop()
</syntaxhighlight>
</lang>
Sample output for 1366 x 768 screen:
<pre>1366 x 706</pre>
 
=={{header|Racket}}==
<langsyntaxhighlight lang="racket">
#lang racket/gui
(define-values [W H]
Line 868 ⟶ 978:
(send f show #f))))
(printf "~ax~a\n" W H)
</syntaxhighlight>
</lang>
 
=={{header|Raku}}==
Line 875 ⟶ 985:
This is kind-of a silly task. The maximum window size is going to depend on your OS, hardware, display server and graphics toolkit, not your programming language. Taken at face value, using a Linux system running an X11 display server, the maximum displayable window size is the resolution of your monitor. Basically, the size of your desktop viewport. The Raku module X11::libxdo returns the desktop viewport size for get-desktop-dimensions which is the effective maximum window size.
 
<syntaxhighlight lang="raku" perl6line>use X11::libxdo;
 
my $xdo = Xdo.new;
Line 881 ⟶ 991:
my ($dw, $dh) = $xdo.get-desktop-dimensions( 0 );
 
say "Desktop viewport dimensions: (maximum-fullscreen size) $dw x $dh";</langsyntaxhighlight>
{{out|On my system returns}}
<pre>Desktop viewport dimensions: (maximum-fullscreen size) 1920 x 1080</pre>
 
=={{header|REXX}}==
Most REXX interpreters essentially run "inside" a DOS window, &nbsp; and any attempts to find the (maximum) size of that
<br>window is limited to that (current) window, not the maximum.
 
Furthermore, the maximum size would depend on the &nbsp; ''smallest'' &nbsp; font supported by that window, which is dependent
<br>upon which code page is being used &nbsp; (and what font sizes it supports). &nbsp; On this author's system, &nbsp; it's a (fixed) font
<br>size of &nbsp; '''5''' &nbsp; (which is <u>barely</u> readable, &nbsp; but it's useful for &nbsp; X,Y &nbsp; plotting or for cut─n─paste).
 
It should be noted that DOS doesn't support a window that extends to other monitors. <br><br>
 
=={{header|Ring}}==
<langsyntaxhighlight lang="ring">
load "guilib.ring"
new qApp {
Line 898 ⟶ 1,018:
exec()
}
</syntaxhighlight>
</lang>
 
Output:
Line 908 ⟶ 1,028:
IE browser uses different functions than everyone else.
So you write code for the world, and also for IE
<langsyntaxhighlight lang="runbasic">
html "<INPUT TYPE='HIDDEN' id='winHigh' name='winHigh' VALUE='";winHigh;"'></input>"
html "<INPUT TYPE='HIDDEN' id='winWide' name='winWide' VALUE='";winWide;"'></input>"
Line 942 ⟶ 1,062:
var x = winSize();
//--></script>
"</langsyntaxhighlight>
 
=={{header|Scala}}==
<langsyntaxhighlight Scalalang="scala">import java.awt.{Dimension, Insets, Toolkit}
 
import javax.swing.JFrame
Line 964 ⟶ 1,084:
new MaxWindowDims
}
}</langsyntaxhighlight>
 
=={{header|Sidef}}==
Using the Tk library:
<langsyntaxhighlight lang="ruby">require('Tk')
 
func max_window_size() -> (Number, Number) {
Line 975 ⟶ 1,095:
 
var (width, height) = max_window_size();
say (width, 'x', height);</langsyntaxhighlight>
 
{{out}}
Line 984 ⟶ 1,104:
=={{header|Tcl}}==
{{libheader|Tk}}
<langsyntaxhighlight lang="tcl">package require Tk
proc maxSize {} {
# Need a dummy window; max window can be changed by scripts
Line 994 ⟶ 1,114:
# Default max size of window is value we want
return [wm maxsize $top]
}</langsyntaxhighlight>
On this system, that returns <code>1440 836</code>. Further discussion of related matters, including platform limitations, is on [http://wiki.tcl.tk/10872 the Tcler's Wiki].
 
== {{header|Visual Basic}} ==
 
=== Method 1 ===
Line 1,003 ⟶ 1,123:
The first method involves querying the screen dimensions and then subtracting pixels used by the frame and desktop bars:
 
<langsyntaxhighlight lang="vb">TYPE syswindowstru
screenheight AS INTEGER
screenwidth AS INTEGER
Line 1,017 ⟶ 1,137:
syswindow.screenheight=Screen.Height / Screen.TwipsPerPixelY
 
' Make adjustments for window decorations and menubars</langsyntaxhighlight>
 
=== Method 2 ===
Line 1,033 ⟶ 1,153:
Bounds are the screen's dimensions; working area is the is the region that excludes "taskbars, docked windows, and docked tool bars" (from Framework documentation).
 
<langsyntaxhighlight lang="vbnet">Imports System.Drawing
Imports System.Windows.Forms
 
Line 1,044 ⟶ 1,164:
Console.WriteLine($"Primary screen working area: {workingArea.Width}x{workingArea.Height}")
End Sub
End Module</langsyntaxhighlight>
 
{{out}}
Line 1,052 ⟶ 1,172:
Alternatively, use the dimensions of a borderless form with WindowState set to FormWindowState.Maximized (i.e. a full-screen window that is shown above the taskbar).
 
<langsyntaxhighlight lang="vbnet">Imports System.Drawing
Imports System.Windows.Forms
 
Line 1,066 ⟶ 1,186:
End Using
End Sub
End Module</langsyntaxhighlight>
 
{{out}}
<pre>Size of maximized borderless form: 1714x1143</pre>
 
=={{header|V (Vlang)}}==
Graphical
<syntaxhighlight lang="Zig">
import ui
import gg
import gx
 
[heap]
struct App {
mut:
window &ui.Window = unsafe {nil}
}
 
fn main() {
mut app := &App{}
app.window = ui.window(
width: gg.screen_size().width
height: gg.screen_size().height
bg_color: gx.white
title: "Maximum Window"
mode: .resizable
layout: ui.row(
spacing: 5
margin_: 10
widths: ui.stretch
heights: ui.stretch
children: [
ui.label(
id: "info"
text: "Window dimensions: W ${gg.screen_size().width} x H ${gg.screen_size().height}"
),
]
)
)
ui.run(app.window)
}
</syntaxhighlight>
 
=={{header|Wren}}==
{{libheader|DOME}}
<langsyntaxhighlight ecmascriptlang="wren">import "input" for Keyboard
import "dome" for Window, Process
import "graphics" for Canvas, Color
Line 1,090 ⟶ 1,248:
 
static draw(alpha) {}
}</langsyntaxhighlight>
 
{{out}}
Line 1,100 ⟶ 1,258:
=={{header|XPL0}}==
GetFB is a built-in function available on the Raspberry Pi that returns information about the current frame buffer.
<langsyntaxhighlight XPL0lang="xpl0">int A;
[A:= GetFB;
Text(0, "Width = "); IntOut(0, A(0)); CrLf(0);
Text(0, "Height = "); IntOut(0, A(1)); CrLf(0);
]</langsyntaxhighlight>
 
{{out}}
9,476

edits