* Place labels in the header of a THTMLDatasetFormGridProducer

* Changed the domain of a loop, so that all tablecells are drawn in the same manner

git-svn-id: trunk@8104 -
This commit is contained in:
joost 2007-07-19 22:00:04 +00:00
parent 4ecda7164f
commit faf94383d0

View File

@ -185,6 +185,7 @@ type
FSize: integer; FSize: integer;
FSpanned: boolean; FSpanned: boolean;
FValue: string; FValue: string;
procedure WriteLabel(aWriter: THTMLWriter);
public public
function WriteContent (aWriter : THTMLWriter) : THTMLCustomElement; function WriteContent (aWriter : THTMLWriter) : THTMLCustomElement;
function WriteHeader (aWriter : THTMLWriter) : THTMLCustomElement; function WriteHeader (aWriter : THTMLWriter) : THTMLCustomElement;
@ -647,7 +648,7 @@ begin
aWriter.StartTableRow; aWriter.StartTableRow;
with tabledef do with tabledef do
begin begin
for r := 0 to count-2 do for r := 0 to count-1 do
with TTableCell (Items[r]) do with TTableCell (Items[r]) do
begin begin
if CellType <> ctSpanned then if CellType <> ctSpanned then
@ -664,7 +665,7 @@ begin
aWriter.StartTableRow; aWriter.StartTableRow;
end; end;
end; end;
TTableCell(Items[Count-1]).WriteContent(aWriter); // TTableCell(Items[Count-1]).WriteContent(aWriter);
end; end;
aWriter.EndTableRow; aWriter.EndTableRow;
aWriter.Endtablebody; aWriter.Endtablebody;
@ -1026,9 +1027,9 @@ procedure THTMLDatasetFormGridProducer.ControlToTableDef (aControldef : TFormFie
end; end;
begin begin
if assigned (aControlDef.FField) then if assigned (aControlDef.FField) and not IsHeader then
PlaceFieldValue; PlaceFieldValue;
if FSeparateLabel and (aControlDef.LabelCaption <> '') then if (IsHeader or FSeparateLabel) and (aControlDef.LabelCaption <> '') then
PlaceLabel; PlaceLabel;
end; end;
@ -1046,17 +1047,18 @@ end;
{ TTableCell } { TTableCell }
function TTableCell.WriteContent(aWriter: THTMLWriter) : THTMLCustomElement; procedure TTableCell.WriteLabel(aWriter: THTMLWriter);
var HasLink : boolean;
begin
HasLink := (Link <> '');
if HasLink then
aWriter.Anchor(Value).href := Link
else
aWriter.Text (Value);
end;
procedure WriteLabel;
var HasLink : boolean; function TTableCell.WriteContent(aWriter: THTMLWriter) : THTMLCustomElement;
begin
HasLink := (Link <> '');
if HasLink then
aWriter.Anchor(Value).href := Link
else
aWriter.Text (Value);
end;
procedure WriteTextArea; procedure WriteTextArea;
begin begin
@ -1139,7 +1141,7 @@ begin
WriteTextArea WriteTextArea
else else
WriteInput; WriteInput;
ctLabel : WriteLabel; ctLabel : WriteLabel(aWriter);
ctProducer : WriteProducer; ctProducer : WriteProducer;
end; end;
Endtablecell; Endtablecell;
@ -1165,17 +1167,12 @@ begin
align := AlignHorizontal; align := AlignHorizontal;
valign := AlignVertical; valign := AlignVertical;
end; end;
if CellType <> ctLabel then case CellType of
begin ctEmpty : ;
s := FormField.LabelCaption; ctLabel : WriteLabel(aWriter);
if self.Link <> '' then // ctProducer : WriteProducer;
aWriter.Anchor(s).href := self.Link end;
else Endtableheadcell;
aWriter.Text (s);
end
else
aWriter.Text ('');
Endtablecell;
result := c; result := c;
end; end;
end; end;