Class
Lcontainer
Home
In: locana/l_container.rb
Parent: Lobject

This contains other Locana objects and provides a foundation for the Lframe object. It can have a border but it can’t have scrollbars nor other objects in the border (see the Lframe object). It is based on the Lobject class.

Methods

activate_popup, add, add_top, button, check_and_update_scrollbars, checkbox, children, clear, close, combobox, container, datebox, delete_child, destroy, destroy_child, disable, each_child, editbox, enable, find_object_with_accelerator, frame, frameH, frameW, get, get_child, group, has_child?, has_children?, has_hscroll?, has_vscroll?, image, label, line, listbox, lock, menu, menu_popup, menu_separator, menubar, method_missing, names_of_children, nchildren, needs_hscroll?, needs_vscroll?, new, on_resize, open, paint_focus?, password, pixel_height_total, pixel_width_total, prepare, radiobox, reposition_child, scrollbar, set_focus, spinner, tabgroup, tabpage, textbox, to_s, unlock, valid_attribute?, window,
Public Class methods
new(name, attr=nil, &block) src

Creates an instance variable to store an Array of children.

Public Instance methods
paint_focus?() src

By default, containers don’t get a focus. Returns false.

valid_attribute?(attribute, lvalue=nil) src

Support the :focus attribute.

to_s(prefix='') src

Includes a count of children.

open(parent) src

Open all children.

close() src

Close all children.

destroy() src

Destroy all children.

activate_popup(x=nil, y=nil) src

This will open the popup menubar associated with this object. If this object does not have a popup menu, then all parent objects are checked for a popup menu.

add(object) src

