Powers

This is a discussion on Powers within the Windows Programming forums, part of the Platform Specific Boards category; Hello How exactly do I type into a text box a power instead of typing 2^3?...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    162

    Powers

    Hello

    How exactly do I type into a text box a power instead of typing 2^3?

  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    I can only make a guess at what you're asking - one does not "type powers" into a textbox. Do you mean the character resembling a superscript 3?
    Like 2³?
    charmap will help, or you can input the unicode number on the keyboard, or copy/paste from the web. (Alt+0179, but I think I might have special options that allow me to do that.)
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,308
    Quote Originally Posted by Gordon View Post
    Hello

    How exactly do I type into a text box a power instead of typing 2^3?
    You can't. All the text in a textbox is drawn in the same font and style. You would need a rich text field instead.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  4. #4
    HelpingYouHelpUsHelpUsAll
    Join Date
    Dec 2007
    Location
    In your nightmares
    Posts
    223
    Quote Originally Posted by iMalc View Post
    You can't. All the text in a textbox is drawn in the same font and style. You would need a rich text field instead.
    You can put Unicode characters into a textbox. But to support all the powers you would definitely need to use a Unicode font e.g. Arial Unicode MS. Though this has its drawbacks, e.g. their are only characters for 0-9, you would need more than one character for a power > 1 digit. As for a rich text field: It would probably display to the user better, but be harder to process, e.g. the program would have to sort through the style of the characters not the characters themselves to carry out any operation on the text (esp. for a calculator). A rich text box would be able to handle text of different sizes though. Think about what it is that you actually intend to do with the characters in a textbox, I assume that you don't just want to make an app in which the main window just has a textbox in it and doesn't carry out any other processing whatsoever.
    long time no C; //seige
    You miss 100% of the people you don't C;
    Code:
    if (language != LANG_C && language != LANG_CPP)
        drown(language);

  5. #5
    Registered User
    Join Date
    Apr 2007
    Posts
    162
    Thx for ideas I will see what I can do about the unicode... I am using multibyte currently. Does that apply also to multibyte or I must use unicode?

  6. #6
    HelpingYouHelpUsHelpUsAll
    Join Date
    Dec 2007
    Location
    In your nightmares
    Posts
    223
    I don't know much about mutibyte characters and from the research I have done it seems that it is just a way of encoding text strings, I don't know if there is a way in which the user can type these characters into the textbox. If you know of any multibyte fonts, use them the above will probably work. Otherwise Unicode will work. Also note: their is only a limited number of keys on the keyboard. They are never going to be able to type in a ³ directly. A button or someway of hard-coding adding that character to the textbox might be a good way to go.
    long time no C; //seige
    You miss 100% of the people you don't C;
    Code:
    if (language != LANG_C && language != LANG_CPP)
        drown(language);

  7. #7
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    Thx for ideas I will see what I can do about the unicode... I am using multibyte currently. Does that apply also to multibyte or I must use unicode?
    What exactly do you mean by "multibyte"? Unicode can be encoded in multiple ways, the two most common being UTF-8 and UTF-16. In both encodings, you need more than one byte per character. If you're in Windows, and you're doing a unicode project, you're probably using UTF-16. (These are not the only two character encodings either... there are tons more.)

    In Windows, for example, I can type a ³ (U+00B3) into a textbox. (Alt+0179 on my keyboard) Now, whether or not a "superscript 3" character makes any sense to your program at all is entirely dependent on the program. It's a character, like '!', 'a' or '$' or even (if your browser can display this... '姨') If it's a math program, it's probably coded to recognize 2^3, not 2³. If you're doing the coding, I'd much rather (as a user) type 2^3 than 2³, for input, however, for output, if you want to look pretty, then 2³ might help. (Although note that you can't keep going, ie, 2^3^3 doesn't work unless you do font size changes, at which point ³ becomes irrelevant.)
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  8. #8
    Registered User
    Join Date
    Apr 2007
    Posts
    162
    Quote Originally Posted by Cactus_Hugger View Post
    What exactly do you mean by "multibyte"?...
    As you asked further in the comment if I work on unicode project. I work on multibyte project. I dont really understand the difference.

    Anyway thank you for help I will work on that

  9. #9
    HelpingYouHelpUsHelpUsAll
    Join Date
    Dec 2007
    Location
    In your nightmares
    Posts
    223
    Have a look at Mirosoft Math, download the trial version. This features powers and might help.
    long time no C; //seige
    You miss 100% of the people you don't C;
    Code:
    if (language != LANG_C && language != LANG_CPP)
        drown(language);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. On Women and Their Powers
    By UnregdRegd in forum A Brief History of Cprogramming.com
    Replies: 48
    Last Post: 03-30-2004, 04:55 PM
  2. Powers and simplifications, please help me
    By Zewu in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 12-21-2003, 07:09 PM
  3. With super powers would you:
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 09-18-2003, 12:27 AM
  4. Help with powers
    By Tim in forum C Programming
    Replies: 3
    Last Post: 05-03-2002, 03:52 AM
  5. Square roots / Powers etc.
    By Robert602 in forum C++ Programming
    Replies: 4
    Last Post: 09-30-2001, 04:26 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21