Re: validation in entry widget



From: "Mani Murugesan" <mmanim vsnl com>
>
> Hello,
>
> I want to validate the contents of the entry widget and if necessary to NOT
> allow focus out of that entry widget. But it is not possible to do this.
>
> I use gtk_entry_new() to create the widget.
> I capture the 'focus_out_event' with a signal handler.
> In that handler I validate and set the focus back with
> 'gtk_widget_grab_focus()'
>
> But the application quits.
>
> Under Windows, it is not recommended to set the focus back on the same
> control in its lost focus since the system supposedly is in an indeterminate
> state during that time. The solution is to post a user defined message and
> then do that focussing later.
>
> Is is the same here? Then how do I do the validation?

I don't know if the above reason is why it's not working for you.
If it is, however, you can add an idle function (g_idle_add())
is the focus_out_event callback, and then have that idle
function reset the focus. By that time, the focus should be
resolved, and you should be able to switch it back normally.

Ron Steinke



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