Re: splash page - Motif

This is a discussion on Re: splash page - Motif ; "Gary Meerschaert" wrote in message news:N4mdnTqMJttbR8TYnZ2dnUVZ_oednZ2d@wideopenwest .com... > Can someone please point me to a simple example of how to create a splash > page? I have an application that starts a bit slowly, and would like to > put ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Re: splash page

  1. Re: splash page


    "Gary Meerschaert" wrote in message
    news:N4mdnTqMJttbR8TYnZ2dnUVZ_oednZ2d@wideopenwest .com...
    > Can someone please point me to a simple example of how to create a splash
    > page? I have an application that starts a bit slowly, and would like to
    > put up a splash page if it is not too big of a deal.
    >
    > Thanks.
    > --
    > Gary Meerschaert
    > Madison Heights, MI
    >
    > Don't give up on your dreams.
    > Wait a bit and they'll give up on you
    > and you can start again without all of that guilt.
    >
    > Gary.meerschaert@gmail.com


    Posting a splash banner correctly is not a trivial task.
    First, you have to decide a couple of things:
    - Do you want the banner to be shown for at least x seconds?
    - Do you want to allo0w the user to dismiss it at any time?
    - Do you want it to disappear automatically after a specified time?

    Here's a template for one way to do it:

    in main program:
    (Note: variable declarations not shown here)
    -------------------
    /* Create the app shell */
    topLevel = XtAppInitialize( &context, ...);

    /* Create the modal banner dialog */
    banner = XmCreateMessageDialog( topLevel, ... );
    XtAddCallback( banner, XmNokCallback, DismissCb, ... );
    XtUnmanageChild(
    XmMessageBoxGetChild(banner, XmDIALOG_CANCEL_BUTTON));

    /* Display the app banner */
    XtManageChild(banner);

    /* Add a work proc to create/initialize the rest of the app */
    XtAppAddWorkProc( context, CreateApp, ... );

    /* Process events */
    XtAppMainLoop( context ) ;
    return 0;
    -------------------------------

    The Work proc:
    static Boolean CreateApp( XtPointer client_data ) {
    static int step = 0;
    /* Create the rest of the app here */

    /* If possible, break it into small chunks, doing
    one chunk each time you enter this method.
    When done, return True, else return False */
    select ( step++ ) {
    case 0:
    /* Create first part */
    break;
    case 1:
    /* Create next part */
    break;
    ...
    case (LAST_STEP_DONE):
    /* Display the rest of the app */
    XtRealizeWidget(topLevel);
    /* make sure banner stays on top */
    XRaiseWindow(XtDisplay(topLevel,
    XtWindow(XtParent(banner)) );
    return True;
    }
    /* If desired, you can update a progress bar
    in the banner at this point */
    ...
    return False;
    }
    --------------------------------------

    You might also do these other things:
    - After creating the banner, get the ok button and
    call XtSetSensitive(b,False) on it.Then in the last
    step of the work proc, set its sensitivity True.
    This keeps the user from dismissing it early).

    - Tie the WMClose button to your OK callback.
    In the OK callback, if the widget is not the OK button,
    do nothing. This keeps the user from dismissing
    the dialog via the window manager close button.

    - Register a TimeOut to dismiss the dialog automatically
    after some specified time.

    --
    Fred L. Kleinschmidt
    Boeing Associate Technical Fellow
    Technical Architect, Software Reuse Project



  2. Re: splash page

    Fred Kleinschmidt wrote:
    > "Gary Meerschaert" wrote in message
    > news:N4mdnTqMJttbR8TYnZ2dnUVZ_oednZ2d@wideopenwest .com...
    >> Can someone please point me to a simple example of how to create a splash
    >> page? I have an application that starts a bit slowly, and would like to
    >> put up a splash page if it is not too big of a deal.
    >>
    >> Thanks.
    >> --
    >> Gary Meerschaert
    >> Madison Heights, MI
    >>
    >> Don't give up on your dreams.
    >> Wait a bit and they'll give up on you
    >> and you can start again without all of that guilt.
    >>
    >> Gary.meerschaert@gmail.com

    >
    > Posting a splash banner correctly is not a trivial task.
    > First, you have to decide a couple of things:
    > - Do you want the banner to be shown for at least x seconds?
    > - Do you want to allo0w the user to dismiss it at any time?
    > - Do you want it to disappear automatically after a specified time?
    >
    > Here's a template for one way to do it:
    >
    > in main program:
    > (Note: variable declarations not shown here)
    > -------------------
    > /* Create the app shell */
    > topLevel = XtAppInitialize( &context, ...);
    >
    > /* Create the modal banner dialog */
    > banner = XmCreateMessageDialog( topLevel, ... );
    > XtAddCallback( banner, XmNokCallback, DismissCb, ... );
    > XtUnmanageChild(
    > XmMessageBoxGetChild(banner, XmDIALOG_CANCEL_BUTTON));
    >
    > /* Display the app banner */
    > XtManageChild(banner);
    >
    > /* Add a work proc to create/initialize the rest of the app */
    > XtAppAddWorkProc( context, CreateApp, ... );
    >
    > /* Process events */
    > XtAppMainLoop( context ) ;
    > return 0;
    > -------------------------------
    >
    > The Work proc:
    > static Boolean CreateApp( XtPointer client_data ) {
    > static int step = 0;
    > /* Create the rest of the app here */
    >
    > /* If possible, break it into small chunks, doing
    > one chunk each time you enter this method.
    > When done, return True, else return False */
    > select ( step++ ) {
    > case 0:
    > /* Create first part */
    > break;
    > case 1:
    > /* Create next part */
    > break;
    > ...
    > case (LAST_STEP_DONE):
    > /* Display the rest of the app */
    > XtRealizeWidget(topLevel);
    > /* make sure banner stays on top */
    > XRaiseWindow(XtDisplay(topLevel,
    > XtWindow(XtParent(banner)) );
    > return True;
    > }
    > /* If desired, you can update a progress bar
    > in the banner at this point */
    > ...
    > return False;
    > }
    > --------------------------------------
    >
    > You might also do these other things:
    > - After creating the banner, get the ok button and
    > call XtSetSensitive(b,False) on it.Then in the last
    > step of the work proc, set its sensitivity True.
    > This keeps the user from dismissing it early).
    >
    > - Tie the WMClose button to your OK callback.
    > In the OK callback, if the widget is not the OK button,
    > do nothing. This keeps the user from dismissing
    > the dialog via the window manager close button.
    >
    > - Register a TimeOut to dismiss the dialog automatically
    > after some specified time.
    >

    Thanks for the help. I got the splash page working. My app is a little
    toy I built for myself to show all of the colors available on a system.
    I added a window containing a push button for each color. That takes a
    while to build. I may post the source to the web at some time. It comes
    in handy for working with users to pick colors for new applications. I
    also use it for myself. Being red/green color blind, not all of the
    standard colors people use in apps work for me. I also have an app to
    display all of the fonts on a machine, which I use in a similar way to
    the color application. I am also using these to play with some methods
    of X11/Motif coding, like custom resources.

    --
    Gary Meerschaert
    Madison Heights, MI

    Don't give up on your dreams.
    Wait a bit and they'll give up on you
    and you can start again without all of that guilt.

    Gary.meerschaert@gmail.com

+ Reply to Thread