GUI/Maximum window dimensions: Difference between revisions
Content added Content deleted
(Clarifications and considerations) |
(Gambas (imported from markhobley.yi.org)) |
||
Line 13: | Line 13: | ||
For a tiling window manager, the values calculated should represent the maximum height and width of the display area of the maximum size a window can be created (without scrolling). This would typically be a full screen window (minus any areas occupied by desktop bars), unless the window manager has restrictions that does not allow creation of a full screen window, in which case the values represent the maximum usable area (without scrolling). |
For a tiling window manager, the values calculated should represent the maximum height and width of the display area of the maximum size a window can be created (without scrolling). This would typically be a full screen window (minus any areas occupied by desktop bars), unless the window manager has restrictions that does not allow creation of a full screen window, in which case the values represent the maximum usable area (without scrolling). |
||
== {{header|Gambas}} == |
|||
=== Overview === |
|||
In gambas, the trick to determining the maximum window size that will fit on the screen is to create a form that is maximized and then query its dimensions from within a Form_Resize() event. Note that the form can be invisible during this process, and typically we would use the main modal window (FMain in this example). |
|||
=== Creating the form === |
|||
From with the project create a form (FMain) with the following properties set: |
|||
<lang gambas> |
|||
FMain.Maximized = True |
|||
FMain.Visible = False ' The form can be invisible |
|||
</lang> |
|||
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: |
|||
<lang gambas> |
|||
PUBLIC SUB _new() |
|||
END |
|||
PUBLIC SUB Form_Open() |
|||
END |
|||
</lang> |
|||
Adding the form resize event |
|||
We can now add a Form_Resize() event to the class file with the necessary code to obtain the screen dimensions as follows: |
|||
<lang gambas> |
|||
PUBLIC SUB Form_Resize() |
|||
PRINT "The maximum window size that can be used is "; FMain.Width; " x "; FMain.Height |
|||
END |
|||
</lang> |
|||
== {{header|Visual Basic}} == |
== {{header|Visual Basic}} == |