Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Displaying superscript

Author
Message
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 31st Jul 2009 00:34
How would I display superscript using the dbText command? For example if I wanted to write out m^3 correctly.

Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 31st Jul 2009 00:57 Edited at: 31st Jul 2009 00:58
use a pointer to a character array like this :

Char* myText = new char[256];
int variable = 1;
int variable_after_dot = 2;

then copy what you want into it like this :

strcpy(myText, "this is : ");
strcat(myText, dbStr(variable));
strcat(myText, ".");
strcat(mytext, dbStr(variable_after_dot));
dbText(0, 0, myText);

dont forget to delete.

delete []myText;

This will display(should) : "this is : 1.2" - you can use itos instead of dbStr, but it requires some extra setup. It may be a better idea to use the non-deprecated cstr functions though, strcpy_s strcat_s - they are safer as they detect buffer overrun, which the deprecated commands dont.

EDIT : sorry i dont know the \ code to make it show superscript or subscript, you should be able to just add the \ flags to the string to make it show as subscript or whatever. ( \n = newline etc)

If it ain't broke.... DONT FIX IT !!!
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 31st Jul 2009 02:30
Ahh ok, I didn't know there were /code commands for superscript and subscript, thanks much

Login to post a reply

Server time is: 2024-10-01 08:48:18
Your offset time is: 2024-10-01 08:48:18