# Is it possible to get widget from it's id

**URL:** <https://www.ruby-forum.com/t/is-it-possible-to-get-widget-from-its-id/180183>\
**Category:** wxRuby\
**Created:** [December 14, 2009, 9:36am UTC](https://www.ruby-forum.com/t/is-it-possible-to-get-widget-from-its-id/180183 "2009-12-14T09:36:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hendra\_kusuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@hendra\_kusuma](https://www.ruby-forum.com/u/hendra_kusuma)\
**Post date:** [December 14, 2009, 9:36am UTC](https://www.ruby-forum.com/t/is-it-possible-to-get-widget-from-its-id/180183/1 "2009-12-14T09:36:36Z")

</div>

Dear all,

is it possible to get widget from its id?

to be clear, what I intent to do is something like below

def widget\_by\_id\_do\_something(widget\_id)  
widget(widget\_id).do\_something  
end

---

<div class="post-metadata">

**Author:** ![hendra\_kusuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@hendra\_kusuma](https://www.ruby-forum.com/u/hendra_kusuma)\
**Post date:** [December 14, 2009, 8:15pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-get-widget-from-its-id/180183/2 "2009-12-14T20:15:09Z")

</div>

hi

hendra kusuma wrote:

> is it possible to get widget from its id?

Yes, Wx:Window.find\_by\_id

[http://wxruby.rubyforge.org/doc/window.html#Window\_findwindowbyid](http://wxruby.rubyforge.org/doc/window.html#Window_findwindowbyid)

It’s documented as an instance method, but I think it’s a class method:

win = Wx::Window.find\_by\_id(ID\_FOO)

alex

---

<div class="post-metadata">

**Author:** ![hendra\_kusuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@hendra\_kusuma](https://www.ruby-forum.com/u/hendra_kusuma)\
**Post date:** [December 15, 2009, 5:51am UTC](https://www.ruby-forum.com/t/is-it-possible-to-get-widget-from-its-id/180183/3 "2009-12-15T05:51:41Z")

</div>

On Tue, Dec 15, 2009 at 2:14 AM, Alex F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [http://wxruby.rubyforge.org/doc/window.html#Window\_findwindowbyid](http://wxruby.rubyforge.org/doc/window.html#Window_findwindowbyid)
> 
> It’s documented as an instance method, but I think it’s a class method:
> 
> win = Wx::Window.find\_by\_id(ID\_FOO)
> 
> alex

Whoa, cool  
Thanks man
