#50525 [Opn->Fbk]: FileSelection Complete Failure
[email protected] Fri, 18 Dec 2009 20:37:26 GMT
| Newsgroups | php.gtk.dev |
|---|---|
| Message-ID | <[email protected]> |
ID: 50525 Updated by: [email protected] Reported By: chezmmd at gmail dot com -Status: Open +Status: Feedback Bug Type: PHP-GTK related Operating System: WinXP PHP Version: 5.2.12 New Comment: GtkFileSelection has been deprecated since Gtk 2.12, so the 2.0.1 release of PHP-GTK does not yet mark it deprecated. However the example code for me is working perfectly. Run your script and then in the selection box hit the tab key Notice how only files/folders that match *.txt are now shown? You can probably simulate the keypress in your code to make the filter action transparent to the user. Previous Comments: ------------------------------------------------------------------------ [2009-12-18 20:15:25] chezmmd at gmail dot com GtkFileSelection isn't marked as deprecated...??? ------------------------------------------------------------------------ [2009-12-18 20:06:43] [email protected] This is a problem in the gtk libraries themselves, not in the PHP wrapper. PHP just calls the underlying C method GtkFileSelection is deprecated as well Try using GtkFileChooserDialog with the set_filter method instead ------------------------------------------------------------------------ [2009-12-18 19:58:33] chezmmd at gmail dot com Description: ------------ Cannot get GtkFileSelection->complete to work, using current release. Took online Manual example of object construction, and added a complete stmt. Results invalid. Reproduce code: --------------- <?php //Creating and initialising the file selection prompt $filePrompt = new GtkFileSelection('GtkFileSelection Demo'); $filePrompt->connect_simple( 'destroy', array('Gtk', 'main_quit') ); $filePrompt->complete("*.txt"); //Adding a quit button that destroys the prompt $filePrompt->cancel_button->set_label('Quit'); $filePrompt->cancel_button->connect_simple( 'clicked', array($filePrompt, 'destroy') ); //Add an OK button that displays the file selected on click $filePrompt->ok_button->set_label('Show the file'); $filePrompt->ok_button->connect('clicked', 'showFile'); //Callback function that displays the file name function showFile($okbutton) { $filePrompt = $okbutton->get_toplevel(); $fileName = $filePrompt->get_filename(); $message = new GtkMessageDialog( null, 0, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, 'You selected: ' . $fileName ); $message->run(); $message->destroy(); } //Show the prompt and start the main loop $filePrompt->show(); Gtk::main(); ?> Expected result: ---------------- You should see only txt extension files in results window. Actual result: -------------- You get all files listed ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50525&edit=1