Re: Focus Events



Murray,

Thanks for the helpful links, I have move past the issue I was having!

Mahalo,
Mike

On Fri, Jul 23, 2010 at 1:49 PM, Murray Cumming <murrayc murrayc com> wrote:
On Fri, 2010-07-23 at 07:09 -0600, Michael White wrote:
> Hi All,
>
> I have a few questions with the focus callback that I'm hoping someone
> can help me out with.
>
> I have my code connecting to the signal_focus_out_event () for my
> entry widget. when i move the keyboard focus somewhere else (by
> clicking somewhere or pressing tab), i see my callback gets called
> which is great, but here are my questions.
>
> 1.) the prototype of the callback is: bool on_my_focus_out_event(
> GdkEventFocus* event) and i was wondering what the return value
> signifies?

That is explained here:
http://library.gnome.org/devel/gtkmm-tutorial/stable/sec-xeventsignals.html.en

>  at first, i thought returning true or false would let the focus be
> lost or keep the focus there. for example, if my entry widget only
> could contain a value between 0 and 10, i could keep the user in the
> same entry widget until a valid value was inputted. however, after
> doing testing, returning true and false seemed to have done the same
> thing.
>
> 2.) for the same callback, there is a GdkEventFocus pointer that is
> passed in. from looking at the documentation, I'm still confused. i
> want to know how i can get the widget that just lost focus? for
> example, i want to use the same callback to handle the losing of focus
> on 3 entry widgets but validate them differently.

You could pass the Gtk::Widget* via sigc::bind():
http://library.gnome.org/devel/gtkmm-tutorial/stable/sec-binding-extra-arguments.html.en

>  to validate the data, i need to obtain the text from the appropriate
> entry widget.
>
> Thanks everyone! since I'm a newbie to gtkmm, it's probably something
> I'm doing incorrectly...



--
murrayc murrayc com
www.murrayc.com
www.openismus.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]