wxRuby Documentation Home

# WxRuby module functions

Most of the functionality in wxRuby is provided through classes, but
there are a number of useful functions provided within the Wx:: module.

## See also

App,
Locale

## Methods

### Miscellaneous methods

- Wx::begin_busy_cursor
- Wx::end_busy_cursor
- Wx::bell
- Wx::get_app
- Wx::get_key_state
- Wx::xrcid

### Dialog shortcut methods

- Wx::about_box
- Wx::file_selector
- Wx::message_box
- Wx::get_multiple_choices
- Wx::get_number_from_user
- Wx::get_text_from_user
- Wx::get_password_from_user

### Logging methods

- Wx::log_message
- Wx::log_warning
- Wx::log_error
- Wx::log_status

### System information methods

- Wx::get_email_address
- Wx::get_host_name
- Wx::get_full_host_name
- Wx::get_user_id
- Wx::get_home_dir

### Display information methods

- Wx::display_depth
- Wx::get_display_size
- Wx::get_display_size_mm

### Wx::begin_busy_cursor

Wx::begin_busy_cursor()

This function allows the mouse to be changed into an Hourglass cursor,
when it is moved into your Application’s Main Window. This is often
used to let your user know, that your application is busy processing
information, and won’t accept user input. To return the pointer to
normal, use Wx::end_busy_cursor.

#### See Also

Wx::end_busy_cursor

### Wx::end_busy_cursor

Wx::end_busy_cursor()

This function returns the pointer to the standard pointer. This is
useful to let the user know when they may start inputing new data into
your application.

#### See Also

Wx::begin_busy_cursor

### Wx::bell

Wx::bell()

This function sends an alert sound to be played to the user. Often this
is used when the user enters something, and it’s not correct, or cannot
type anymore text into a TextCtrl.

### Wx::get_app

App* Wx::get_app()

This returns the main instance of the Application created for the program.
Generally, in CPP, this is the constant THE_APP. THE_APP constant is set
when you create your Application, and enter the main_loop. If your not
in the main_loop, THE_APP will be invalid, and raise an uninitalized
cosntant error in Ruby.

#### See Also

App#new, App#main_loop

### Wx::get_key_state

Wx::get_key_state(Integer key)

This checks the given state of a key being pressed or not. If it is pressed,
it will return true, otherwise will return false. You can use normal letters
in a way similar to ‘A’0, or you can use the pre-defined WXK_ constants.

#### See Also

WxRuby Key Codes, WxRuby Key Modifiers

### Wx::xrcid

Integer Wx::xrcid(String name)

This is a convenience function for XmlResource#get_xrcid.

#### See Also

XmlResource#get_xrcid

### Wx::about_box

Wx::about_box(Hash contents) Wx::about_box(AboutDialogInfo contents)

This shows an application “About” information in a platform native
style. See AboutDialogInfo for more information
about the arguments which describe the application that can be passed to
this method.

### Wx::file_selector

String Wx::file_selector(String title,

String defaultDir,
String defaultFile,
String ext_default,
String wildcard,
Integer style,
Window parent)

This is a convenience method, in which to create a File Dialog, to get an input file.

#### See Also

FileDialog#new

### Wx::message_box

Integer Wx::message_box(String message, String title, Integer style)

This function allows a Message Dialog to be displayed, similar to MessageDialog, however
it uses a different set of constants for style. For style, you can specify
the icon with the following constants:

- ICON_INFORMATION
- ICON_QUESTION
- ICON_EXCLAMATION
- ICON_HAND
- ICON_WARNING
- ICON_ERROR
- ICON_STOP
- ICON_ASTERISK

To set the buttons to use, use the following constants:

- OK
- CANCEL
- YES
- NO
- YES_NO
- YES_DEFAULT (Sets Yes to be the Default Button)

To detect what the return value is, use the above constants as well.

#### See Also

Wx::MessageDialog

### Wx::get_multiple_choices

Array Wx::get_multiple_choices(String message,

String title,
Array choices,
Window parent)

This creates a CheckListBox Dialog, in which the user can select
any number of items from a list of choices. It returns the selected choices in
an array back to you.

#### See Also

Dialog, CheckListBox

### Wx::get_number_from_user

Integer Wx::get_number_from_user(String message,

String title,
String label,
Integer default,
Integer minimum,
Integer maximum,
Window parent)

This creates a SpinCtrl Dialog, in which a user can choose a number
between minimum range and maximum range, with a default value given.

#### See Also

Dialog, SpinCtrl

### Wx::get_text_from_user

String Wx::get_text_from_user(String message,

String title,
String default,
Window parent)

This creates a TextCtrl Dialog, in which a user can enter text
for the program to process.

#### See Also

Dialog, TextCtrl, Wx::get_password_from_user

### Wx::get_password_from_user

String Wx::get_password_from_user(String message,

String title,
String default,
Window parent)

This creates a TextCtrl Dialog with TE_PASSWORD style set. This
is similar in operation as Wx::get_text_from_user, the only difference
is that the user will only see * instead of the actual characters typed.

#### See Also

Dialog, TextCtrl, Wx::get_text_from_user

### Wx::log_message

Wx::log_message(String message)

### Wx::log_warning

Wx::log_warning(String message)

### Wx::log_error

Wx::log_error(String message)

### Wx::log_status

Wx::log_status(String message)

These methods interface with the Log class, in which logging
can be done to log programs progress, or trouble. You can have these
messages displayed to the user as message boxes, which is default, or
you can utilize LogTextCtrl to display log messages
in a TextCtrl.

#### See Also

Log, LogTextCtrl, TextCtrl

### Wx::get_email_address

String Wx::get_email_address()

Returns a combination of the User’s ID, and Full host name.

#### See Also

Wx::get_full_host_name, Wx::get_user_id

### Wx::get_host_name

String Wx::get_host_name()

Returns the HOSTNAME, or Computer name for the computer.

#### See Also

Wx::get_full_host_name

### Wx::get_full_host_name

String Wx::get_full_host_name()

Returns the HOSTNAME, or Computer name for the computer, plus the domain that
the computer is a member of. Generally this is a fully qualified domain name
that is assigned by the ISP.

#### See Also

Wx::get_host_name

### Wx::get_user_id

String Wx::get_user_id()

Returns the USERNAME of the user currently logged onto the system.

### Wx::get_home_dir

String Wx::get_home_dir()

Returns the home directory of the User currently logged onto the system.

On Windows NT/2000/XP/Vista:
C:\Documents and Settings\username

On Linux:
/home/username

On MacOS X:
/Users/username

### Wx::display_depth

Integer Wx::display_depth()

Returns the current desktop display depth, which should be 16,24,32

### Wx::get_display_size

Size Wx::get_display_size()

Returns the current desktop display resolution in pixels.

### Wx::get_display_size_mm

Size Wx::get_display_size_mm()

Returns the current desktop display resolution in millimeters.

[This page automatically generated from the Textile source at 2023-06-09 00:45:35 +0000]