Jump to content

[mobile] How to remove a jsconfig property from parent control?


mhmda

Recommended Posts

Hello,

 

Let us say that I want to create my OWN button which inherent from 'TUnimButton', and I want to add several config properties to it: iconCls,style and flex I would do:

Type
  TmMYButton = class(TUnimButton)
  private
    Fstyle: string;
    FiconCls: Ticons;
    Fflex: integer;
    procedure Setstyle(const Value: string);
    procedure SeticonCls(const Value: Ticons);
    procedure Setflex(const Value: integer);
  protected
    procedure ConfigJSClasses(ALoading: Boolean); override;
    procedure LoadCompleted; override;
  public
    constructor Create(AOwner:TComponent); override;
  published
  property style:string read Fstyle write Setstyle;
  property iconCls:Ticons read FiconCls write SeticonCls;
  property flex:integer read Fflex write Setflex;
end;

And in loadcomplete I use this code, to add my properties to the mybutton config:

type THackControl=class(TUniControl);
procedure TmMYButton.LoadCompleted;
var
 icn:string;
begin
  inherited;
if FiconCls<>iNon then
 icn:= GetEnumName(TypeInfo(Ticons),integer(FiconCls))
else
 JSConfig('style',''''+style+'''');
 JSConfig('iconCls',''''+icn+'''');
 if flex>0 then JSConfig('flex',inttostr(flex));
end;

My proplem is: The base class for my button is 'TUnimButton' and it has other config properties like: width,height.... I want to remove for example the 'width' property from base class 'TUnimButton' so when the config sent to brwoser it will NOT contain the 'width' property, how can I do that?

 

This is a unitouch code sent to browser:

O2F=new Ext.Button({id:"O2F_id",text:"UnimButton1",width:225,height:47,left:48,top:144});

It is not only about specific property it is all about making the development more easy for us and less depended on unitouch component future updates, So we feel that we are sometimes tied with these properties that we don't want or we want to change and we don't have the ability to change them (not for my own need, but for the logical behavior of such component in real production app), so our solution is to create inherent component and add any property or any thing we want. BUT how can I 'remove' property from config which declared in parent class?

 

Any suggestion would be great!

 

Thank you,

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...