Hi all,
I've got a record consisting of data to do with textbox metadata in a database
called 'textbox'.
I am wanting to read this data so I can use it to dynamically create a
textbox... but I can't seem to get how to read the record correctly.
My record consists of:
New|2|65|30|15|30|true|false|false
The code I have is:
-------------
typedef struct {
char Name[20];
Coord X;
Coord Y;
Coord Width;
Coord Height;
UInt32 MaxChar;
char SinglLine[10];
char Numerical[10];
char Scrollable[10];
} DBRecordTextBox;
typedef DBRecordTextBox DBRecordTextBoxType;
typedef DBRecordTextBox* DBRecordTextBoxPtr;
...
DmOpenRef dbP;
FormPtr frmNew;
DBRecordTextBoxPtr tbP;
MemHandle tbH;
char title[50];
FieldPtr fldNew;
CharPtr p;
VoidHand h;
char name[50];
LocalID locID;
StrPrintF(title,"%s","New Form");
frmNew = FrmNewForm (
1,
title,
2,2,
156,156,
true,
0,
0,
0
);
StrPrintF(name,"%s","textbox");
locID=DmFindDatabase(0,name);
dbP = DmOpenDatabase(0, locID, dmModeReadOnly);
tbH = (MemHandle)DmQueryRecord(dbP, 0);
tbP = (DBRecordTextBoxPtr)MemHandleLock(tbH);
FrmDrawForm(frmNew);
FrmSetActiveForm(frmNew);
fldNew = FldNewField (
&frmNew,
1236,
tbP->X,tbP->Y,
100,50,
stdFont,
20,
true,
grayUnderline ,
false, false, leftAlign,
true, false, false);
FldSetUsable(fldNew,true);
FldSetInsertionPoint(fldNew,0);
FldDrawField(fldNew);
-----------
As you can see I am just trying to see if I can get the X and Y from the
records... but it isn't working. It converts 'ue' from true as the value of X.
I figure this is because in my structure it has char[20] for the size of name.
This value could vary up to a string size of 20.
Could anyone help me?
Thanks
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/