Overriding the abmain.c file.

HI,

I need to override the default abmain.c file. The reason is that I need to
add some code to the applications main function in order to support dynamic
initialization of the application initial window. The abmain.c file can’t be
modified as it is generated by PhAB each time you use the Generate UI
option.

What would be the best way to implement a custom main function and have it
be used instead of the
default abmain.c version?

Philip

Philip Gonia <philip.t.gonia@nasa.gov> wrote:

HI,

I need to override the default abmain.c file. The reason is that I need to
add some code to the applications main function in order to support dynamic
initialization of the application initial window. The abmain.c file can’t be
modified as it is generated by PhAB each time you use the Generate UI
option.

There is supposed to be a hook to allow a “app initialize” type function to
be called before the main/first window is rendered. There might also be a
pre-realize callback for your main window widget. Either might give you
this ability without needing to replace abmain.c.

-David

What would be the best way to implement a custom main function and have it
be used instead of the
default abmain.c version?

Philip


QNX Training Services
http://www.qnx.com/services/training/
Please followup in this newsgroup if you have further questions.

HI,

The issue is I need to override the call to ApLinkWindow in the main
function.

Here is the code that I am using within the main function call right now. I
have to add this each time I do an update to the application ab*.* files.



**** Source ****

int

main ( int argc, char *argv[] )

{


int passed = Pt_CONTINUE;


Ap.Ap_winstate = 0;

// AppBuilder Initialization

ApInitialize( argc, argv, &AbContext );

passed = hud_init( argc, argv );

if ( passed == Pt_CONTINUE ) {

// Display main window

ApLinkWindow( NULL, &AbApplLinks[0], NULL );

}


// Loop until user quits application

PtMainLoop( );

PtExit( 0 );

return 0;

}

*** End Source ***

The hud_init function call will return something other then Pt_CONTINUE if
the application was started with a command line option instructing the
application to initialize a non-default main window.

I have this working but it is a pain to have to refactor the main function
after making and saving changes within PhAB.

Cheers,

Philip

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:eplg4k$dm4$1@nntp.qnx.com

Philip Gonia <> philip.t.gonia@nasa.gov> > wrote:
HI,

I need to override the default abmain.c file. The reason is that I need
to
add some code to the applications main function in order to support
dynamic
initialization of the application initial window. The abmain.c file can’t
be
modified as it is generated by PhAB each time you use the Generate UI
option.

There is supposed to be a hook to allow a “app initialize” type function
to
be called before the main/first window is rendered. There might also be a
pre-realize callback for your main window widget. Either might give you
this ability without needing to replace abmain.c.

-David

What would be the best way to implement a custom main function and have
it
be used instead of the
default abmain.c version?

Philip


\

QNX Training Services
http://www.qnx.com/services/training/
Please followup in this newsgroup if you have further questions.

Hi,

Philip Gonia a écrit :

HI,

The issue is I need to override the call to ApLinkWindow in the main
function.

You can suppress the startup window in the Project properties. Then phab

will suppress the ApLinkWindow call in the abmain. You need to add the
ApLinkWindow in your hud_init function.

I hope this helps

Best regards

Here is the code that I am using within the main function call right now. I
have to add this each time I do an update to the application ab*.* files.



**** Source ****

int

main ( int argc, char *argv[] )

{


int passed = Pt_CONTINUE;


Ap.Ap_winstate = 0;

// AppBuilder Initialization

ApInitialize( argc, argv, &AbContext );

passed = hud_init( argc, argv );

if ( passed == Pt_CONTINUE ) {

// Display main window

ApLinkWindow( NULL, &AbApplLinks[0], NULL );

}


// Loop until user quits application

PtMainLoop( );

PtExit( 0 );

return 0;

}

*** End Source ***

The hud_init function call will return something other then Pt_CONTINUE if
the application was started with a command line option instructing the
application to initialize a non-default main window.

I have this working but it is a pain to have to refactor the main function
after making and saving changes within PhAB.

Cheers,

Philip

“David Gibbs” <> dagibbs@qnx.com> > wrote in message
news:eplg4k$dm4$> 1@nntp.qnx.com> …
Philip Gonia <> philip.t.gonia@nasa.gov> > wrote:
HI,
I need to override the default abmain.c file. The reason is that I need
to
add some code to the applications main function in order to support
dynamic
initialization of the application initial window. The abmain.c file can’t
be
modified as it is generated by PhAB each time you use the Generate UI
option.
There is supposed to be a hook to allow a “app initialize” type function
to
be called before the main/first window is rendered. There might also be a
pre-realize callback for your main window widget. Either might give you
this ability without needing to replace abmain.c.

-David

What would be the best way to implement a custom main function and have
it
be used instead of the
default abmain.c version?
Philip

\

QNX Training Services
http://www.qnx.com/services/training/
Please followup in this newsgroup if you have further questions.