If you were using a regular field for the column, you could do it in the
callback for a LoadData procedure. In your form event handler, in the
frmOpenEvent add TblSetLoadDataProcedure(table, column, CallBack);
Where table is a pointer to the table object, column is the desired column,
and CallBack is a function you write:
static Err CallBack(VoidPtr table,
Word row, Word column, Boolean editable,
VoidHand *dataH, WordPtr dataOffset,
WordPtr dataSize, FieldPtr fld) {
FieldAttrType attr;
// Set table field attributes
FldGetAttributes (fld, &attr);
attr.justification= rightAlign.; // right align text in field
FldSetAttributes(fld, &attr);
// do any other initialization needed
return 0;
}
Since you're drawing the field yourself via a CustomTableItem, I assume
you've got a callback already that you're using to draw the item. Would you
not just draw the label right justified? You can compute the width of the
string in the desired font, and then shift the x offset over enough to right
justify the label when you draw it. Or you can just use a non-editable right
justified field.
-----Original Message----- Mark asked:
Subject: Right justifying text in a table
From: Marc Campbell
Is there an easy way to right justify text for an entire column in a table?
I have a table similar to the address book edit view, and the first column
is simply labels. I am hoping there is an easy way to right justify all
text in that column. I am using CustomTableItem for this column.
Thanks,
Marc