# gGetGlobal

Definition: | include xpGUI.e object res = gGetGlobal(string name) -- or -- integer i = gGetGlobalInt(string name) -- or -- integer {i1,i2} = gGetGlobalIntInt(string name)
Description: | Returns an attribute value from the global environment. name: name of the attribute. Returns: the attribute value, see individual attributes for the format/type that will be.
pwa/p2js: | Supported.
See Also: | gSetGlobal
Notes: | The gGetGlobalIntInt() routine is fairly obviously limited to attributes such as SCREENSIZE that actually return two integers, and can help make code more self-documenting, but note that gGetGlobal() would return the exact same value, rather than (say) converting it into a string. Likewise gGetGlobalInt() is restricted to attributes such as SHIFTKEY. The function gVersion(integer bBack=false) is equivalent to gGetGlobal(`VERSION`) (see below) when bBack is omitted or false, and when true it returns "GTK2", "GTK3", "Win32API", "Win64API", or "JS", which may be useful for diagnostic purposes when on Windows and gUseGTK() may or may not have been called. If bBack is -1 then XPG_GTK(==1), XPG_WINAPI(==2), or XPG_JS(==3) is returned, which may be better for platform-specific tweaks - obviously in an ideal world you wouldn’t want any such, but it is simply not helpful to deliberately thwart the simple fix, and especially so if 2 out of 3 (or more) backends already work just fine. Note there are no xpGUI equivalents for IupVersionDate(), IupVersionNumber(), or IupVersionShow(), or for that matter and more obviously cdVersion(), cdVersionDate(), and cdVersionNumber().
General |
COPYRIGHT | (read-only) Returns eg "Copyright (C) 2023-2024 Pete Lomax / Open Software License version 3.0".
VERSION | (read-only) Returns a string such as: "xpGUI 0.1 on Phix version 1.0.3 (32 bits) on Windows, using WinAPI", or "xpGUI 0.1 on Phix version 1.0.3 (64 bits) on Linux, using GTK 3.22.30", or "xpGUI.js version 0.1 (32 bits)", suitable for use in an about popup or similar. Use requires() instead to check/enforce compatibility.
System Control |
? SINGLEINSTANCE | [Windows Only] Restricts the number of instances of the application by using a name to identify it. The value must also be a partial match to the title of a dialog that will receive the COPYDATA_CB handler with the command line of the second instance. When consulted returns NULL if inside the second instance. So usually in the application initialization after IupOpen, set SINGLEINSTANCE and then consult its value, if NULL abort the second instance by calling IupClose and returning from main.
System Mouse and Keyboard |
? MOUSEPOS | (renamed from CURSORPOS) Controls and returns the cursor position in absolute coordinates relative to the origin of the main screen. The read-only element-specific MOUSEPOS returns client coordinates. The origin of the main screen is at the upper left corner, in Windows it is affected by the position of the Start Menu when it is at the top or left side of the screen. Accepts values in the format "XxY" (in C "%dx%d"), example "200x200". In GTK and Motif also generates mouse motion messages. (since GTK 2.8) Returns: {x,y}, a pair of integer pixel offsets.
SHIFTKEY | (read-only) Returns true if either left or right Shift key is down, false otherwise. CONTROLKEY(aka CTRLKEY) and ALTKEY are the same but for the Ctrl and Alt keys.
System Information |
SCREENSIZE | (read-only) Returns the screen size in pixels available for dialogs, i.e. not including menu bars, task bars, etc. The main screen size does not include additional monitors. Returns: {width,height}, a pair of integers.