| View previous topic :: View next topic |
| Author |
Message |
stigur
Joined: 20 Jul 2006 Posts: 6
|
Posted: Thu Jul 20, 2006 5:20 pm Post subject: Getting signal from GtkFileChooserButton |
|
|
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
|
Posted: Thu Jul 20, 2006 5:48 pm Post subject: |
|
|
| 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
|
Posted: Fri Jul 21, 2006 9:57 am Post subject: |
|
|
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
|
Posted: Fri Jul 21, 2006 10:36 am Post subject: |
|
|
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
|
Posted: Fri Jul 21, 2006 11:37 am Post subject: |
|
|
<?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
|
Posted: Fri Jul 21, 2006 11:49 am Post subject: |
|
|
| 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
|
Posted: Fri Jul 21, 2006 11:56 am Post subject: |
|
|
OK,
Thank you for your help!
Cheers,
Stigur |
|
| Back to top |
|
 |
stigur
Joined: 20 Jul 2006 Posts: 6
|
Posted: Fri Jul 21, 2006 12:27 pm Post subject: |
|
|
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
|
Posted: Fri Jul 21, 2006 1:10 pm Post subject: |
|
|
| 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
|
|
| Back to top |
|
 |
stigur
Joined: 20 Jul 2006 Posts: 6
|
Posted: Fri Jul 21, 2006 2:05 pm Post subject: |
|
|
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
|
Posted: Fri Jul 21, 2006 2:17 pm Post subject: |
|
|
| I doubt that "GtkComboBox" is a widget, it looks like a classname. |
|
| Back to top |
|
 |
|