[Glade-users] Dialog box question




I created a window with few entry fields and a dialog box in Glade-2.
In my Python code, after I type into an entry field and tab out or click out, or press enter key, I am 
validating the input and display a dialog box if input is invalid. The dialog box has a label and OK btn. 
Obviously , I want the dialog box to stay on the screen until OK is pressed at which point, the focus should 
be back in the field that generated the error. I did similar thing in C, but now doing it in Python and it 
doesn't work properly. 
In my _focus_out handler, I have the following lines:
 
on_myFiled_focus_out_event(widget, data, wtree) :
  dialog = wtree.get_widget('myDialogBoxInGlade')
  dialog.run()   ## this is the line I get a complaint at
  dialog.hide()
  widget.grab_focus()
 
  ##more code here
  pass
 
When I run the project and type invalid input into a field and press tab, the dialog box is displayed, I 
press OK, the box goes way, focus goes to the invalid field. Then I tab again, and the program aborts with a 
msg:
GtkWarning: GtkEntry - did not receive focus-out-event. If you connect a handler to this signal, it must 
return FALSE so the entry gets the evnet as well
dialog.run()
Gtk-ERROR **: file gtkentry.c line 5287 (blink_cb): assertion failed: (GTK_WIDGET_HAS FOCUS (entry))
 
                                          
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20100927/c2d22fe3/attachment.html 




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