My original message is below. For those searching the archives,
I'm adding the solution to my problem.
In the resource file, the field did not have the MAXCHARS
attribute set. Apparently it defaults to zero, which is
why it wouldn't let me type anything in.
Changing the rcp file to read:
FIELD ID 1001 AT (CENTER 16 152 AUTO) MAXCHARS 25
solved the problem. The code worked just fine.
Cheers,
Anders
///////////////////////Original message///////////////////
I'm trying to get a simple pop-up window that gathers text.
Everything seems to work, except that the dialog just beeps
at me when I try to input any characters. And I can only
_assume_ that the field-reading code is working (based on
what I've read here and in the APIs), since I can't put
in any text, can't really check if anything other than NULL
comes back, right? ;)
It seems like it should be straightforward... perhaps the
field length issues?
Thoughts? Thanks,
Anders
// //////////////////////// source code
#define RES_ID_INPUT_FIELD 1001
// pops up a simple dialog box, gets user text, and stores it
void
GetUserInput(char *pTitle, char* pInputStorage)
{
FormType* pDialogBox;
char* pInputString;
pDialogBox = FrmInitForm(RES_ID_POPUP_INPUT);
FrmSetTitle (pDialogBox,pTitle);
FrmSetFocus (pDialogBox,FrmGetObjectIndex(pDialogBox,RES_ID_INPUT_FIELD));
FrmDoDialog(pDialogBox);
pInputString=FldGetTextPtr(FormGetObjectPtr(pDialogBox,RES_ID_INPUT_FIELD));
if(NULL!=pInputString)
StrCopy(pInputStorage,pInputString);
else
pInputStorage[0]=0;
FrmDeleteForm(pDialogBox);
}
// ///////////////////////resource data:
FORM ID RES_ID_POPUP_INPUT AT (2 108 156 50) MODAL
BEGIN
TITLE " "
FIELD ID 1001 AT (CENTER 16 152 AUTO)
BUTTON "Done" ID RES_ID_GENERIC_DONE_BUTTON AT (CENTER
PrevTop+GENERIC_BUTTON_SPACING AUTO AUTO)
NOGRAFFITISTATEINDICATOR
END
(....................................................
.) Anders Green
(....................................................
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/