Doh - I meant to include the code in the previous email...it follows.

If anyone can help, I'd be most appreciated.

John.

//Extract from form handle event
else if (event->eType == tblSelectEvent)
    {
        rowselected = true;
        tbl = GetObjectPtr(ViewTable);
        currentRow = event->data.tblSelect.row;
        column = event->data.tblSelect.column;
        currentrecord = TblGetRowID(tbl, currentRow);
        if (column == completedColumn)
        {
            if (TblGetItemInt (tbl, row, column) > 0)
                comp = true;
            else
                comp = false;
            ViewChangeCompleteStatus (row, comp);
        }

        handled = true;
    }

/***********************
* Function: ViewChangeCompleteStatus                                 *
* Objective: Change status of checkbox in ViewIssue                       *
************************/

static void ViewChangeCompleteStatus (Word row, Boolean comp)
{

    VoidHand tempH = NULL;
    RecordTypePtr temp = NULL;
    ULong offset;
    RecordTypePtr nilPtr = 0;
    Err error;

    //Update the record to reflect the new completion status.
    
    offset = (ULong) &nilPtr->completed;
    
    tempH = DmGetRecord(DB, currentrecord);
    if (tempH == 0) return;
    temp = MemHandleLock(tempH);
    error = DmWrite(temp, offset, &comp, sizeof(Boolean));
    MemPtrUnlock(temp);
    DmReleaseRecord(DB, currentrecord, true); 


    // If completed issues are hidden redraw the list form
    if (! showCompleted)
    {
        ApplyFilter();
        DmInsertionSort(IssueDB, (DmComparF *) &CompareIssueRecords, 0);
        FrmGotoForm(View);
    }
    // If completed items are viewed, update the table.
    else
        FrmGotoForm(View);
}

From: Dave Lippincott (view other messages by this author) 
Date: Thu, 16 Nov 2000 06:23:31 

--------------------------------------------------------------------------------

Check boxes do work in both directions (check and uncheck).  It sounds like
your handler logic is flawed.  If you could post some of the code, someone
on the list may be able to point out the exact problem.

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Thursday, November 16, 2000 9:07 AM
Subject: Problem with completing a to do-type record


>
> I've got an application that allows the user to mark a record 'complete'
in the same way as the standard To Do application.
>
> However, I've hit a slight snag, in that, it only seems to work one-way,
i.e. you can mark it as complete but cannot then unmark it.
>
> I've checked the sample code but I can't seem to find the problem. I'm
guessing it's something to do with the way table events are handled - can
anyone help?
>
> I've included the event handler and the function it calls.
>
> TIA,
>
> John.





-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to