Re: [pygtk] Default button

2000-05-31 Thread James Henstridge

On Wed, 31 May 2000, Luca Minuti wrote:

> I have a simple form with a GtkEntry and two button (ok/cancel).
> I want that the ok button is the default button (activate with the enter
> key) and that the Entry has the focus when the form is showed.
> 
> I write this code:
> 
> file_entry.grab_focus()
> ok_button.set_flags(CAN_DEFAULT)
> ok_button.grab_default()
> 
> But if the "file_entry" has the focus the ok_button isn't the default.
> 
> Someone can help me?

If you want some action to be performed when enter is pressed in the
entry, connect to its activate signal.  Something like this:
  file_entry.connect("activate", whatever_handler_you_used_for_ok)

Or something like this:
  def handle_activate(entry):
ok_button.clicked()
  file_entry.connect("activate", handle_activate)

> 
> Thanks.
> 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] Default button

2000-05-31 Thread Luca Minuti

I have a simple form with a GtkEntry and two button (ok/cancel).
I want that the ok button is the default button (activate with the enter
key) and that the Entry has the focus when the form is showed.

I write this code:

file_entry.grab_focus()
ok_button.set_flags(CAN_DEFAULT)
ok_button.grab_default()

But if the "file_entry" has the focus the ok_button isn't the default.

Someone can help me?

Thanks.

-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]