Newbie Question - How to reference widgets in GUI Application.

5 messages Options
Embed this post
Permalink
dciphercomputing

Newbie Question - How to reference widgets in GUI Application.

Reply Threaded More More options
Print post
Permalink
Hi

On a form I want to display the name of the widget the pointer enters.  This is purely a learning exercise because I want to learn about how events work in Eiffel and I want to learn how to reference widgets etc.

So how do I reference widgets in code?  Is there a "this" or "self" keyword to start the reference such as this.parent.my_container.my_textbox.caption?

I am also interested in finding some sample code showing how events are added in code once you build the GUI with EiffelBuild.

Thanks,
Simon

Colin LeMahieu

Re: Newbie Question - How to reference widgets in GUI Application.

Reply Threaded More More options
Print post
Permalink
Current is the Eiffel equivalent to "this"

On Fri, Sep 11, 2009 at 12:10 PM, dciphercomputing <
[hidden email]> wrote:

>
>
> Hi
>
> On a form I want to display the name of the widget the pointer enters. This
> is purely a learning exercise because I want to learn about how events work
> in Eiffel and I want to learn how to reference widgets etc.
>
> So how do I reference widgets in code? Is there a "this" or "self" keyword
> to start the reference such as this.parent.my_container.my_textbox.caption?
>
> I am also interested in finding some sample code showing how events are
> added in code once you build the GUI with EiffelBuild.
>
> Thanks,
> Simon
>
>  
>


[Non-text portions of this message have been removed]

Peter Gummer-2

Re: Newbie Question - How to reference widgets in GUI Application.

Reply Threaded More More options
Print post
Permalink
Colin LeMahieu wrote:

> Current is the Eiffel equivalent to "this"

True, but you would not write 'Current.tools_menu' to reference the  
window's Tools menu. You would simply write:

        tools_menu

It is extremely rare in Eiffel to mention 'Current' explicitly as the  
target of call. The same is true in many other languages, actually; in  
C#, for example, I would never write 'this.ToolsMenu', except in the  
very rare case where there might be ambiguity; I would simply write  
'ToolsMenu'. Because Eiffel's language rules prevent any such  
ambiguity, you almost never see anyone write 'Current' followed by a  
dot.

- Peter Gummer
dciphercomputing

Re: Newbie Question - How to reference widgets in GUI Application.

Reply Threaded More More options
Print post
Permalink
Does this mean that ever widget no matter how deep in the heirarchy can simply be referenced by its name?  So if this is true I then I assume I can stop thinking in terms of an object heirarchy when trying to reference widgets.

Simon

--- In [hidden email], Peter Gummer <p-gummer@...> wrote:

>
> Colin LeMahieu wrote:
>
> > Current is the Eiffel equivalent to "this"
>
> True, but you would not write 'Current.tools_menu' to reference the  
> window's Tools menu. You would simply write:
>
> tools_menu
>
> It is extremely rare in Eiffel to mention 'Current' explicitly as the  
> target of call. The same is true in many other languages, actually; in  
> C#, for example, I would never write 'this.ToolsMenu', except in the  
> very rare case where there might be ambiguity; I would simply write  
> 'ToolsMenu'. Because Eiffel's language rules prevent any such  
> ambiguity, you almost never see anyone write 'Current' followed by a  
> dot.
>
> - Peter Gummer
>


Peter Gummer-2

Re: Re: Newbie Question - How to reference widgets in GUI Application.

Reply Threaded More More options
Print post
Permalink
dciphercomputing wrote:

> Does this mean that ever widget no matter how deep in the heirarchy  
> can simply be referenced by its name?

Yes. that's right. The same as any other object-oriented language (or  
at least the ones that I know).

- Peter Gummer