I've searched the Knowledge base, and most of the emails regarding string truncation do not actually determine the number of PIXELS wide (and high) a string will be on the screen (#see below).
If I could get the PIXEL-length (not character-string-length) of a string, that would be *good*.
EXAMPLE:
========
Say I have the following C string:
"c:\directory\directory\directory\very_long_file_name.bin"
If I try to fit it into a too-small "Text Message" control (not a "Text Box"), I get this:
|c:\directory\directory\directory\very|
What I want to do is:
1. I can get the PIXEL-size of the Text Message Control. I can
do this with GetCtrlAttribute(ATTR_WIDTH), eg:
ret = GetCtrlAttribute(panel, PANEL_FILE, ATTR_WIDTH, &Attr_Width);
and Attr_Width I get back is, say, 300 pixels.
2. I now want to know what the PIXEL-length of my string is. I cannot find if there is a LW/CVI function that does this.
*** I can get the POINT size.
*** I can get the number of characters if I've already written a string to the Text Message control.
3. in my code, I want to be able to say:
if ( PIXEL_LENGTH(string) > Attr_Width )
try shortening the string
for example, I can create a temporary string and replace the directory path with 3 dots ("...") using fnsplit()/fnmerge():
fnsplit ( strn, drive, dir , fname, ext );
fnmerge ( temp, drive, "...", fname, ext );
and I can retry Step 2, which give us:
|c:\...\very_long_file_name.bin |
2. this time the PIXEL size is, say, 250 pixels, so everything
is OK
---------------------------------------------------
#typical examples:
Fmt function truncates output buffer at 64K bytes. If the following code is executed: static double farray[100000]; static char buffer[100000] Fmt(buffer, '%s 0BKGLKTL