This module ties everything together. Lobject
includes and extends this module so these methods are directly available to
Locana objects. Basically, this module provides
short cuts to many commonly used Lobject
methods.
add_theme,
beep,
button,
checkbox,
combobox,
config_get,
config_name_prefix,
config_put,
config_transaction,
container,
datebox,
delete,
destroy,
display_height,
display_width,
editbox,
event_loop,
exists?,
find_valid_path,
frame,
gAutoSavePos,
gAutoSavePos=,
gDefaultFont,
gDefaultFont=,
get_string,
global,
global_name_prefix,
group,
image,
include_style?,
is_open?,
label,
line,
listbox,
load,
load_globals,
locana_version,
menu,
menu_popup,
menu_separator,
menubar,
msgbox,
msgbox_error,
msgbox_warning,
my_documents_folder,
open,
open_color_browser,
open_file_browser,
password,
radiobox,
raise_ok,
raise_okcancel,
scrollbar,
set_global,
set_my_documents_folder,
spinner,
tabgroup,
tabpage,
textbox,
wait,
window,
Loads an object from the LStore. The LStore class is used to store and retrieve objects.
This does not open or display the object. See Locana.open().
- name - the name of the window or Lobject object
you want to load (it must have been previously saved).
- store_name - you can specify which LStore you
want to load the object from.
Loads and opens (or displays) an object from the LStore. The LStore class
is used to store and retrieve objects.
- name - the name of the window or Lobject object
you want to load (it must have been previously saved).
- store_name - you can specify which LStore you
want to load the object from.
Returns the object if a window with name is open and visible, otherwise
returns nil.
- name - the name of the window or Lobject object
you to check on
Returns true if an object with name exists in the LStore.
- name - the name of the window or Lobject object
you want to check for.
- store_name - you can specify which LStore you to
check.
Close and destroy the first opened window that matches the name. The
distinction is important if you open the same window twice or create two
windows with the same name. An LocanaError
is raised if the window is not opened.
- name - the name of an open window, if nil, the currently active window is
closed.
Delete an object from a LStore.
- name - the name of the window or Lobject object
you want to drop or delete (it must have been previously saved).
- store_name - you can specify which LStore you
want to delete or drop the object from.
This is called by config_get() and config_put() to prefix the name of the value
with ‘GUI_name.applet_name:item_name’. This method is provided
to allow you to easily redefine how config names are prefixed.
- item_name - the name (text or symbol) of the item being put in the config
file.
This is called by config_get() and config_put() to prefix the name of the
global values with ‘applet_name:global_name’. This method is
provided to allow you to easily redefine how config names are prefixes.
Load any global symbols from the config file. You can use
applets/config_editor.rb to see and delete these values from the Locana config file.
Return the value of this global value. Alias for Lobject.global(:gAutoSavePos).
Set this true to have the enter key move to the next object. False will
keep the keyboard focus on the same object. The default is true.
Return the value of this global value. Alias for Lobject.global(:gDefaultFont).
You can use this to set the default global font used by all Locana objects.
Returns the users document folder. If :MyDocumentsFolder is defined in the
config file, it is returned. If the environment variable MYDOCUMENTSFOLDER
is defined, it is returned. Otherwise, you are prompted for a folder to
store the documents in.
Sets the users document folder. This is stored in the config file using
:MyDocumentsFolder.
Opens a window and prompts for a single string. It has a text box, Ok
button, and a Cancel button.
- old_string - this is inserted into the text box with the window opens.
- prompt - the text that precedes the text box (prompt string), the default
is ‘String’.
- attr - a hash of attributes forwarded to the window so you can set the
position and color of window
Opens the color browser dialog box allowing you to select a color.
- color - either a supported color name (Symbol),
see locana_colors.rb for supported colors, or an array of color such as
[56, 128, 32].
Returns the selected color as an array such as [56, 128, 32].
Opens the file browser dialog box allows you to select a filename.
- type - the type of dialog to open, :save or :open are supported
- path - the starting path such as ’.’
- filename - the original filename
- default_ext - the default extension when one is not provided or selected
such as ‘txt’ or ‘c’, this is only used when type
== :save
- file_types - an array of file types such as [[‘Text Files’,
’*.txt’], [‘C Source Files’, ’*.c’,
’*.h’], [‘Ruby Files’, ’*.rb’,
’*.rth’], [‘Image Files’, ’*.jpg’,
’*.jpeg’, ’*.gif’, ’*.bmp’],
[‘Documents’, ’*.doc’, ’*.txt’,
’*.csv’], [‘All Files’, ’*.*’]]
- default_type - name (as a string) of the file_type to use as the default
such as ‘Ruby Files’ or ‘C Source Files’, when not
provided the first item in the file_types Array is
used
- window_title - the title for the window, this is optional as the GUI should
provide an adequate window title
Returns the selected filename including the path with all ’\’
converted to ’/’. You can use File.dirname(filename) and
File.basename(filename) to get the path and filename (without path) if
needed. Returns ’’ when no file is selected or the cancel
button is pressed.
Open a message box.
- msg_text - the message seen in the message box.
- msg_type - the type of message box. The following message box types
(msg_type) are supported:
- :ok - has an ‘ok’ button, returns ‘ok’ if the user
clicks on the ‘ok’ button, returns nil if the msgbox window is
closed.
- :okcancel - has ‘ok’ and ‘cancel’ buttons, returns
‘ok’ if the user clicks on the ‘ok’ button, return
‘cancel’ if the user clicks on the ‘cancel’ button,
returns nil if the msgbox window is closed.
- :yesno - has ‘yes’ and ‘no’ buttons
- :yesnocancel - has ‘yes’, ‘no’,
‘cancel’ buttons
- :retrycancel - has ‘retry’ and ‘cancel’ buttons
- :abortretryignore - has ‘abort’, ‘retry’, and
‘ignore’ buttons
- msg_icon - the icon to use. Supported options are
- :error
- :info
- :question
- :warning
- nil - for no icon
- msg_title - the title of the message box window. If this is nil, Locana will assign a reasonable title for the window
based on the msg_icon value.
- msg_default - this is the button that has the keyboard focus when the
msgbox opens up. This allows the user to press the enter key to select the
button. This can be a string or symbol (:ok, :cancel, :yes, :no, etc.)
matching the name of the button to have the keyboard focus when the message
box opens.
This tells the user that an error has occurred. All internal Locana errors call this method to show the error
message.
This tells the user about a warning. For example, you are about to delete
and object would be a warning. All internal Locana warnings call this method.
Raises the error and sets the msgbox type to :ok. When Locana processes this error, it will open msgbox_error with message_type = :ok.
Raises the error and sets the msgbox type to :ok. When Locana processes this error, it will open msgbox_error with message_type = :okcancel.
This returns current_path if it exists. If current_path does not exist it
checks all values in check_paths both with and without the current program
path File.dirname($0) for the path and returns the first valid directory it
finds. Raises LocanaFileNotFound
error if a valid path is not located. This Limage
class uses this to locate image files since you can run Locana applets from various places.
- current_path is the path you want to locate
- check_paths is an array of alternate paths to check
Returns the pixel width of the screen.
Returns the pixel height of the screen.
Alias for Levent.event_loop(). Starts the main event loop,
waits for and process user input, and exits when all windows are closed.
Saves the value to a config file (a HStore) called
Locana::CONFIG_FILE_PATH/locana.hs using name. Config_get and config_put allow you store persistent data
relative to each individual user.
- name - the name (text or symbol) of an item to put in the config file.
- lvalue - the value to store with name.
Retrieves the value from a config file (a HStore) called
Locana::CONFIG_FILE_PATH/locana.hs. Returns the value saved using name or
default_value if name is not in the config file. Config_get and config_put allow you store persistent data
relative to each individual user.
- name - the name (text or symbol) of an item to retrieve from the config
file.
- default_value - if name is not found in the config file, default_value is
returned.
Opens the config file and yields the HStore associated with the config file
so you can perform many operations on the config file at one time. The is
more efficient:
config_do() do |cfg|
cfg[:name] = lvalue
cfg[:name2] = lvalue
cfg.delete(:name3)
end
than:
config_put(:name, lvalue)
config_put(:name2, lvalue)
This is a shortcut for Lbutton.new(name,
…).
This is a shortcut for Lcheckbox.new(name,
…).
This is a shortcut for Lcombobox.new(name,
…).
This is a shortcut for Ldatebox.new(name,
…).
This is a shortcut for Leditbox.new(name,
…).
This is a shortcut for Lframe.new(name, …).
This is a shortcut for Lgroup.new(name, …).
This is a shortcut for Limage.new(name, …).
This is a shortcut for Llabel.new(name, …).
This is a shortcut for Lline.new(name, …).
This is a shortcut for Llistbox.new(name,
…).
This is a shortcut for Lmenu.new(name, …).
This is a shortcut for Lmenubar.new(name,
…).
This is a shortcut for Lpassword.new(name,
…).
This is a shortcut for Lradiobox.new(name,
…).
This is a shortcut for Lspinner.new(name,
…).
This is a shortcut for Ltabgroup.new(name,
…).
This is a shortcut for Ltabpage.new(name,
…).
This is a shortcut for Ltextbox.new(name,
…).
This is a shortcut for Lwindow.new(name,
…).
Sets the value of the global_symbol to value and stored it in the config
file.
Returns the value of the global_symbol.
This adds a theme to Locana.
- theme - a Hash of styles to add.
Returns true if style have been added via a theme.
Thank you for taking the time to visit this web page. I trust you found the information contained in this page useful.
Please email any questions, concerns, or issues with this web site to webmaster@sevasoftware.com.
Please remember Seva Software when your company would benefit from an experienced database architect and software engineer.