[Glade-users] simuler clic sur GtkFileChooserButton



Alexey Kurochkin a ?crit :
On Wed, 2009-08-26 at 15:23 +0200, Frucot Jean-Louis wrote:
  
Newbie in Pygtk, i want to emulate clic on "GtkFileChooserButton"

J'explique un peu plus. Dans une barre de menu, j'ai un item "Ouvrir", 
en-dessous dans la fen?tre, j'ai un bouton qui permet d'ouvrir un 
"FileChooser" Je voudrais en cliquant sur "Ouvrir" simuler le clic sur 
ce fameux bouton.
I explain a little bit more : in a menubar i have an item "Open" 
somewhere in the window i have a GtkFileChooserButton. By selecting 
"Open" i want to emulate a clic on this famous Button !!!

    

In general, since you have a menu item for that, I'd suggest you to get
rid of the GtkFileChooserButton altogether and show a
GtkFileChooserDialog instead whenever needed. It should be enough to
display the current file name in the title bar as most conventional
programs do.

But if you insist, I can give you sort of hackish solution to your
problem. First you need to send "mnemonic-activate" on your file chooser
button widget. That won't really activate anything, but it will put your
"famous" internal button into focus. Then you can get this focused
widget from your main window and do whatever you please, or simply
activate it directly. I can't help you with python, but in C it would be
something like this:

gtk_widget_mnemonic_activate (GTK_WIDGET (myFileChooserButton), FALSE);
gtk_window_activate_focus (GTK_WINDOW (myMainWindow));


  
It works fine with (in python):
        self.myFileChooserButton.emit("mnemonic-activate",False)
        self.myMainWindow.emit("activate-focus")

thanks

-- 
Jean-Louis Frucot
mail frucot.jeanlouis at free.fr

http://gnusquetaires.org
http://gnusquetaires.org/forums/





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