Figured it out!

For anyone searching in the future:

I wasn’t actually initializing the labels in the resource file – it’s rather a miracle that it was working as well as it did..

LABEL “” caused the bad behaviour. LABEL “ZZZZZZZZZZZZZZZZZZ” preallocates enough space for your label (assuming you never exceed that number of chars on the label).

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stefan Mohr
Sent: Wednesday, August 23, 2006 2:38 PM
To: Palm Developer Forum
Subject: FrmCopyLabel adding characters?

 

Hi guys, getting a bit boggled on this one..

 

I have a series of labels declared for a form which are static, but localized.

When I draw the form, I call FrmCopyLabel once for each label to draw the localized text. Basically something like:

 

Char* labelText = LocalizedString();

FrmCopyLabel( FrmGetActiveForm(), labelID, labelText );

MemPtrFree( labelText );

FrmSetObjectPosition( labelText, objID, x, y );

.

.

.

FrmDrawForm();

 

 

The problem I’m experiencing is that the label text being drawn ends up being too large. For example, one label is “STOP” but I am getting “STOPY” drawn to the screen (it’s random – some garbage in memory).

My labels are 3 characters, 4, 4, and 5 characters, drawn in that order. I’m finding that the 3-char label and the 5-char label are drawing fine 100% of the time, but my 2 4-char labels are always appended with one garbage char.

 

Is there some trick to using FrmCopyLabel() that I’ve missed? Each string and label are different, so I can’t see that the problem where changing the string length is coming up.

 

I’d really prefer to go the label route instead of WinDrawChars() after the form draws to make the code more manageable.

Any suggestions? Thanks!


--
For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/


--
For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to