Module
Locana
Home
In: locana.rb locana/l_object_themes.rb

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.

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,
Public Class methods
load(name, store_name='locana.ls') src

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().

open(name, store_name='locana.ls') src

Loads and opens (or displays) an object from the LStore. The LStore class is used to store and retrieve objects.

is_open?(name) src

Returns the object if a window with name is open and visible, otherwise returns nil.

exists?(name, store_name='locana.ls') src

Returns true if an object with name exists in the LStore.

destroy(name=nil) src

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.

delete(name, store_name='locana.ls') src

Delete an object from a LStore.

config_name_prefix(item_name) src

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.

global_name_prefix(item_name) src

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_globals() src

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.

gAutoSavePos() src

Return the value of this global value. Alias for Lobject.global(:gAutoSavePos).

gAutoSavePos=(lvalue) src

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.

gDefaultFont() src

Return the value of this global value. Alias for Lobject.global(:gDefaultFont).

gDefaultFont=(lvalue) src

You can use this to set the default global font used by all Locana objects.

Public Instance methods
locana_version() src
my_documents_folder() src

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.

set_my_documents_folder(new_path) src

Sets the users document folder. This is stored in the config file using :MyDocumentsFolder.

get_string(old_string=nil, prompt='String:', attr={}) {|file_t.value| ...} src

Opens a window and prompts for a single string. It has a text box, Ok button, and a Cancel button.

open_color_browser(color) src

Opens the color browser dialog box allowing you to select a color.

Returns the selected color as an array such as [56, 128, 32].

open_file_browser(type, path, filename, default_ext, file_types, default_type=nil, window_title=nil) src

Opens the file browser dialog box allows you to select a filename.

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.

msgbox(msg_text, msg_type=:ok, msg_icon=nil, msg_title=nil, msg_default=nil, &block) src

Open a message box.

msgbox_error(msg_text, msg_type=:abortretryignore, &block) src

This tells the user that an error has occurred. All internal Locana errors call this method to show the error message.

msgbox_warning(msg_text, msg_type=:okcancel, &block) src

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.

raise_ok(anException, aString=nil, anArray=nil) src

Raises the error and sets the msgbox type to :ok. When Locana processes this error, it will open msgbox_error with message_type = :ok.

raise_okcancel(anException, aString=nil, anArray=nil) src

Raises the error and sets the msgbox type to :ok. When Locana processes this error, it will open msgbox_error with message_type = :okcancel.

find_valid_path(current_path, check_paths=nil) src

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.

display_width() src

Returns the pixel width of the screen.

display_height() src

Returns the pixel height of the screen.

beep(tone=10) src

Beeps the display.

wait(millisec) src

Waits for millisec.

event_loop() src

Alias for Levent.event_loop(). Starts the main event loop, waits for and process user input, and exits when all windows are closed.

config_put(name, lvalue) src

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.

config_get(name, default_value=nil) src

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.

config_transaction() {|hstore}| ...} src

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)
button(name, attr=nil, &block) src

This is a shortcut for Lbutton.new(name, …).

checkbox(name, attr=nil, &block) src

This is a shortcut for Lcheckbox.new(name, …).

combobox(name, attr=nil, &block) src

This is a shortcut for Lcombobox.new(name, …).

container(name, attr=nil, &block) src

This is a shortcut for Lcontainer.new(name, …).

datebox(name, attr=nil, &block) src

This is a shortcut for Ldatebox.new(name, …).

editbox(name, attr=nil, &block) src

This is a shortcut for Leditbox.new(name, …).

frame(name, attr=nil, &block) src

This is a shortcut for Lframe.new(name, …).

group(name, attr=nil, &block) src

This is a shortcut for Lgroup.new(name, …).

image(name, attr=nil, &block) src

This is a shortcut for Limage.new(name, …).

label(name, attr=nil, &block) src

This is a shortcut for Llabel.new(name, …).

line(name, attr=nil, &block) src

This is a shortcut for Lline.new(name, …).

listbox(name, attr=nil, &block) src

This is a shortcut for Llistbox.new(name, …).

menu(name, attr=nil, &block) src

This is a shortcut for Lmenu.new(name, …).

menu_popup(name, attr=nil, &block) src

This is a shortcut for Lmenu_popup.new(name, …).

menu_separator(name, attr=nil, &block) src

This is a shortcut for Lmenu_separator.new(name, …).

menubar(name, attr=nil, &block) src

This is a shortcut for Lmenubar.new(name, …).

password(name, attr=nil, &block) src

This is a shortcut for Lpassword.new(name, …).

radiobox(name, attr=nil, &block) src

This is a shortcut for Lradiobox.new(name, …).

scrollbar(name, attr=nil, &block) src

This is a shortcut for Lscrollbar.new(name, …).

spinner(name, attr=nil, &block) src

This is a shortcut for Lspinner.new(name, …).

tabgroup(name, attr=nil, &block) src

This is a shortcut for Ltabgroup.new(name, …).

tabpage(name, attr=nil, &block) src

This is a shortcut for Ltabpage.new(name, …).

textbox(name, attr=nil, &block) src

This is a shortcut for Ltextbox.new(name, …).

window(name, attr=nil, &block) src

This is a shortcut for Lwindow.new(name, …).

set_global(global_symbol, lvalue) src

Sets the value of the global_symbol to value and stored it in the config file.

global(global_symbol) src

Returns the value of the global_symbol.

add_theme(theme) src

This adds a theme to Locana.

include_style?(style) src

Returns true if style have been added via a theme.


Seva Software


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.

http://www.arunadb.org http://www.locana.org http://www.ruby-lang.org http://www.coolwell.org http://www.sevasoftware.com