Forum: IronRuby How to acces the Application's control in Iron Ruby script

Bc8681d0fcbb7b45710b92493d234551?d=identicon&s=25 Sridharan Sivamurugan (sriyas)
on 2011-05-04 08:23
Hi All,

I'm trying to do the same in IronRuby that I have done in IronPython
script, but its throwing some exception as undefine constant. I dont
know how to achieve it Iron Ruby.

In Puthon I will access the control that is placed in the applicatoin
and set its source in the Script itself. But in Ruby I dont know how to
do it.
Can any one help me to achieve this.

-Sri.

Python Code :

List = Application.FindName('MyListBox')
List.ItemsSource = MyObject

While using the same in IronRuby its throwing exception as undefined
constant "Application".
C94afbb820c49a847b3b1f5244178f82?d=identicon&s=25 Eduardo Blumenfeld (eblumenfeld)
on 2011-05-04 14:11
Hi Sri,

I assume that you are trying to work from a wpf application...
in Ruby, variables that start in upper case are interpreted as
constants...

Did you try?

list = self.FindName('MyListBox')
list.ItemsSource = myObject

(note the lower case names)...

Regards,

Eduardo Blumenfeld


Sridharan Sivamurugan wrote in post #996532:
> Hi All,
>
> I'm trying to do the same in IronRuby that I have done in IronPython
> script, but its throwing some exception as undefine constant. I dont
> know how to achieve it Iron Ruby.
>
> In Puthon I will access the control that is placed in the applicatoin
> and set its source in the Script itself. But in Ruby I dont know how to
> do it.
> Can any one help me to achieve this.
>
> -Sri.
>
> Python Code :
>
> List = Application.FindName('MyListBox')
> List.ItemsSource = MyObject
>
> While using the same in IronRuby its throwing exception as undefined
> constant "Application".
This topic is locked and can not be replied to.