Palm Pilot

Moderators: None (Apply to moderate this forum)
Number of threads: 121
Number of posts: 197

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
unable to uncheck checkboxes Posted by JSY on 3 Jan 2005 at 12:59 AM
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;
}

Report
This post has been deleted. Posted by elmomcelroy on 24 Jul 2011 at 7:11 AM
This post has been deleted.
Report
This post has been deleted. Posted by elmomcelroy on 24 Jul 2011 at 7:13 AM
This post has been deleted.
Report
This post has been deleted. Posted by elmomcelroy on 24 Jul 2011 at 7:16 AM
This post has been deleted.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.