Problem with static text in dialog boxes

This is a discussion on Problem with static text in dialog boxes within the Windows Programming forums, part of the Platform Specific Boards category; I want a relatively large dialog box to be filled with static text, (i'm going to use it as the ...

  1. #1
    The Earth is not flat. Clyde's Avatar
    Join Date
    Mar 2002
    Posts
    1,420

    Problem with static text in dialog boxes

    I want a relatively large dialog box to be filled with static text, (i'm going to use it as the programs "help" file) I can make the dialog box no problem, but when it comes to putting the text in, the static text boxes are limited to very few characters - like 2 lines of text, i don't want to use an edit box because the text is supposed to be static, what do you suggest?

  2. #2
    Unregistered
    Guest
    A read-only edit box, then the text will be static.

  3. #3
    The Earth is not flat. Clyde's Avatar
    Join Date
    Mar 2002
    Posts
    1,420
    thanks, *goes to read about read only edit boxes*

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    >>> static text boxes are limited to very few characters

    I guess there is a theoretical upper limit for how much you can put in there, but I don't think you've hit it. I suspect you have not enlarged the static text control to the size you require. If you create a control of size x, then you will only be able to put so much text into it that will fill x. Click the bottom right of the static control and drag it down and right.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  5. #5
    The Earth is not flat. Clyde's Avatar
    Join Date
    Mar 2002
    Posts
    1,420
    Oh my was box is big enough, and it looks fine on the screen but at compile time is complains that the text is too long. If its over about 2 lines in length I get:

    "warning RC4206 : title string too long; truncated at 256"

    and if it's way longer i get an error, the exact text i forget but i think its mentions a static string.

    It's ok i just used lots of static string boxes each with 1-2 lines of text (yes it was a pain) next time i'll use the read-only edit box.

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,853
    were you using new line characters or one big string? multi line edits?
    (as I think the limits are different. I thought you could put more than 256 chars in an edit.)

    Have a look at HDC's (Handle to Device Context)

    This is a 'holder' for graphical resources (fonts, bitmaps ect) for a particular device (printer, screen ect).

    Can have full control of text and images. Harder than the read only edit but needed for any type of GDI app. Biggest thing is to remeber to put them back exactly the way you found/created them.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  7. #7
    The Earth is not flat. Clyde's Avatar
    Join Date
    Mar 2002
    Posts
    1,420
    What i was doing, was using the resource editor with MSVC++, so you click on the static text icon, draw a box then if you double click it you get a window coming up saying "Text Properties", within that there is room for you to type text into the static text box, (it says Caption: and has an edit control for you to type in) I was typing in there.

  8. #8
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    I had a play with this. It would seem that the static text control uses the window title property to store it's string, (256 characters), although the resource editor allows you to create much long strings without reporting an error, (I did just that).

    I guess I have never had the problem before as I have never tried to use a static control for anything other than a few words.

    Windows has a reasonably good built in help system within the API, but I guess you have not got there yet in your Petzold!
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  9. #9
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,853
    and if you try to SetDlgItemText() a string greater than 256 to a static text ctrl, it is truncated to 256 with no error reported.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  10. #10
    The Earth is not flat. Clyde's Avatar
    Join Date
    Mar 2002
    Posts
    1,420
    "Windows has a reasonably good built in help system within the API, but I guess you have not got there yet in your Petzold!"

    Haven't seen any mention of it so far, though i am jumping around a bit.

  11. #11
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    WinHelp() is the basic API function, but I would read it when you get to it. It is a big area. Often, designing the help for an application is part of the early design process as it is usually easy, (once you understand it), to write an app with the help design in mind, but is a right royal pain in... to add later.

    Many pro's use specialist help editing systems, RoboHelp for example.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  12. #12
    The Earth is not flat. Clyde's Avatar
    Join Date
    Mar 2002
    Posts
    1,420
    Hmm, my copy (5th ed.) of Petzold seems to lack any info on WinHelp, grrr!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 04:42 PM
  2. bold static text
    By Bleech in forum Windows Programming
    Replies: 10
    Last Post: 08-22-2007, 05:43 PM
  3. [GLUT] Pointers to class methods
    By cboard_member in forum C++ Programming
    Replies: 13
    Last Post: 02-16-2006, 03:03 PM
  4. How to use FTP?
    By maxorator in forum C++ Programming
    Replies: 8
    Last Post: 11-04-2005, 02:17 PM
  5. Dynamically add statis text to a dialog box
    By earth_angel in forum Windows Programming
    Replies: 8
    Last Post: 06-23-2005, 01:28 PM

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