View previous topic :: View next topic |
Author |
Message |
Keyframe
Joined: 04 Nov 2007 Posts: 9
|
Posted: Fri Apr 25, 2008 7:47 am Post subject: form as a splash screen? |
|
|
I'm not sure about this, but shouldn't the following code work?
splash.d
Code: |
/*
Generated by Entice Designer
Entice Designer written by Christopher E. Miller
www.dprogramming.com/entice.php
*/
module splash;
import dfl.all;
class Splash: dfl.form.Form
{
this()
{
initializeSplash();
//@ Other Splash initialization code here.
}
private void initializeSplash()
{
// Do not manually modify this function.
//~Entice Designer 0.8.5.02 code begins here.
//~DFL Form
backColor = dfl.all.Color(0, 0, 0);
controlBox = false;
formBorderStyle = dfl.all.FormBorderStyle.NONE;
opacity = 0.65;
showInTaskbar = false;
startPosition = dfl.all.FormStartPosition.CENTER_SCREEN;
clientSize = dfl.all.Size(640, 360);
//~Entice Designer 0.8.5.02 code ends here.
}
}
|
and application splash_test.d
Code: |
module splash_test;
import tango.core.Thread;
import dfl.all;
import splash;
int main()
{
Form myForm2;
myForm2 = new Splash;
myForm2.showDialog();
Thread.sleep(5);
myForm2.close();
// ----------------------------
Form myForm;
Label myLabel;
myForm = new Form;
myForm.text = "DFL Test";
myLabel = new Label;
myLabel.font = new Font("Verdana", 14f);
myLabel.text = "test";
myLabel.location = Point(15, 15);
myLabel.autoSize = true;
myLabel.parent = myForm;
Application.run(myForm);
return 0;
}
|
evidently, I can't close first form, only with alt+f4, and I wan't to use it as a splash screen, to display for several seconds and auto close and proceed with application as usual.
edit: nm, I was stupid and using showDialog instead of show().. however I wonder if this is the way to make splash screen? Any better ideas? Since now I have a waiting hourglass when I do thread.sleep - and I don't wan't that |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Fri Apr 25, 2008 10:24 am Post subject: Re: form as a splash screen? |
|
|
There are timers, or the recently added Application.doEvents(millisecondsDelay): Application.doEvents(5000); // Do events for 5 seconds and then continue. |
|
Back to top |
|
|
Keyframe
Joined: 04 Nov 2007 Posts: 9
|
Posted: Fri Apr 25, 2008 6:54 pm Post subject: |
|
|
Excellent, I have my splash screen now Though there was a slight headache with Entice (it deleted my custom code whenever I changed somethign visually ).
Now, is there a way I can disable keyboard input processing for the form somehow? since I don't want the user to be able to shut off the splash screen with alt-f4, let him wait while its done (its a fancy screen for loading basically) - and then resume control to the master form that shows up later. |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Sun Apr 27, 2008 9:04 am Post subject: |
|
|
Keyframe wrote: | Though there was a slight headache with Entice (it deleted my custom code whenever I changed somethign visually ). | I suspect you were adding code where it told you not to. The initialize function is separate so you can ignore it or even fold it up. |
|
Back to top |
|
|
|