I can't get my filename returned

From: Date: Mon, 19 Jul 2004 21:58:02 +0000
Subject: I can't get my filename returned
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-4795@lists.php.net to get a copy of this message
Hello, I'm trying to make a simple texteditor , but now I'm kind of stuck at the following point I have my fileDialog that works , but I can't get the filename of it back to my basic window to be able to put the text of the opened file in the texteditor. I have my class FileDialog when you press the OK button of the fileselection you go to EndDialog where I copy $name = $this->FileDg->Get_Filename() ; when I do echo $name ; I see the filename so everything is oke than I put the name into a member of the class $this->bestand = $name; I did an echo of that var too and everything still oke but than when I try to access the var $this->bestand from my mainwindow class I get nothing but an empty string. Somebody Has an Idea? Thank you <?php /* $Id: hello.php,v 1.7 2002/12/04 17:31:50 fmk Exp $ */ if (!extension_loaded('gtk')) { dl( 'php_gtk.' . PHP_SHLIB_SUFFIX); } class mainwindow { var $textarea ; function delete_event() { return false; } function destroy() { Gtk::main_quit(); } function mainwindow(){ $window = &new GtkWindow(); $window->connect_object('destroy', array('Gtk', 'Main_quit')); $window->set_border_width(10); $window->set_usize(gdk::screen_width()-80,gdk::screen_height()-80); $window->set_title("Een simpele teksteditor"); $mainhbox = &new GtkHbox(); $this->textarea = &new GtkText(); $this->textarea->set_editable(1); $this->textarea->set_word_wrap(1); $scroll = &new GtkVScrollbar($textarea->vadj); $mainhbox->pack_start($scroll,false,false); $mainhbox->pack_start($this->textarea,true,true); $mainvbox = &new GtkVbox() ; $mainvbox->pack_start($this->Menu(),false,false); $mainvbox->pack_start($mainhbox); $window->add($mainvbox); $window->show_all(); } function OpenBestand(){ echo 'hier openen we een bestand'; $fs = &new FileDialog(); echo $fs->Geef(); } function test(){ echo "test"; } function Menu() { $menubar = &new GtkMenuBar(); $menuitem1 = &new GtkMenuItem("File"); $menubar->append($menuitem1); $submenu1 = &new GtkMenuItem("Open"); $submenu1->connect_object('activate',array(&$this,'OpenBestand')); $submenu2 = &new GtkMenuItem("Save"); $submenu3 = &new GtkMenuItem("Quit"); $menuitem1->connect_object('activate',array(&$this,'test')); $menuitem2 = &new GtkMenuItem("Edit"); $menubar->append($menuitem2); $submenu = &new GtkMenu; $submenu->append($submenu1); $submenu->append($submenu2); $submenu->append($submenu3); $menuitem1->set_submenu($submenu); return $menubar; } } class FileDialog { //public variabels var $bestand; var $pathname; //private variabels var $FileDg; function FileDialog(){ $this->FileDg = &new GtkFileSelection("Select a File"); $ok_button = $this->FileDg->ok_button; $ok_button->connect_object('clicked',array(&$this,'EndDialog',)); $cancel_button = $this->FileDg->cancel_button; $cancel_button->connect_object('clicked', array(&$this,'canceldialog')); $this->FileDg->show(); } function geef(){ echo $this->bestand; return $this->bestand ; } function EndDialog() { $name = $this->FileDg->Get_Filename(); $this->$bestand = $name; $this->FileDg->hide(); } function CancelDialog() { print("Cancel button clicked\n"); $this->FileDg->destroy(); } } /* Run the main loop. */ $app = new mainwindow(); Gtk::main(); ?>

« previous php.gtk.general (#4795) next »