Here's a small snipit of the code that I'm having a problem with:
----------------------------------------------------------------------------
--------------------
static void UpdateList(Word selectedRecord)
{
FormPtr pFrm = FrmGetFormPtr(MarksForm);
ListPtr pLst = (ListPtr)GetObjectPtr(MarksTitleList);
ListPtr pCatList = (ListPtr)GetObjectPtr(MarksCategoriesList);
RectangleType lstRect;
Int lstWidth, textLen, i, j, choicesOffset = 0;
CharPtr choices;
Word selectedIndex = -1, catSelected;
VoidHand recHandle;
Err error;
UInt theCategory, recordNum = 0, totalItems, displayedItems = 0;
Boolean fits;
CharPtr pTitle = 0;
catSelected = LstGetSelection(pCatList);
if (catSelected > 1)
{
theCategory = CategoryFind(gDBHandle, LstGetSelectionText(pCatList,
catSelected));
} else {
theCategory = dmAllCategories;
}
[remaining code omitted]
----------------------------------------------------------------------------
--------------------
Now the problem is happening with the line: if (catSelected > 1)
Common sense tells me that if catSelected == 3, then (3 > 1) is true, so
this expression should evaluate as true. It doesn't. Ever. When I run it
through the debugger, it doesn't even stop on the if statement, it just
skips down to the else block. One other strange thing that I noticed while
watching the debugger. When catSelected is assigned, these variables:
error
displayedItems
selectedIndex
all get set to the exact same value, for no apparent reason. I'm certain
these two issues are related, but I can't for the life of me imagine why
this would be happening. Any ideas?
-Jeff
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/