 |
| View previous topic :: View next topic |
| Author |
Message |
beidlerj
Joined: 10 Feb 2006 Posts: 55 Location: Oregon, USA
|
Posted: Tue Oct 10, 2006 7:18 pm Post subject: Splash screen not splashing? |
|
|
Hi all,
I'm trying to make a splash screen that displays an image for 3 seconds (and nothing else) and then shows the main application window. When I run my code (below) it displays the main window the whole time, even though it shouldn't be shown until the splash screen is hidden. In addition, the main window appears ABOVE the splash screen, and the splash screen doesn't load the image! I can't see what's wrong with the code... could someone point me in the right direction? Sometimes you just need another pair of eyes to look at it when yours have been blinded to the mistake.
Thanks!
| Code: |
class ALCSplash extends GtkWindow
{
public function __construct()
{
parent::__construct();
$this->set_keep_above(true);
$this->set_decorated(false);
$this->set_position(Gtk::WIN_POS_CENTER);
$this->stuff();
$this->connect_simple_after('show', array($this, 'startMain'));
}
private function stuff()
{
$logo = GtkImage::new_from_file('./cherryLogo.jpg');
$this->add($logo);
}
public function start()
{
$this->show_all();
Gtk::main();
}
public function startMain()
{
echo "In startMain... sleeping";
sleep(4);
$this->hide();
$glade = new GladeXML('./GUI/gui.glade');
$glade->signal_autoconnect();
$window = $glade->get_widget("window");
$window->set_icon_from_file('icon.jpg');
$okButton = $glade->get_widget("okButton");
$folderButton = $glade->get_widget("folderButton");
$okButton->connect_simple("clicked", "processFolder", $folderButton);
$window->connect_simple("destroy", array("gtk", "main_quit"));
//$this->destroy();
//sleep(3);
$window->show_all();
}
}
/////////////////////////////////////
////////// Begin Main Code //////////
/////////////////////////////////////
if(!class_exists('gtk'))
{
die("Please check your php.ini to make sure the PHP-Gtk2 module is available.\r\n");
}
require_once("myScrolledDialog.inc");
require_once("myMessage.inc");
$splash = new ALCSplash();
$splash->start();
|
|
|
| Back to top |
|
 |
cohort
Joined: 07 Feb 2006 Posts: 47
|
Posted: Thu Oct 12, 2006 1:19 pm Post subject: Re: Splash screen not splashing? |
|
|
First off, drop this line.
Make a timer callout to do your splash hide/main show.
| Code: |
class splashedProg () {
function __construct {
...
$this->splashTimeout = Gtk::timeout_add(4000, array($this, "doKillSplash"));
}
...
function doKillSplash () {
$this->spash->hide();
$this->mainWindow->show_all();
Gtk::timeout_remove($this->splashTimeout);
}
}
|
|
|
| Back to top |
|
 |
beidlerj
Joined: 10 Feb 2006 Posts: 55 Location: Oregon, USA
|
Posted: Thu Oct 12, 2006 7:07 pm Post subject: |
|
|
Ah, that bit wasn't in the book!
Thanks, cohort, it works like a charm! |
|
| Back to top |
|
 |
|
|
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
|
|
 |