Most of the functionality in wxRuby is provided through classes, but there are a number of useful functions provided within the Wx:: module.
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().
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.
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.
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.
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.
WxRuby Key Codes, WxRuby Key Modifiers
Integer Wx::xrcid(String name)
This is a convience function for XmlResource#get_xrcid.
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.
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:
To set the buttons to use, use the following constants:
To detect what the return value is, use the above constants as well.
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.
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.
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.
Dialog, TextCtrl, 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.
Dialog, TextCtrl, Wx::get_text_from_user
Wx::log_message(String message)
Wx::log_warning(String message)
Wx::log_error(String message)
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.
String Wx::get_email_address()
Returns a combination of the User’s ID, and Full host name.
Wx::get_full_host_name, Wx::get_user_id
String Wx::get_host_name()
Returns the HOSTNAME, or Computer name for the computer.
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.
String Wx::get_user_id()
Returns the USERNAME of the user currently logged onto the system.
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
Integer Wx::display_depth()
Returns the current desktop display depth, which should be 16,24,32
Size Wx::get_display_size()
Returns the current desktop display resolution in pixels.
Size Wx::get_display_size_mm()
Returns the current desktop display resolution in millimeters.
[This page automatically generated from the Textile source at Thu May 01 00:50:49 +0100 2008]