# Need some help with a text control event

**URL:** <https://www.ruby-forum.com/t/need-some-help-with-a-text-control-event/183055>\
**Category:** wxRuby\
**Created:** [February 7, 2010, 4:49am UTC](https://www.ruby-forum.com/t/need-some-help-with-a-text-control-event/183055 "2010-02-07T04:49:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elricstorm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/da6949/32.png) [@elricstorm](https://www.ruby-forum.com/u/elricstorm)\
**Post date:** [February 7, 2010, 4:49am UTC](https://www.ruby-forum.com/t/need-some-help-with-a-text-control-event/183055/1 "2010-02-07T04:49:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![elricstorm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/da6949/32.png) [@elricstorm](https://www.ruby-forum.com/u/elricstorm)\
**Post date:** [February 7, 2010, 4:13pm UTC](https://www.ruby-forum.com/t/need-some-help-with-a-text-control-event/183055/2 "2010-02-07T16:13:42Z")

</div>

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.
