查看完整版本: 在table中为何显示不出来,麻烦高手们看看此程序。谢谢!

jiangmapin 2006-6-30 23:04

在table中为何显示不出来,麻烦高手们看看此程序。谢谢!

void TimerTableInit()
{  
        TableType *m_pTimerTable;
    Int16 rowsInTable;
    Int16 row;
    if(FrmGetActiveFormID()!=MainForm)
            return;
    if(!m_pTimerTable)
    {
        m_pTimerTable = (TablePtr) GetobjectPtr(MainTimerTable);
    }
    rowsInTable = TblGetNumberOfRows(m_pTimerTable);
    for (row = 0; row < rowsInTable; row++)
    {               
            TblSetItemStyle (m_pTimerTable, row, 0, customTableItem);
            TblSetRowUsable (m_pTimerTable, row, true);
            TblSetRowSelectable(m_pTimerTable,row, false);
    }
  
    TblSetCustomDrawProcedure(m_pTimerTable,0,TimerTableDrawCell);
    TblSetColumnUsable(m_pTimerTable,0,true);
    TblDrawTable(m_pTimerTable);       
}

/*void TimerTableDrawCellCallback(void *pTable, Int16 row, Int16 column, RectanglePtr bounds)
{

    return TimerTableDrawCell(pTable, row, column, bounds);
}*/

void TimerTableDrawCell( void *pTable, Int16 row, Int16 column, RectanglePtr bounds )
{   
    //column 0: elapse time value|total time value
    Int16 length=5;
    Char time[8];
    UInt32 playTime,milsec1;
    UInt8 min, sec,milsec;
    if(FrmGetActiveFormID()!=MainForm)
        return;
    MemSet(time,8,' ');
    // elapse time value|total time value
     if(column ==0)
     {
        // clock
        milsec1 = TimGetTicks();
        playTime = TimGetTicks()/100;
        //ErrMessage("playTime = %ld", playTime);
        min = playTime/60;
        sec = playTime%60;
        milsec = milsec1%100;
        time[0] = min/10;
        time[1] = min%10;
        time[2] = ':';
        time[3] = sec/10;
        time[4] = sec%10;
        time[5]=':';
        time[6]=milsec%10;
        time[7]=milsec%10;

      
        //}
        // if the file is vbr and Frame flage has't been set,
        // we just let the total time position show ' '.
        WinEraseRectangle( bounds, 0 );
        WinDrawChars(time,length,bounds->topLeft.x,bounds->topLeft.y);         
    }
    return;
}

页: [1]
查看完整版本: 在table中为何显示不出来,麻烦高手们看看此程序。谢谢!