Re: Open the same window when i push a button in a gtkwindow

From: Date: Thu, 05 Aug 2004 12:30:09 +0000
Subject: Re: Open the same window when i push a button in a gtkwindow
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-4932@lists.php.net to get a copy of this message
I find it is easier to track widgets and keep a record of their state using OOP. Below is a quick mock up of a class that you can use as a guide. The newWindow method will check for the second window and create it if needed. Then it will check to see if the window is shown or hidden by checking secWinVisible. Which ever it is, it get set to the opposite. <?php class App { var $primaryWindow; var $secondaryWindow; var $button; var $secWinVisible = false; // All your other members here function App() { // Create your primary window , button etc. // Connect the button to a method for controlling the second window. $this->button->connect('clicked', array(&$this, 'newWindow')); } function newWindow() {
    // Create the secondary window if needed.
    if (!isset($this->secondaryWindow)) {
      $this->secondaryWindow =& new GtkWindow;
    }
    // Hide the secondary window if it is visisble.
    if ($this->secWinVisible) {
      $this->secondaryWindow->hide();
      $this->secWinVisible = false;
    } else {
      // Window is hidden show it.
      $this->secondaryWindow->show();
      $this->secWinVisible = true;
    }
} // Continue with class definition here } ?> Scott Mattocks

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