addSymbol() - Example for vertical Alignment of a Table Column
You can use a panel reference for a map or as a header for a table column. The panel reference can be used as follows. The reference tableColumnRefGenericText_fixed.pnl contains a primitive text. The following code sets the rotation angle of the primitive text as well as the font.
public setText(string txt)
{
PRIMITIVE_TEXT1.text = txt;
langString f = "Arial,-1,19,5,75,0,0,0,0,0,Bold";
PRIMITIVE_TEXT1.font(f);
}
public rotateText(float angle)
{
PRIMITIVE_TEXT1.rotation = angle;
}
The following code adds lines to a table.
main()
{
TABLE1.columnMovingEnabled(true);
dyn_string d1, d2, d3, d4, d5, d6;
dyn_dyn_string fName, lName, col3, col4;
//The entries of the column First Name
d1=makeDynString("Jane");
d2=makeDynString("Max");
//The entries of the column 3
d3=makeDynString("+1 707 678 989");
d4=makeDynString("+49 151 345 567");
d5=makeDynString("USA");
d6=makeDynString("Germany");
// Transfer the entries to the dyn dyn field
fName[1]=d1;
fName[2]=d2;
col3[1]=d3;
col3[2]=d4;
col4[1]=d5;
col4[2]=d6;
//The entries of the column Last name
d1=makeDynString("Doe");
d2=makeDynString("Mustermann");
//Transfer the entries to the dyn dyn field
lName[1]=d1;
lName[2]=d2;
//Add the four rows
TABLE1.appendLines(6, "#1", fName, "#2", lName, "#3", col3, "#4", col4);
dyn_int rows, columns;
//Selection Mode
TABLE1.tableMode=TABLE_SELECT_MULTIPLE;
//Rows and Columns
rows=makeDynInt(0, 2);
columns=makeDynInt(0, 1,2,3);
}
This example shows how to use the reference tableColumnRefGenericText_fixed.pnl as a column header. For the syntax, see addSymbol().
main(mapping event)
{
addSymbol(self, "tableColumnRefGenericText_fixed.pnl", "ref0",
makeMapping("targetShape", "TABLE1",
"columnHeader", "#1"));
ref0.setText("First name");
ref0.rotateText(90); // 90 degrees
addSymbol(self, "tableColumnRefGenericText_fixed.pnl", "ref1",
makeMapping("targetShape", "TABLE1",
"columnHeader", "#2"));
ref1.setText("Last name");
ref1.rotateText(90);
addSymbol(self, "tableColumnRefGenericText_fixed.pnl", "ref2",
makeMapping("targetShape", "TABLE1",
"columnHeader", "#3"));
ref2.setText("Telephone");
ref2.rotateText(90);
addSymbol(self, "tableColumnRefGenericText_fixed.pnl", "ref3",
makeMapping("targetShape", "TABLE1",
"columnHeader", "#4"));
ref3.setText("Country");
ref3.rotateText(90);
}
Open the panel: