|
||||||||
Q: I am getting the following error and don’t know what’s causing it:
Exception `ArgumentError' at .../locana/locana.rb:467 - Ltextbox'object_name'.initialize(:object_name,nil) - attribute 'nil' must be a symbol
A: One of the attributes used to create an object is not a symbol. You need to
look at the call stack for the first entry that is not in locana.rb for the
location of the line of code causing the error. The following example will
cause this error because sticky should be :sticky and after should be :after.
textbox(:myname, sticky=>:new, after=>:prev)
Q: I made a change to objects (added objects, removed objects, changed the :sticky
attribute in one or more object) in a window but the size of the window did not automatically adjust for the changes.
A: Run applets/config_editor.rb and look for your window name. It is likely
Locana stored the position and or size of the window in the config file. If you find you window name with :pos attribute, just remove that item from the config file and it will work as expected. Locana automatically remembers the new size and position of windows when they are moved and resized and the new position is used to open the window from that time forward. You can disable this feature for a given window by setting the :auto_save attribute to false. You can turn this off for all windows by setting the global Locana::gAutoSavePos to false or you can redefine the auto_save method in the Lwindow object to return false.
Q: The default font is too small, too large, or just undesirable, how can I change it for my entire applet? A: Please keep in mind that the following suggestions may override the users
system font which may be undesirable for some users. In MS Windows the
default font is the system font as set up in the control panel.
Here are several options (in order optimal suggestion to worst suggestion):
* Use a theme and set the following in your theme:
:gDefaultFont => [:times, 14], # Set the default or base font for all objects that don't provide a font
* Set the global variable :gDefaultFont => [:times, 14] in your applets before opening any windows.
* Redefine the default_font_name() and/or default_font_size() to return the desired
values in the Locana_gui module for each GUI binding. The nice thing about this
approach is that you can change the default font for Tk users without affecting
MS Windows users.
* Redefine the Lfont.default_font_name and/or Lfont.default_font_size() methods
contained in the Lfont class in l_others.rb to return the font and size you want to use.
These questions are specific to the internals of Locana:
Q: What’s the difference between @oattr and why is Lobject based on the Hash object? A: Every object has two Hashes of attributes @oattr and self(a Hash object).
@oattr is short for object attributes and contains all attributes the have been explicitly assigned to the object. It includes all event bindings as well. The @oattr Hash gets saved when saving the object to a file. Self, on the other hand, is a working set of attributes. It contains all explicitly defined attributes for the object (@oattr) and included any attributes that inherited from parents and themes. Self determines the value of the attribute that an object is currently using.
Q: What’s the difference between myObject.value = 1 and myObject[:value] = 1. A: myObject.value = 1 assigns the value to myObject. Locana will automatically
repaint the myObject if needed to render the change in the display. The value is added to self as if myObject[:value] called and is also added the myObject.oattr Hash. On the other hand, myObject[:value], only adds the new value to the objects Hash (Hash of working attributes). The value is not added to @oattr and the change will not cause a repaint of the object. I use the latter technique for moving internally attributes quickly in and out of objects while Locana is running.
Q: What’s up with ‘l_’, ‘lg_’, ‘_’, and ‘on_’ prefix on methods inside Locana? A: Locana objects have many methods and keeping them all unique and be challenging.
Since object names and object attributes become methods for the objects, it is important that you keep your object names and any methods you add to your objects unique. You also need to take into consideration any future attributes that could get added later. In order to reduce the possibility of duplicating a method, I prefix: * all methods and instance variables internal to Locana with 'l_' * all methods and instance variables specific to a GUI binding with 'lg_' * all internally used attributes with '_' * all event bindings with 'on_' You can find a more detailed description about methods in l_object.rb.
| 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.