"Luc Le Blanc" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> Is there an API or internal form struct that allows passing/retrieving
> data to/from a form like a boolean value to set a given hehavior,
> recover a float value, etc. I currently re-use a single global UInt32
> for all my forms, but a form-specific user data would be convenient.
>
Luc,
Here is a trick I often use.
For example, I have a form that is a text edition form that I can call from
many places in my code.
Instaid of directly calling FrmPopupForm, I have defined a fonction that
reside in the same source file (what I call a module) and I pass it my
parameters.
That routine will copy my parameters to modular variable and then call
FrmPopupForm.
Here is a simplified example:
This code reside in the same source file than the code that handle the form.
// Modular variables (its actualy a global but its scope is limited to the
current module)
static UInt16 muintParentFormID;
static Char mstrCaption[30];
static Char *mstrpEditText;
static Int16 mintEditTextMaxChar;
void PopupEditText(UInt16 uintParentFormID,Char *strpCaption, Char
*strpEditText, Int16 intMaxChar)
{
muintParentFormID=uintParentFormID;
StrCopy(mstrCaption,strpCaption);
mstrpEditText=strpEditText;
mintEditTextMaxChar=intMaxChar;
FrmPopupForm(EditTextForm);
}
In my form, the text initialy in strpEditText is copied into a feild, edited
and then copyed back to strpEditText if the form is closed using the OK
button.
Hope this helps.
--
Regis St-Gelais
www.laubrass.com
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/