Display two message one after another in a label in single event

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

Hi,

My form contains two input text fields "output directory" and "kitversion Number" an scroll window with two label's to display error and status message and  two buttons i.e, "Generate" and "Cancel".

Whenever i am giving required parameter to the form and click on "Generate" buttons I have to get a status message saying "the generate process is in Progress" and when the process is complete display a message in same status label saying "Generate is complete" and return from the event. This whole process is happening in a single event. The issue is application is giving  the last message in the status label before the return from the event . No intermediate messages are being displayed.

Below is the code snippet for "Generate" Buttons.

Code Snippet:

Logical CreateDbKit::Generate( const FormEvent& event )

{

    bool status = true;

    Stringz error;

 

    _dboutput.copy_to( _output_directory );

    _output_directory.truncate( );

 

    if( _output_directory.is_empty() )

    {

        _output_directory = "\"\"";

        Stringz tmp_path = _input_directory + "kitbuild";

        _dboutput.draw( tmp_path );

    }

    else

    {

        struct stat script_stats;

        if ( stat( _output_directory, &script_stats ) != 0 )

        {

            _dboutput.assert_error( format_msg( InvDirName ) );

            message( format_msg( InvOutputPath ) );

            status = false;

            return (Logical)status;

        }

        else

        {

            status = true;

            message( format_msg( KitInProgress ) ); //is not printed at all

        }

    }

 

    Stringz tmp_name = _db_name + ZoneExtension;

    struct stat script_stats;

    if ( stat( tmp_name, &script_stats ) != 0 )

    {

        _db_zoned = false;

        stat_msg( MODULE_NAME, STAT_INFO, "database is unzoned" );

    }

    else

    {

        _db_zoned = true;

        stat_msg( MODULE_NAME, STAT_INFO, "database is zoned" );

    }

 

    _kitversion.copy_to( _kitverno );

    _kitverno.truncate( );

    if( _kitverno.is_empty() )

    {

        _kitverno = "\"\"";

    }

 

    AttList att;

    att.protect( );

    AttList attr;

    attr.accessible( );

    _generate.set_attributes( att );

    _kitcancel.set_attributes( att );

 

    if( status )

    {

        status = produce_and_execute_createdbkit_script( );

        char filename[200];

        char cmd_str[200];

 

        char buffer[2000];

        Stringz GenkitErrMsg = "";

        sprintf( filename,"%serror.txt",getenv( "SCRIPTS" ) );

        ifstream errFile( filename, ios::in );

        if ( errFile != NULL )

        {

            while ( !errFile.eof( ) )

            {

                errFile.getline( buffer, 2000 );

                GenkitErrMsg += buffer;

            }

            sprintf( cmd_str, "rm -rf %s", filename );

            system( cmd_str );

            _errormsg = GenkitErrMsg;

        }

 

        if( status )

        {

            message( format_msg( KitGenerated, _errormsg.c_str( ) ) ); // is printed in the form

        }

        else

        {

            message( format_msg( KitGenFailed, _errormsg.c_str( ) ) );

        }

    }

    _generate.set_attributes( attr );

    _kitcancel.set_attributes( attr );

    unlock( );

    return ( status );

}

 

End of Code Snippet.

Request help.

 

 

 

 

 

 

 

Mon, 01/21/2013 - 03:58
#1
3 posts / 0 new
Last post
21
Thu, 01/24/2013 - 09:26