Forum: wxRuby Need some help with a text control event

Posted by Alpha Blue (elricstorm)
on 2010-02-07 04:49
If you have a static text control:

@static_text_control

.. which extends into a module:

module SomeModule
  def some_event(label)
    self.set_label(label)
  end
end

and you are firing off events from other text controls using:

@static_text_control.some_event("some updated text here")

.. the above works fine..

But, how do you force the same method to fire from a non-text control
event?

def some_custom_method
  @static_text_control.some_event("some new label")
end

@static_text_control is now nil:NilClass..

My issue is how to mimic a static text control update from another
method that is not a text control, but more of a string variable.  I've
tried many different things but nothing has worked.  I could use some
help.

The @static_text_control will be holding approx. 8 separate and distinct
labels.  Right now I have it processing 4 separate labels fine and
without issues.  The problem I have now is the next 4 labels are just
going to be string variables and I don't know how to force that method
to notice and update them, or how to call a particular event from a
non-text control.
Posted by Alpha Blue (elricstorm)
on 2010-02-07 16:13
Nevermind, as always, with a little patience and resolve, I figured it 
out.

The object instance variable was being called from the extended module 
and not from the public instance methods.  Therefore, it could not be 
recognized.  I just created a dual method call on the block itself:

evt_list_item_right_click(@list_sites.get_id()) {|event|
    @list_sites.on_item_rightclicked(event)
    @builder_text.update_label
    }

So, the list control which manages a right click event that calls a 
popup menu still functions and when the person clicks on the popup menu, 
the update level method is called on the builder text object correctly.

I hope this helps someone else out down the road.

Take care.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.