Newbie Question - How to wire up Events to methods?

3 messages Options
Embed this post
Permalink
dciphercomputing

Newbie Question - How to wire up Events to methods?

Reply Threaded More More options
Print post
Permalink
Hi

I have created a GUI in EiffelBuild and for test purposes I selected the
"pointer_enters_action" and called my event on_widget_enter.  Now I am wondering how this should be coded.  I tried the following:

feature {NONE} -- Implementation

        on_widget_enter is
                do
                        bar_status.msg_1.set_text("Hi There...")
                        l_ev_label_2.set_text("Testing...")
                end
end

but I never see the message displayed when the pointer enters a widget so I am wondering how I should correctly connect an event with a method.

Thanks,
Simon


larryliuming

Re: Newbie Question - How to wire up Events to methods?

Reply Threaded More More options
Print post
Permalink
Hi, Simon,

I *guess* maybe you register `pointer_enter_action' on a widget container (such as EV_VERTICAL_BOX or...), and the container filled with a child widget. So when pointer enters your widget container, actually the `pointer_enter_actions' of child widget will be called since the child widget occupies all spaces of the widget container. If you try to register the `pointer_enter_action' on the child widget, it should works.

I just tested the EiffelBuild comes with Eiffel Studio 6.5.8.524 GPL Edition windows version. The `pointer_enter_actions' works.

Hope it helps.


dciphercomputing

Re: Newbie Question - How to wire up Events to methods?

Reply Threaded More More options
Print post
Permalink
Hi

Yes that does help.  I did some experimenting before reading your post and discovered that it was not firing because the widgets were nested several levels deep.  Once I registered the on_widget_enter with the actual widget it worked correctly.

The reason for all these questions is that I come from a Visual FoxPro OOP background where things are done quite differently and so I am slowly adjusting to the Eiffel way.  In VFP you cannot simply access a widget using its name you must always access it using the containership relative to where your calling code is located.  So there are a lot of "This.Parent.Parent.pageframe1.page2.mywidget" type references in your code as well as the fact that the method responding to an event is located in the widget itself so it took me a little while to see where the registering of the event handler took place but I got it now and it works just fine.

Now I have to learn how to get data from a table and display it in a widget etc.

Thanks,
Simon


--- In [hidden email], "larryliuming" <larryliuming@...> wrote:
>
> Hi, Simon,
>
> I *guess* maybe you register `pointer_enter_action' on a widget container (such as EV_VERTICAL_BOX or...), and the container filled with a child widget. So when pointer enters your widget container, actually the `pointer_enter_actions' of child widget will be called since the child widget occupies all spaces of the widget container. If you try to register the `pointer_enter_action' on the child widget, it should works.
>
> I just tested the EiffelBuild comes with Eiffel Studio 6.5.8.524 GPL Edition windows version. The `pointer_enter_actions' works.
>
> Hope it helps.
>