gnope php gtk gui gnope.org  

Coding a splash screen

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    gnope.org Forum Index -> PHP GTK2 Beginners
View previous topic :: View next topic  
Author Message
AlicanC



Joined: 26 Oct 2008
Posts: 1

PostPosted: Sun Oct 26, 2008 9:07 am    Post subject: Coding a splash screen Reply with quote

I want to add a splash screen to my app. I did everything, but I couldn't find a way to show it properly. I can show the main window with Gtk::main(), but I need to display pre-launch progress in the splash so calling Gtk::main() prevents me doing the stuff.

I need a flow like this:
-Create and show splash
-Change splash progress to "Connecting the server..."
-Connect to the server
-Show an error dialog if it can't connect (This isn't fatal so splash will still be displayed)
-Change splash progress to "Loading settings..."
-Load settings
-Change splash progress to "Starting..."
-Create main window at the background
-Destroy splash
-Gtk::main()

Thanks so much for your replies.
Back to top
clange



Joined: 24 Jan 2006
Posts: 14

PostPosted: Thu Nov 13, 2008 3:10 am    Post subject: Reply with quote

Here is a short example, at this moment i don't know how i can set the splash always on top.


mfg clange

Code:

<?PHP
declare(ticks=1);

function ticktack() {
   while(Gtk::events_pending()) {
      Gtk::main_iteration_do(false);
   }
}

register_tick_function("ticktack");


class splash extends GtkWindow {
   private $Label;

   function __construct() {
      parent::__construct();
      $this->Label = new GtkLabel("Hi I'm the Splash");
      $this->add($this->Label);
      $this->set_modal(true);
      $this->set_keep_below(true);
      $this->show_all();
   }

   function set_text($text) {
      $this->Label->set_text($text);
   }
};



$splash = new splash();

for($i=0;$i<10;$i++) { // server stuff
   usleep(100000);
}
$splash->set_text("Connecting the server...");

for($i=0;$i<10;$i++) { // Loading stuff
   usleep(100000);
}

$splash->set_text("Loading settings...");
$splash->set_focus(true);

for($i=0;$i<10;$i++) { // ....
   usleep(100000);
}



$splash->hide();
$win = new GtkWindow();
$win->show();

gtk::main();
?>
Back to top
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    gnope.org Forum Index -> PHP GTK2 Beginners All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group
Templates enhanced by DigiWiki. Hosting by Tradebit.