mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 06:18:21 +02:00
IDE: disable csSetCaption when creating component, caption is set during loading OR when creating a new component, but not both, needed for empty caption
git-svn-id: trunk@21472 -
This commit is contained in:
parent
f5c2d8ef36
commit
074aa39eb1
@ -1568,8 +1568,11 @@ var
|
||||
NewComponent:=NewCI.Component;
|
||||
|
||||
// set initial properties
|
||||
if NewComponent is TControl then
|
||||
if NewComponent is TControl then begin
|
||||
TControl(NewComponent).Visible:=true;
|
||||
if csSetCaption in TControl(NewComponent).ControlStyle then
|
||||
TControl(NewComponent).Caption:=NewComponent.Name;
|
||||
end;
|
||||
if Assigned(FOnSetDesigning) then
|
||||
FOnSetDesigning(Self,NewComponent,True);
|
||||
|
||||
|
@ -874,6 +874,8 @@ var
|
||||
NewName: string;
|
||||
IsInherited: Boolean;
|
||||
Action: TModalResult;
|
||||
OldSetCaption: boolean;
|
||||
AControl: TControl;
|
||||
begin
|
||||
Result:=-1;
|
||||
FContextObject:=ContextObj;
|
||||
@ -899,7 +901,16 @@ begin
|
||||
NewName := FCurReadJITComponent.ClassName;
|
||||
if NewName[1] in ['T', 't'] then
|
||||
System.Delete(NewName, 1, 1);
|
||||
if FCurReadJITComponent is TControl then
|
||||
AControl:=TControl(FCurReadJITComponent)
|
||||
else
|
||||
AControl:=nil;
|
||||
OldSetCaption:=(AControl<>nil) and (csSetCaption in AControl.ControlStyle);
|
||||
if OldSetCaption then
|
||||
AControl.ControlStyle:=AControl.ControlStyle-[csSetCaption];
|
||||
FCurReadJITComponent.Name := NewName;
|
||||
if OldSetCaption then
|
||||
AControl.ControlStyle:=AControl.ControlStyle+[csSetCaption];
|
||||
end;
|
||||
except
|
||||
on E: Exception do begin
|
||||
@ -975,6 +986,7 @@ var
|
||||
Instance:TComponent;
|
||||
ok: boolean;
|
||||
Action: TModalResult;
|
||||
OldSetCaption: boolean;
|
||||
begin
|
||||
Result:=-1;
|
||||
Instance:=nil;
|
||||
@ -1002,8 +1014,16 @@ begin
|
||||
TControl(Instance).ControlStyle+[csNoDesignVisible];
|
||||
// finish 'create' component
|
||||
Instance.Create(nil);
|
||||
if NewComponentName<>'' then
|
||||
if NewComponentName<>'' then begin
|
||||
// set Name, without changing Caption
|
||||
OldSetCaption:=(Instance is TControl)
|
||||
and (csSetCaption in TControl(Instance).ControlStyle);
|
||||
if OldSetCaption then
|
||||
TControl(Instance).ControlStyle:=TControl(Instance).ControlStyle-[csSetCaption];
|
||||
Instance.Name:=NewComponentName;
|
||||
if OldSetCaption then
|
||||
TControl(Instance).ControlStyle:=TControl(Instance).ControlStyle+[csSetCaption];
|
||||
end;
|
||||
DoRenameClass(FCurReadClass,NewClassName);
|
||||
ok:=true;
|
||||
//debugln('[TJITForms.DoCreateJITComponent] Initialization was successful! FormName="',NewFormName,'"');
|
||||
|
@ -4326,8 +4326,8 @@ begin
|
||||
|
||||
// Figure out where we want to put the new form
|
||||
// if there is more place left of the OI put it left, otherwise right
|
||||
new_x:=ObjectInspector1.Left+ObjectInspector1.Width; //+60;
|
||||
new_y:=MainIDEBar.Top+MainIDEBar.Height; //+80;
|
||||
new_x:=ObjectInspector1.Left+ObjectInspector1.Width;
|
||||
new_y:=MainIDEBar.Top+MainIDEBar.Height;
|
||||
if screen.width-new_x>=ObjectInspector1.left then inc(new_x, 60) else new_x:=16;
|
||||
if screen.height-new_y>=MainIDEBar.top then inc(new_y, 80) else new_y:=24;
|
||||
|
||||
@ -4344,6 +4344,9 @@ begin
|
||||
NewComponent:=CInterface.Component;
|
||||
if NewComponent is TCustomForm then
|
||||
TControl(NewComponent).Visible := False;
|
||||
if (NewComponent is TControl)
|
||||
and (csSetCaption in TControl(NewComponent).ControlStyle) then
|
||||
TControl(NewComponent).Caption:=NewComponent.Name;
|
||||
NewUnitInfo.Component := NewComponent;
|
||||
CreateDesignerForComponent(NewComponent);
|
||||
|
||||
|
@ -809,7 +809,7 @@ type
|
||||
{* Note on TControl.Caption
|
||||
* The VCL implementation relies on the virtual Get/SetTextBuf to
|
||||
* exchange text between widgets and VCL. This means a lot of
|
||||
* (unnecesary) text copies.
|
||||
* (unnecessary) text copies.
|
||||
* The LCL uses strings for exchanging text (more efficient).
|
||||
* To maintain VCL compatibility, the virtual RealGet/SetText is
|
||||
* introduced. These functions interface with the LCLInterface. The
|
||||
|
@ -2567,7 +2567,6 @@ begin
|
||||
(csSetCaption in ControlStyle) and not (csLoading in ComponentState) and
|
||||
(Name = Text) and
|
||||
((Owner = nil) or not (Owner is TControl) or not (csLoading in TControl(Owner).ComponentState));
|
||||
|
||||
inherited SetName(Value);
|
||||
if ChangeText then Text := Value;
|
||||
end;
|
||||
@ -3905,8 +3904,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TControl.SetText(const Value: TCaption);
|
||||
begin
|
||||
//if CompareText(Name,'TextToFindComboBox')=0 then
|
||||
// debugln('TControl.SetText A ',DbgSName(Self),' GetText="',GetText,'" Value="',Value,'" FCaption="',FCaption,'"');
|
||||
//if CompareText(Name,'MainForm')=0 then debugln('TControl.SetText A ',DbgSName(Self),' GetText="',GetText,'" Value="',Value,'" FCaption="',FCaption,'"');
|
||||
if GetText = Value then Exit;
|
||||
|
||||
// Check if SetTextBuf is overridden, otherwise
|
||||
|
Loading…
Reference in New Issue
Block a user