Hello:

Hopefully someone can help me with table programming.  I have a table on my 
form that has 11 rows and 2 columns.  So the rows are more than will fit on the 
screen at any given time.  The problem that I'm having is that when I 
initialize the table with data I keep getting the following error message:

"field.c, Line:1916, No visible lines to allocate"

Here are the relevant bits from my code:


static Char *cLabels[] = {"Dept","Addr", 
"Addr2","City","State","Zip","Ctry","Tel","Fax","E-Mail","Web"};
MemHandle  gTextHandles[11];


void initTable(FormType* pForm)
{
        TableType *tablePtr;
        int i=0,rowsInTable=0;
        
        tablePtr = 
(TableType*)FrmGetObjectPtr(pForm,FrmGetObjectIndex(pForm,CT_Table));        
        
        rowsInTable = TblGetNumberOfRows(tablePtr);
        
        //Set the column types for the table
        for(i=0;i<rowsInTable;i++){
                TblSetRowSelectable(tablePtr,i,false);
                TblSetItemStyle(tablePtr,i,0,labelTableItem);
                TblSetItemPtr(tablePtr,i,0,cLabels[i]);
                
                TblSetItemStyle(tablePtr,i,1,textTableItem);
                TblSetRowUsable(tablePtr,i,false);
        }
        
        TblSetColumnUsable(tablePtr,0,true);
        TblSetColumnUsable(tablePtr,1,true);

        TblSetLoadDataProcedure(tablePtr,1,
                (TableLoadDataFuncPtr)contactViewGetDescription);
}

static Err contactViewGetDescription (void * table, Int16 row, UInt16 column,
        Boolean editable, MemHandle *textHP, UInt16 * textOffset, UInt16 * 
textAllocSize,
        FieldPtr fld)
{
                *textHP = gTextHandles[row];
                *textOffset = 0;
                *textAllocSize = MemHandleSize(*textHP);
        
        return (0);
}

void populatePage()
{
   //This method is called when a record is selected from a drop-down
        for(i=0;i<11;i++){
                MemHandleFree(gTextHandles[i]);
                gTextHandles[i] = 
MemHandleNew(StrLen(_currentRecord.fields[i+1])+1);
        str = MemHandleLock(gTextHandles[i]);
        StrCopy(str,_currentRecord.fields[i+1]);
                MemHandleUnlock(gTextHandles[i]);
                
                
TblMarkRowInvalid((TableType*)FrmGetObjectPtr(pForm,FrmGetObjectIndex(pForm,CT_Table)),i);
                
TblSetRowUsable((TableType*)FrmGetObjectPtr(pForm,FrmGetObjectIndex(pForm,CT_Table)),i,true);
        }
}

Thanks for your help!

Chris
-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to