Adds object to self. Example: (see tst/tst_locana.rb for more examples)

    win = Lobject.new(:window, 'TestEditBox', :text=>'Test EditBox', :pos=>[60,60])
    lbl = Lobject.new(:label, 'l_label1', :text=>'Type some text', :pos=>[10, 5])
    txt = Lobject.new(:textbox, 't_text1', :pos=>[10, 30, 200])
    # bind a print statement to the after_update event for the textbox object
    txt.bind(:on_after_update, %q{print "after update, new value: '#{event.value}'\n"})
    btn = Lobject.new(:button, 'b_ok', :text=>'Ok', :pos=>[260, 260])
    btn.bind(:on_click, "close()" # this button will close the form
    win.add_object(lbl)
    win.add_object(txt)
    win.add_object(btn)
    win.save('locana.ls')  # save this window object

You may need to call reprepare(true) to see the change fully reflected such as getting the scrollbars to update correctly.

add_top(object) src

Adds object in front of all other children. You may need to call reprepare(true) to see the change fully reflected such as getting the scrollbars to update correctly.

delete_child(object) src

Deletes object from caller (self), object and all of it’s children can be reused.

    object - can be a locana object or the name of an object

You may need to call reprepare(true) to see the change fully reflected such as getting the scrollbars to update correctly.

destroy_child(object) src

Destroy child object and all of it’s children from caller (self). Call delete_child() to remove the child then destroys the content of all attributes and instance variables. Calling delete_child allows you to reuse the object, while calling destroy_child makes the object unusable.

reposition_child(child_object, new_position) src

Changes the position of child_object relative to other siblings. Calling this will negatively affect the :sticky and related attributes. Therefore, this method is not recommended if any object relies on the position of child_object or child_object relies on the position of other siblings. This GUI builder uses this for bringing an object to the front or pushing an object behind other objects. Supported positions are:

clear(include_children=nil) src

Clear the content this object (clears the :value attribute). If include_children is true, this will clear the :value attribute of all children.

enable(include_children=true) src

Enables all children when include_children=true.

disable(include_children=true) src

Disables all children (puts them in a :state of :disabled) when include_children=true.

lock(include_children=true) src

Locks all children (puts them in a :state of :locked) when include_children=true.

unlock(include_children=true) src

Unlock all children when include_children=true.

find_object_with_accelerator(laccelerator) src

Checks all children for laccelerator, returns the first object with an accelerator matching laccelerator. Returns nil if no object has laccelerator.

names_of_children(array_of_names=[]) src

Returns an Array containing the names of all the children. array_of_names - when provided, the names of all children are added to the end of this Array

has_child?(object, include_children=nil) src

Returns true if object belongs to self, otherwise returns false.

get_child(name, include_children=nil) src

Returns the object within self whose name matches name. Returns nil if self does not have any children that match name.

get(name, include_children=nil)

Alias for get_child

has_children?() src

Returns true if this object has children.

children() src

Returns all children that are not internally created. The Lbutton_pixmap of the Lcombobox class is an example of an internally created object.

nchildren() src

Returns the number of children in this object.

each_child(include_internal=nil) {|obj| ...} src

Yields each child object.

set_focus() src

Gives the keyboard focus to a child object in this container. If an object already has the focus, then it tells the GUI Binding to give that object the focus. If not, calls next_focus to give this first object in the parent_window the focus.

pixel_width_total() src

Returns the pixel x + pixel width of the right most object. This is the total amount of space needed by this object.

pixel_height_total() src

Returns the pixel y + pixel height of the bottom most object. This is the total amount of space needed by this object.

frameW() src

Returns the pixel width of the client area of this object. This does not include any internally padding (i.e. the :ipadx attribute is ignored).

frameH() src

Returns the pixel height of the client area of this object. This does not include any internally padding (i.e. the :ipadx attribute is ignored).

method_missing(meth, *args, &block) src

When meth matches the name of a child object, a method is automatically created for accessing the child object. Supports things object_name.attr_name, object_name.object_name.method(), and object_name.object_name.attr_name = ?. If you decide to use this technique, name your objects or widgets carefully. If an object name matches an existing method, you will get an error. As a result, I prefix my objects with ‘b_’, ‘l_’, ‘g_’, etc. as needed. Example: (see tst/tst_locana.rb for more examples)

    Lwindow.new('w_TestEditBox', :text=>'Test EditBox', :pos=>[60, 60]) {
       label('l_label1', :text=>'Type some text', :pos=>[10, 5])
       textbox('t_text1', :pos=>[10, 30, 200])
       group('g_group', :pos=>[260, 260]) {
          button('b_ok', :text=>'Ok', :pos=>[0, 0])
          b_ok.on_mouse_rup = "close()"     # one way to address the button
       }
       t_text1.on_after_update = %q{print "after update, new value: '#{event.value}'\n"}
       g_group.b_ok.on_click = "Lobject.close()"  # another way to address the button
       g_group.b_ok.state = :disabled             # we can also get or set attributes
    }
on_resize(levent=nil, &block) src

Triggered when an object is resized (not during a reprepare) or a window is resized. This does not actually resize the object, it expects that the object is already in the new position.

has_vscroll?() src

Returns nil because containers can’t have scrollbars.

has_hscroll?() src

Returns nil because containers can’t have scrollbars.

needs_vscroll?() src

Returns false because containers can’t have scrollbars.

needs_hscroll?() src

Returns false because containers can’t have scrollbars.

check_and_update_scrollbars() src

This is only supported for Lframe objects and provided here so Locana does not have to check the class before calling this method.

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

A shortcut for add(Lbutton.new(name, …)).

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

A shortcut for add(Lcheckbox.new(name, …)).

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

A shortcut for add(Lcombobox.new(name, …)).

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

A shortcut for add(Lcontainer.new(name, …)).

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

A shortcut for add(Ldatebox.new(name, …)).

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

A shortcut for add(Leditbox.new(name, …)).

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

A shortcut for add(Lframe.new(name, …)).

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

A shortcut for add(Lgroup.new(name, …)).

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

A shortcut for add(Limage.new(name, …)).

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

A shortcut for add(Llabel.new(name, …)).

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

A shortcut for add(Lline.new(name, …)).

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

A shortcut for add(Llistbox.new(name, …)).

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

A shortcut for add(Lmenu.new(name, …)).

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

A shortcut for add(Lmenubar.new(name, …)).

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

A shortcut for add(Lmenu_popup.new(name, …)).

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

A shortcut for add(Lmenu_separator.new(name, …)).

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

A shortcut for add(Lpassword.new(name, …)).

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

A shortcut for add(Lradiobox.new(name, …)).

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

A shortcut for add(Lscrollbar.new(name, …)).

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

A shortcut for add(Lspinner.new(name, …)).

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

A shortcut for add(Ltabgroup.new(name, …)).

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

A shortcut for add(Ltabpage.new(name, …)).

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

A shortcut for add(Ltextbox.new(name, …)).

window(name, attr=nil) src

A shortcut for add(Lwindow.new(name, …)).

prepare(parent=nil, move_obj=nil) src

Prepares all children before calling prepare_object.


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