At 11:44 AM 5/26/2004, you wrote:
I have modal form used for capturing preferences. Part of the form contains a popup trigger for one of 6 date formats, and another popup trigger for one of three separator styles. I have coded the event handler and based on the selection of the two popup trigger I format a sample date for display. That is 100% fine.

But...my Palm development book by Rhodes mentions that labels are not ideal for displaying data and that you should display data in a non-editable field instead. So here's my PilRC declaration:

    LABEL "Example:" AUTOID AT (27 36) FONT 1
    FIELD ID PrefsExample AT (74 36 62 10) MAXCHARS 11 DISABLED

I go through the usual code trick supposedly used for changing the value of the field text. Upto a point it works - almost but I'm getting some very strange behaviour.

1. I don't have EDITABLE declared in my FIELD yet I can edit the text! Why does it let me?

In PilRC, fields default to EDITABLE. That's why the EDITABLE keyword is in blue in the PilRC documentation. Use NONEDITABLE.


2. After the new field value is assigned, it is not displayed. But if I tap on the supposedly non-editable field and delete a character, the new field value is then displayed, sans the one character I've deleted. In other words, if the old value displayed is "ABC" and the new value is "123" then when I delete "C" from "ABC", the form suddenly displays "12".

You're not doing the assignment correctly. For a non-editable field, FldSetTextPtr works pretty well, if you follow the guidelines in the SDK Reference.


3. I tried using FrmDrawForm after I've done the field assignment and that works, but...I have some graphical lines on the form I drew once and now I have to redraw them again! Surely, there has to be a better way than this?

You need to always do FrmDrawForm first, and then set controls if there's any chance that the control setting code in the OS will try to draw the control.



-- Ben Combee, DTS technical lead, PalmSource, Inc. Read "Combee on Palm OS" at http://palmos.combee.net/



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

Reply via email to