gnope php gtk gui gnope.org  

Getting signal from GtkFileChooserButton

 
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners
View previous topic :: View next topic  
Author Message
stigur



Joined: 20 Jul 2006
Posts: 6

PostPosted: Thu Jul 20, 2006 5:20 pm    Post subject: Getting signal from GtkFileChooserButton Reply with quote

Hi,

I am trying to get to know PHP-GTK.
How do I get at signal from GtkFileChooserButton?
I can do it with a regular button, but not with this one.
No signals are listed in the documentation.

This is probably a more general issue that I am looking at, clearly, there is some fundamental mechanism that I don't understand. Can anyone point me in the right direction? Even a few keywords might do the trick.

Cheers and thanks,
Stigur
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Thu Jul 20, 2006 5:48 pm    Post subject: Reply with quote

What do you mean with "signal"? Can you give some example what you want to achive?
Back to top
stigur



Joined: 20 Jul 2006
Posts: 6

PostPosted: Fri Jul 21, 2006 9:57 am    Post subject: Reply with quote

Well, a button will activate the 'clicked'-signal, when it is clicked by the user. But which signal does the GtkFileChooserButton envoke? I need to activate a function as soon as the user has picked a file.

Cheers,
Stig
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Fri Jul 21, 2006 10:36 am    Post subject: Reply with quote

GtkFileChooserWidget extends GtkVBox. This means, you can access all the children with normal container methods. I suggest you use Dev_GuiInspector to inspect the widget tree of a filechooser widget.

That way you can reach the button, or even the file list and connect your signals there.
Back to top
stigur



Joined: 20 Jul 2006
Posts: 6

PostPosted: Fri Jul 21, 2006 11:37 am    Post subject: Reply with quote

<?php
$file_widget = new GtkFileChooserWidget(Gtk::FILE_CHOOSER_ACTION_OPEN);

require_once 'guiinspector/GuiInspector.php';
$gi = new Dev_GuiInspector($file_widget);

Gtk::main();
?>

Hi again,

I used the program you suggested with the code above and my dos-prompt went berserk with:
(php.exe:1996): GLib-GObject-CRITICAL **: g_type_get_qdata: assertion `node != NULL' failed
repeating the message in an endless loop.

Cheers,
Stigur
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Fri Jul 21, 2006 11:49 am    Post subject: Reply with quote

Sorry for that. Until I fixed Dev_GuiInspector, you have to do this on your own with get_children() and so.
Back to top
stigur



Joined: 20 Jul 2006
Posts: 6

PostPosted: Fri Jul 21, 2006 11:56 am    Post subject: Reply with quote

OK,

Thank you for your help!

Cheers,
Stigur
Back to top
stigur



Joined: 20 Jul 2006
Posts: 6

PostPosted: Fri Jul 21, 2006 12:27 pm    Post subject: Reply with quote

Hi,

When using get_children, I get the same result, but when using the deprecated function children, it works.
So maybe get_children is broken and if you are using it in Dev_GuiInspector, maybe the function and not your program is broken.

Thought the information could be of use to you.

Cheers,
Stig
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Fri Jul 21, 2006 1:10 pm    Post subject: Reply with quote

It doesn't work for me here, independent of what I use. children() is merely an alias for get_children().
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Fri Jul 21, 2006 1:20 pm    Post subject: Reply with quote

I reported a bug on gnome:
http://bugzilla.gnome.org/show_bug.cgi?id=348235

Let's see what they say.
Back to top
stigur



Joined: 20 Jul 2006
Posts: 6

PostPosted: Fri Jul 21, 2006 2:05 pm    Post subject: Reply with quote

I'll dare on more question:

Can you show me the correct syntax for connecting to the "sub"-object?
(GtkComboBox is listed in the array produced by children() and seems to be the one sending the signal ('changed'))
I do :

$choose_file = new GtkFileChooserButton('Open File', Gtk::FILE_CHOOSER_ACTION_OPEN);
$choose_button = $choose_file->GtkComboBox;

$choose_button->connect_simple('changed', array ($this, 'do_something'));

I was inspired by looking in the FAQ, but the last line fails, what to do?

Cheers,
Stigur
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Fri Jul 21, 2006 2:17 pm    Post subject: Reply with quote

I doubt that "GtkComboBox" is a widget, it looks like a classname.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Templates enhanced by DigiWiki. Hosting by Tradebit.