| View previous topic :: View next topic |
| Author |
Message |
AlicanC
Joined: 26 Oct 2008 Posts: 1
|
Posted: Sun Oct 26, 2008 9:07 am Post subject: Coding a splash screen |
|
|
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
|
Posted: Thu Nov 13, 2008 3:10 am Post subject: |
|
|
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 |
|
 |
|