Page 1 of 1

Wow... both texts drawn! I have no Idea why!

Posted: Thu Jul 31, 2008 11:57 pm
by Repgahroll
I have two texts which i want to be shown, but one at time!

I have a bool, and if is true, i want 'text one' to be shown, if false i want "text two" to replace text one.

what's wrong??

Code: Select all

			if (variable == true)
			{
textvar=device->getGUIEnvironment()->addStaticText(L"text one",pos);
			}
			else
						
			if (variable == false)
			{
textvar=device->getGUIEnvironment()->addStaticText(L"text two",pos);
			}
Thanks in advance!

Sorry my english and my noobness:D hehe

Posted: Thu Jul 31, 2008 11:58 pm
by Repgahroll
nevamind! :D

'setText' is the answer! :D

Thanks anyway!

Posted: Fri Aug 01, 2008 12:18 am
by almondega
just a performance tip

if (variable == true) { .... }
else { ... }

as variable is bool, it only can be one thing if the first doesnt work, so, avoid the "if = false"

or better: (but ugly)

textvar=device->getGUIEnvironment()->addStaticText(variable?L"text one":L"text two",pos);

Posted: Fri Aug 01, 2008 1:41 am
by Repgahroll
Thanks... but anotha problem appeared! :) :(

Everything is okay BUT, if i click the left mouse button the text replacin thing stop working! :(

Dunno why... theres no reason i can see!

Posted: Fri Aug 01, 2008 1:45 am
by almondega
i didnt work with gui yet
but i saw in some topics to pay attencion when using event managers + gui
because gui has its own event manager (i think)

Posted: Fri Aug 01, 2008 1:51 am
by Repgahroll
OK... but the mouse isn't being used on the whole program! :(.


EDIT:

Nevaminddieth!!! :D :D :D :D : D :D: D:D :DD:D:

now everything just work! :D Dunno what was happenin, i just re-write everathing and now works like a charm! pretty help here! Thank you vary muche guys! :D :D

Sorry mä english!

Posted: Fri Aug 01, 2008 7:19 am
by JP
almondega wrote: because gui has its own event manager (i think)
nope... all events go through the same system and come into your Event Receiver implementation that you've registered with the device.