Il giorno sab, 14/08/2010 alle 16.55 +0100, Andrew ha scritto:
> On 09/08/10 10:17, Imre Horvath wrote:
> > Hi!
> > 
> > I've got a dialog, with Ok and Cancel buttons in the actionarea (I'm
> > using gtkbuilder)
> > I want to validate the dialog data. I write an action handler for the Ok
> > button that validates it, but i need the dialog remain open when
> > validation fails. How can i do this?
> > 
> > Thanks in advance:
> > Imre Horvath
> > 
> > _______________________________________________
> > pygtk mailing list   [email protected]
> > http://www.daa.com.au/mailman/listinfo/pygtk
> > Read the PyGTK FAQ: http://faq.pygtk.org/
> 
> Hi Imre,
> 
> I assume you are using dialog.run(), this will hide the dialog when a
> user clicks an actionarea button

Uhm... as far as I know that's not true...

> and so will not keep the dialog open.
> Instead you could use dialog.show_all() and hide the dialog in a
> callback of one of the buttons.


> 
> Does this make sense? If not please could you post your code?
> 


I think there are two clean approaches (I used both, in different
cases):
1) the dialog is ran in a loop, which always run()s it again when the
data validity check is no passed (possibly after showing an error
message)
2) the buttons are initially unsensitive and a function, which runs
several times per second and checks the validity, takes care of setting
them (un)sensitive

Pietro

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to