unable to uncheck checkboxes

hi. i'm new to programming PDAs. i'm currently writing a program that displays a menu (like in a restaurant situation) and transmits data (the customer's orders) frm the PDA via serial communication. currently, i've two problems.

for the GUI, i am only able to check the checkboxes but not uncheck it. the second problem wld b that the program hangs everytime i check the checkbox. this is weird as this very same program i;ve written works well on a tungstenE but hangs everytime i check a checkbox on a PalmIIIx. any insight to rectify the two problems i am facing? below are segments of my codes.

thx ..

rgds,
JSY

static Boolean MainFormDoCommand(UInt16 command)
{
Boolean handled1 = false;
FormPtr frmP;

switch (command)
{
//Sets pointer to the ChickenBox checkbox and gets it boolean value
case MainChickenBox:

frmP = FrmGetActiveForm();
ControlType *ctl1;
ctl1 = (ControlPtr)FrmGetObjectPtr(frmP,FrmGetObjectIndex(frmP,MainChickenBox));
chickenBoolean = (Boolean)CtlGetValue(ctl1);
handled1 =true;
break;

//Sets pointer to the BeeefBox checkbox and gets it boolean value
case MainBeefBox:

frmP = FrmGetActiveForm();
ControlType *ctl2;
ctl2 = (ControlPtr)FrmGetObjectPtr(frmP,FrmGetObjectIndex(frmP,MainBeefBox));
beefBoolean = (Boolean)CtlGetValue(ctl2);
handled1 = true;
break;

//Performs error checking when OK button is pressed
case MainOkButton:

Boolean correctEntry = false;
char qty1[128], qty2[128];
int QtyLength1 = 0;
int QtyLength2 = 0;
FieldPtr TextFieldPtr1;
FieldPtr TextFieldPtr2 ;
frmP = FrmGetActiveForm();

TextFieldPtr1 = (FieldPtr)FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, ChickenQuantityField));

if ((QtyLength1 = FldGetTextLength(TextFieldPtr1))>0)
{
MemHandle TextHandle1 = FldGetTextHandle(TextFieldPtr1);
StrCopy(qty1, (char *)MemHandleLock(TextHandle1));
chickenQuantity = (string) qty1;
MemHandleUnlock(TextHandle1);
qty1[QtyLength1] = NULL;

if (!chickenBoolean)
{
FrmAlert(EmptyCheckBoxAlert);
FrmGotoForm(MainForm);

}
else
correctEntry = true;

}
else
{
if (chickenBoolean)
{
FrmAlert(IncompleteQtyAlert);
chickenBoolean = false;
FrmGotoForm(MainForm);
}
}

TextFieldPtr2 = (FieldPtr)FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, BeefQuantityField));

if ((QtyLength2 = FldGetTextLength(TextFieldPtr2))>0)
{
MemHandle TextHandle2 = FldGetTextHandle(TextFieldPtr2);
StrCopy(qty2, (char *)MemHandleLock(TextHandle2));
beefQuantity = (string) qty2;
MemHandleUnlock(TextHandle2);
qty2[QtyLength2] = NULL;

if (!beefBoolean)
{
FrmAlert(EmptyCheckBoxAlert);
FrmGotoForm(MainForm);
}
else
correctEntry = true;

}
else
{
if (beefBoolean)
{
FrmAlert(IncompleteQtyAlert);
beefBoolean = false;
FrmGotoForm(MainForm);
}
}

if ((QtyLength1 <= 0) && (QtyLength2 <= 0) && !chickenBoolean && !beefBoolean)
{
FrmAlert(NothingAlert);
FrmGotoForm(MainForm);

}
if (correctEntry)
{
OpenSerial();
string strToBeSent = FormatStringtoSend();
WriteSerial(strToBeSent);
CloseSerial();
handled1 = true;
}
break;
}
return handled1;

}
__________________

static string FormatStringtoSend()
{

toSend = toSend + tableNumber;

if (chickenBoolean && ChickenQuantityField != -1)
{
toSend = toSend + "C|" + chickenQuantity + "|";

}


if (beefBoolean && BeefQuantityField != -1)
{
toSend = toSend + "B|" + beefQuantity + "|";
}



return toSend;
}

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion