For my CMS, I've been making window classes that function from within one another. For example, my skill window class contains two window classes: one to display the skills on one half of the screen, and another to display the selected skill's statistics on the other half of the screen.
I have it set up so that I only need to declare the main skill window in order for both to appear (and likewise with disposing). However, I'm having trouble making 'set visible' and 'set active' to work properly.
For proper disposal, I use this code.
The helper windows are declared on initialization, and this destroys them on disposal. Works perfectly. However, the following code is what is giving me headaches.
I understand why this code doesn't work. Basically, by calling "self.visible = visibility" inside the function, I'm creating an endless recursion. The only solution I have come up with is to use the following code.
However, I consider this rather messy. I have to go through all instances of setting the skill window's visibility and call this "set_visibility" function, instead.
Is this the only option? Or might Ruby have some nifty solution (like it normally does )?
I have it set up so that I only need to declare the main skill window in order for both to appear (and likewise with disposing). However, I'm having trouble making 'set visible' and 'set active' to work properly.
For proper disposal, I use this code.
Code:
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
@helper_window1.dispose
@helper_window2.dispose
super
end
Code:
#--------------------------------------------------------------------------
# * Set Visibility
# visibility : state of window visibility (boolean)
#--------------------------------------------------------------------------
def visible=(visibility)
@helper_window1.visible = visibility
@helper_window2.visible = visibility
self.visible = visibility
end
Code:
#--------------------------------------------------------------------------
# * Set Visibility
# visibility : state of window visibility (boolean)
#--------------------------------------------------------------------------
def set_visibility(visibility)
@helper_window1.visible = visibility
@helper_window2.visible = visibility
self.visible = visibility
end
Is this the only option? Or might Ruby have some nifty solution (like it normally does )?