Re: [Plib-users] pui help
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2004-04-08 00:36:05
|
Brian Smith wrote: > Bruce: > Your right!! i didn't even realize that, how then would I create this > object as a global variable, in my header file I just have puOneShot > *backButton; to make it global, then when it gets to > createTeamButtons() it does create a new one (why the address was > different between the backButton created and the backButton called to > hide). However if I put this line in the header file > puOneShot *backButton = new puOneShot (20.0, 20.0, 170.0, 50.0); > > I get a fatal error before anything starts up saying > > FATAL: puiGetWindow: callbacks are not initialized > > I'm guessing this is so because at the time of the .h file I have not > initialized pui yet. So how would I create a global object?? At the top of your program: puOneShot *backButton = NULL ; ...then somewhere *AFTER* puInit() but *BEFORE* you go into your main processing loop: backButton = new puOneShot ( ...whatever... ) ; If you are feeling cautious, then in your callback, you can put: assert ( backButton != NULL ) ; ---------------------------- Steve Baker ------------------------- HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://www.sjbaker.org Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net -----BEGIN GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++ -----END GEEK CODE BLOCK----- |