mhmda Posted December 7, 2014 Share Posted December 7, 2014 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, 1 Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted December 7, 2014 Administrators Share Posted December 7, 2014 Add IgnoreWidth := True; Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted December 7, 2014 Administrators Share Posted December 7, 2014 Instead of: JSConfig('style',''''+style+''''); JSConfig('iconCls',''''+icn+''''); if flex>0 then JSConfig('flex',inttostr(flex)); Better syntax: JSConfig('style',[style]); JSConfig('iconCls',[icn]); if flex>0 then JSConfig('flex',[flex]); Quote Link to comment Share on other sites More sharing options...
mhmda Posted December 7, 2014 Author Share Posted December 7, 2014 Thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.