Search documentation of wx

# View Source wx_misc (wx v2.4.2)

Miscellaneous functions.

Miscellaneous functions.

# Summary

## Functions

beginBusyCursor()
beginBusyCursor(Options)

Changes the cursor to the given cursor for all windows in the application.

bell()

Ring the system bell.

displaySize()

Returns the display size in pixels.

endBusyCursor()

Changes the cursor back to the original cursor, for all windows in the application.

findMenuItemId(Frame, MenuString, ItemString)

Find a menu item identifier associated with the given frame's menu bar.

findWindowAtPoint(Pt)

Find the deepest window at the given mouse position in screen coordinates, returning the window if found, or NULL if not.

getCurrentId()

Returns the current id.

getEmailAddress()

Copies the user's email address into the supplied buffer, by concatenating the values returned by `wxGetFullHostName()` (not implemented in wx) and `getUserId/0`.

getHomeDir()

Return the (current) user's home directory.

getKeyState(Key)

For normal keys, returns true if the specified key is currently down.

getMousePosition()

Returns the mouse position in screen coordinates.

getMouseState()

Returns the current state of the mouse.

getOsDescription()

Returns the string containing the description of the current platform in a user-readable form.

getUserId()

This function returns the "user id" also known as "login name" under Unix (i.e.

isBusy()

Returns true if between two `beginBusyCursor/1` and `endBusyCursor/0` calls.

isPlatform64Bit()

Returns true if the operating system the program is running under is 64 bit.

isPlatformLittleEndian()

Returns true if the current platform is little endian (instead of big endian).

launchDefaultBrowser(Url)
launchDefaultBrowser(Url, Options)

Opens the `url` in user's default browser.

newId()

Deprecated: Ids generated by it can conflict with the Ids defined by the user code, use `wxID_ANY` to assign ids which are guaranteed to not conflict with the user-defined ids for the controls and menu items you create instead of using this function.

registerId(Id)

Ensures that Ids subsequently generated by `newId/0` do not clash with the given `id`.

setCursor(Cursor)

Globally sets the cursor; only has an effect on Windows, Mac and GTK+.

setDetectableAutoRepeat(Flag)

Don't synthesize KeyUp events holding down a key and producing KeyDown events with autorepeat.

shell()
shell(Options)

Executes a command in an interactive shell window.

shutdown()
shutdown(Options)

This function shuts down or reboots the computer depending on the value of the `flags`.

# Functions

Link to this function

# beginBusyCursor()

View Source

    -spec beginBusyCursor() -> ok.

Link to this function

# beginBusyCursor(Options)

View Source

    -spec beginBusyCursor([Option]) -> ok when Option :: {cursor, wxCursor:wxCursor()}.

Changes the cursor to the given cursor for all windows in the application.

Use `endBusyCursor/0` to revert the cursor back to its previous state. These two calls can be nested, and a counter ensures that only the outer calls take effect.

See: `isBusy/0`, `wxBusyCursor` (not implemented in wx)

Link to this function

# bell()

View Source

    -spec bell() -> ok.

Ring the system bell.

Note: This function is categorized as a GUI one and so is not thread-safe.

Link to this function

# displaySize()

View Source

    -spec displaySize() -> {Width :: integer(), Height :: integer()}.

Returns the display size in pixels.

Note: Use of this function is not recommended in the new code as it only works for the primary display. Use `wxDisplay:getGeometry/1` to retrieve the size of the appropriate display instead.

Either of output pointers can be NULL if the caller is not interested in the corresponding value.

See: `wxGetDisplaySize()` (not implemented in wx), `wxDisplay`

Link to this function

# endBusyCursor()

View Source

    -spec endBusyCursor() -> ok.

Changes the cursor back to the original cursor, for all windows in the application.

Use with `beginBusyCursor/1`.

See: `isBusy/0`, `wxBusyCursor` (not implemented in wx)

Link to this function

# findMenuItemId(Frame, MenuString, ItemString)

View Source

    -spec findMenuItemId(Frame, MenuString, ItemString) -> integer()
                            when
                                Frame :: wxFrame:wxFrame(),
                                MenuString :: unicode:chardata(),
                                ItemString :: unicode:chardata().

Find a menu item identifier associated with the given frame's menu bar.

Link to this function

# findWindowAtPoint(Pt)

View Source

    -spec findWindowAtPoint(Pt) -> wxWindow:wxWindow() when Pt :: {X :: integer(), Y :: integer()}.

Find the deepest window at the given mouse position in screen coordinates, returning the window if found, or NULL if not.

This function takes child windows at the given position into account even if they are disabled. The hidden children are however skipped by it.

Link to this function

# getCurrentId()

View Source

    -spec getCurrentId() -> integer().

Returns the current id.

Link to this function

# getEmailAddress()

View Source

    -spec getEmailAddress() -> unicode:charlist().

Copies the user's email address into the supplied buffer, by concatenating the values returned by `wxGetFullHostName()` (not implemented in wx) and `getUserId/0`.

Return: true if successful, false otherwise.

Link to this function

# getHomeDir()

View Source

    -spec getHomeDir() -> unicode:charlist().

Return the (current) user's home directory.

See: `wxGetUserHome()` (not implemented in wx), `wxStandardPaths` (not implemented in wx)

Link to this function

# getKeyState(Key)

View Source

    -spec getKeyState(Key) -> boolean() when Key :: wx:wx_enum().

For normal keys, returns true if the specified key is currently down.

For togglable keys (Caps Lock, Num Lock and Scroll Lock), returns true if the key is toggled such that its LED indicator is lit. There is currently no way to test whether togglable keys are up or down.

Even though there are virtual key codes defined for mouse buttons, they cannot be used with this function currently.

In wxGTK, this function can be only used with modifier keys (`WXK_ALT`, `WXK_CONTROL` and `WXK_SHIFT`) when not using X11 backend currently.

Link to this function

# getMousePosition()

View Source

    -spec getMousePosition() -> {X :: integer(), Y :: integer()}.

Returns the mouse position in screen coordinates.

Link to this function

# getMouseState()

View Source

    -spec getMouseState() -> wx:wx_wxMouseState().

Returns the current state of the mouse.

Returns a `wx_wxMouseState()` instance that contains the current position of the mouse pointer in screen coordinates, as well as boolean values indicating the up/down status of the mouse buttons and the modifier keys.

Link to this function

# getOsDescription()

View Source

    -spec getOsDescription() -> unicode:charlist().

Returns the string containing the description of the current platform in a user-readable form.

For example, this function may return strings like "Windows 10 (build 10240), 64-bit edition" or "Linux 4.1.4 i386".

See: `wxGetOsVersion()` (not implemented in wx)

Link to this function

# getUserId()

View Source

    -spec getUserId() -> unicode:charlist().

This function returns the "user id" also known as "login name" under Unix (i.e.

something like "jsmith"). It uniquely identifies the current user (on this system). Under Windows or NT, this function first looks in the environment variables USER and LOGNAME; if neither of these is found, the entry `UserId` in the `wxWidgets` section of the WIN.INI file is tried.

Return: The login name if successful or an empty string otherwise.

See: `wxGetUserName()` (not implemented in wx)

Link to this function

# isBusy()

View Source

    -spec isBusy() -> boolean().

Returns true if between two `beginBusyCursor/1` and `endBusyCursor/0` calls.

See: `wxBusyCursor` (not implemented in wx)

Link to this function

# isPlatform64Bit()

View Source

    -spec isPlatform64Bit() -> boolean().

Returns true if the operating system the program is running under is 64 bit.

The check is performed at run-time and may differ from the value available at compile-time (at compile-time you can just check if `sizeof(void*) == 8`) since the program could be running in emulation mode or in a mixed 32/64 bit system (bi-architecture operating system).

Note: This function is not 100% reliable on some systems given the fact that there isn't always a standard way to do a reliable check on the OS architecture.

Link to this function

# isPlatformLittleEndian()

View Source

    -spec isPlatformLittleEndian() -> boolean().

Returns true if the current platform is little endian (instead of big endian).

The check is performed at run-time.

Link to this function

# launchDefaultBrowser(Url)

View Source

    -spec launchDefaultBrowser(Url) -> boolean() when Url :: unicode:chardata().

Link to this function

# launchDefaultBrowser(Url, Options)

View Source

    -spec launchDefaultBrowser(Url, [Option]) -> boolean()
                                  when Url :: unicode:chardata(), Option :: {flags, integer()}.

Opens the `url` in user's default browser.

If the `flags` parameter contains `wxBROWSER_NEW_WINDOW` flag, a new window is opened for the URL (currently this is only supported under Windows).

And unless the `flags` parameter contains `wxBROWSER_NOBUSYCURSOR` flag, a busy cursor is shown while the browser is being launched (using `wxBusyCursor` (not implemented in wx)).

The parameter `url` is interpreted as follows:

Returns true if the application was successfully launched.

Note: For some configurations of the running user, the application which is launched to open the given URL may be URL-dependent (e.g. a browser may be used for local URLs while another one may be used for remote URLs).

See: `wxLaunchDefaultApplication()` (not implemented in wx), `wxExecute()` (not implemented in wx)

Link to this function

# newId()

View Source

    -spec newId() -> integer().

Deprecated: Ids generated by it can conflict with the Ids defined by the user code, use `wxID_ANY` to assign ids which are guaranteed to not conflict with the user-defined ids for the controls and menu items you create instead of using this function.

Generates an integer identifier unique to this run of the program.

Link to this function

# registerId(Id)

View Source

    -spec registerId(Id) -> ok when Id :: integer().

Ensures that Ids subsequently generated by `newId/0` do not clash with the given `id`.

Link to this function

# setCursor(Cursor)

View Source

    -spec setCursor(Cursor) -> ok when Cursor :: wxCursor:wxCursor().

Globally sets the cursor; only has an effect on Windows, Mac and GTK+.

You should call this function with wxNullCursor to restore the system cursor.

See: `wxCursor`, `wxWindow:setCursor/2`

Link to this function

# setDetectableAutoRepeat(Flag)

View Source

    -spec setDetectableAutoRepeat(Flag) -> boolean() when Flag :: boolean().

Don't synthesize KeyUp events holding down a key and producing KeyDown events with autorepeat.

On by default and always on in wxMSW.

Link to this function

# shell()

View Source

    -spec shell() -> boolean().

Link to this function

# shell(Options)

View Source

    -spec shell([Option]) -> boolean() when Option :: {command, unicode:chardata()}.

Executes a command in an interactive shell window.

If no command is specified, then just the shell is spawned.

See: `wxExecute()` (not implemented in wx), Examples

Link to this function

# shutdown()

View Source

    -spec shutdown() -> boolean().

Link to this function

# shutdown(Options)

View Source

    -spec shutdown([Option]) -> boolean() when Option :: {flags, integer()}.

This function shuts down or reboots the computer depending on the value of the `flags`.

Note: Note that performing the shutdown requires the corresponding access rights (superuser under Unix, SE_SHUTDOWN privilege under Windows) and that this function is only implemented under Unix and MSW.

Return: true on success, false if an error occurred.