TurboPower_iPro: Rename TIpHtml.FParent to TIpHtml.FControlParent. Better handling of TIpHtmlNodeBUTTON captions.

git-svn-id: trunk@64059 -
This commit is contained in:
wp 2020-10-23 10:14:02 +00:00
parent d2539a84b0
commit daa1794176

View File

@ -1818,6 +1818,7 @@ type
FValue: string; FValue: string;
FName: string; FName: string;
FInputType: TIpHtmlButtonType; FInputType: TIpHtmlButtonType;
function GetButtonCaption: String;
procedure SetInputType(const AValue: TIpHtmlButtonType); procedure SetInputType(const AValue: TIpHtmlButtonType);
procedure SetValue(const AValue: String); procedure SetValue(const AValue: String);
protected protected
@ -2107,7 +2108,7 @@ type
FDefaultFontSize: integer; FDefaultFontSize: integer;
ParmBuf: PChar; ParmBuf: PChar;
ParmBufSize: Integer; ParmBufSize: Integer;
FParent: TWinControl; FControlParent: TWinControl;
procedure ResetCanvasData; procedure ResetCanvasData;
procedure ResetWordLists; procedure ResetWordLists;
procedure ResetBlocks(Node: TIpHtmlNode); procedure ResetBlocks(Node: TIpHtmlNode);
@ -13234,7 +13235,7 @@ begin
FElementName := 'button'; FElementName := 'button';
Owner.FControlList.Add(Self); Owner.FControlList.Add(Self);
if Owner.DoneLoading then if Owner.DoneLoading then
CreateControl(Owner.FParent); CreateControl(Owner.FControlParent);
end; end;
destructor TIpHtmlNodeBUTTON.Destroy; destructor TIpHtmlNodeBUTTON.Destroy;
@ -13255,12 +13256,24 @@ begin
with TButton(FControl) do begin with TButton(FControl) do begin
Enabled := not Self.Disabled; Enabled := not Self.Disabled;
Caption := Value; Caption := GetButtonCaption;
OnClick := ButtonClick; OnClick := ButtonClick;
CalcSize; CalcSize;
end; end;
end; end;
function TIpHtmlNodeBUTTON.GetButtonCaption: String;
begin
if FValue = '' then
case FInputType of
hbtSubmit: Result := SHtmlDefSubmitCaption;
hbtReset: Result := SHtmlDefResetCaption;
hbtButton: Result := '';
end
else
Result := FValue;
end;
procedure TIpHtmlNodeBUTTON.Reset; procedure TIpHtmlNodeBUTTON.Reset;
begin begin
end; end;
@ -13308,21 +13321,17 @@ begin
lCanvas := TFriendPanel(Parent).Canvas; lCanvas := TFriendPanel(Parent).Canvas;
oldFontSize := lCanvas.Font.Size; oldFontSize := lCanvas.Font.Size;
Width := TFriendPanel(Parent).Canvas.TextWidth(Caption) + 40; Width := TFriendPanel(Parent).Canvas.TextWidth(Caption) + 40;
Height := TFriendPanel(Parent).Canvas.TextHeight(Caption) + 10; Height := TFriendPanel(Parent).Canvas.TextHeight('Tg') + 10;
lCanvas.Font.Size := oldFontSize; lCanvas.Font.Size := oldFontSize;
end; end;
end; end;
procedure TIpHtmlNodeBUTTON.SetInputType(const AValue: TIpHtmlButtonType); procedure TIpHtmlNodeBUTTON.SetInputType(const AValue: TIpHtmlButtonType);
begin begin
if FInputType = AValue then exit;
FInputType := AValue; FInputType := AValue;
if Owner.DoneLoading and (FControl <> nil) and (Self.Value = '') then
if Owner.DoneLoading and (FControl <> nil) and (Self.Value = '') then; SetValue(GetButtonCaption);
case FInputType of
hbtSubmit : SetValue(SHtmlDefSubmitCaption);
hbtReset : SetValue(SHtmlDefResetCaption);
hbtButton : ;
end;
end; end;
procedure TIpHtmlNodeBUTTON.SetValue(const AValue: String); procedure TIpHtmlNodeBUTTON.SetValue(const AValue: String);
@ -13331,7 +13340,7 @@ begin
FValue := AValue; FValue := AValue;
if Owner.DoneLoading and (FControl <> nil) then if Owner.DoneLoading and (FControl <> nil) then
begin begin
(FControl as TButton).Caption := AValue; (FControl as TButton).Caption := GetButtonCaption;
CalcSize; CalcSize;
end; end;
end; end;
@ -15099,7 +15108,7 @@ begin
HyperPanel.OnHotClick := FViewer.HotClick; HyperPanel.OnHotClick := FViewer.HotClick;
HyperPanel.OnClick := FViewer.ClientClick; HyperPanel.OnClick := FViewer.ClientClick;
HyperPanel.TabStop := FViewer.WantTabs; HyperPanel.TabStop := FViewer.WantTabs;
FHtml.FParent := HyperPanel; FHtml.FControlParent := HyperPanel;
FHtml.OnScroll := HyperPanel.ScrollRequest; FHtml.OnScroll := HyperPanel.ScrollRequest;
FHtml.OnControlClick := ControlClick; FHtml.OnControlClick := ControlClick;
FHtml.OnControlClick2 := ControlClick2; FHtml.OnControlClick2 := ControlClick2;