Recent

Author Topic: TCustomEdit Text:=Name of component  (Read 5036 times)

99Percent

  • Full Member
  • ***
  • Posts: 160
TCustomEdit Text:=Name of component
« on: July 22, 2010, 12:08:47 am »
I am trying to make my own TCurrencyedit component and so far I have succeeded. My only gripe right now is that when setting the component in the form it assigns the name of the component to the Text property, which is obviously invalid in a numeric context.

I cannot find where this is done or how to disable it. Please help.

Lazarus 0.92.9 FPC 2.4.3 SVN 26610 Windows XP.

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: TCustomEdit Text:=Name of component
« Reply #1 on: July 22, 2010, 12:36:46 am »
Well, you can set your own value of Text property on the constructor of your class.

99Percent

  • Full Member
  • ***
  • Posts: 160
Re: TCustomEdit Text:=Name of component
« Reply #2 on: July 22, 2010, 12:45:12 am »
I have:
Code: [Select]
constructor TSCurrEdit.Create(AOwner: TComponent);
begin
  inherited Create (AOwner);
  FormatStr:= '%m';
  Value:=0.0;
  Text:='$0.00';
  Alignment:= taRightJustify;
end;   
But the Text assignment doesn't work, it still gets the 'SCurrEdit1' as its default Text

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: TCustomEdit Text:=Name of component
« Reply #3 on: July 22, 2010, 05:22:33 am »
You may want to know how Fshcomp does this.

 

TinyPortal © 2005-2018