Header per colonne finkate su più righe in automatico
Header per colonne finkate con centratura a scelta git-svn-id: svn://10.65.10.50/trunk@5452 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
f42b7c405e
commit
2ff7eba156
@ -4267,18 +4267,52 @@ bool TForm::genera_intestazioni(
|
||||
header->destroy_field(k);
|
||||
|
||||
const word items = body->fields();
|
||||
TForm_string* s;
|
||||
for (word j=0;j<items;j++)
|
||||
{// Scans all body items to print, and append header items...
|
||||
TForm_item& fi = body->field(j);
|
||||
if (!fi.shown() || fi.is_section())
|
||||
continue;
|
||||
TForm_string* s = new TForm_string(header);
|
||||
s->id() = -1;
|
||||
s->set_x(fi.x());
|
||||
s->y() = y;
|
||||
s->set_prompt(fi.col_head());
|
||||
s->temp() = TRUE;
|
||||
header->add_field(s);
|
||||
char align='\0';
|
||||
if (fi.col_head()[0]=='@')
|
||||
{
|
||||
switch (fi.col_head()[1])
|
||||
{
|
||||
case 'C': // centered
|
||||
case 'c':
|
||||
align='c';
|
||||
break;
|
||||
case 'R': // right just
|
||||
case 'r':
|
||||
align='r';
|
||||
break;
|
||||
default: // left just
|
||||
align='l';
|
||||
break;
|
||||
}
|
||||
}
|
||||
TParagraph_string prompts(fi.col_head().mid(align ? 2:0),fi.width());
|
||||
// Paragraph_string has as many items as lines needed...
|
||||
for (int c=0;c < prompts.items(); c++)
|
||||
{
|
||||
TString p(prompts.get(c));
|
||||
switch (align)
|
||||
{
|
||||
case 'c':
|
||||
p.center_just(fi.width());
|
||||
break;
|
||||
case 'r':
|
||||
p.right_just(fi.width());
|
||||
break;
|
||||
}
|
||||
s = new TForm_string(header);
|
||||
s->id() = -1;
|
||||
s->set_x(fi.x());
|
||||
s->y() = y+c;
|
||||
s->set_prompt(p);
|
||||
s->temp() = TRUE;
|
||||
header->add_field(s);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user