zanona Posted August 30, 2017 Share Posted August 30, 2017 I need to load the beforeinit event in runtime but it does not work! Follow the code below! Procedure TMainmForm.setColorBack (vpComp: TUNIMDBNUMBEREDIT); Var VrsStr: string; Begin VrsStr: = 'beforeInit = function beforeInit (sender, config)'; VrsStr: = vrsStr + '{'; VrsStr: = vrsStr + 'config.maxLength = 10;'; VrsStr: = vrsStr + 'config.clearIcon = false;'; VrsStr: = vrsStr + 'config.inputCls =' 'DataeditMobile yellowBG' ''; VrsStr: = vrsStr + '}'; VpComp.ClientEvents.ExtEvents.Clear; VpComp.ClientEvents.ExtEvents.Add (vrsStr); End; I call the event in the wind form create SetColorBack (SP_Esf_L_OD); Thanks Zanona Link to comment Share on other sites More sharing options...
Sherzod Posted August 31, 2017 Share Posted August 31, 2017 Hi, You can not change beforeInit dynamically, only before the initialization of the control, for example: Only in these places: In Designtime (ClientEvents->UniEvents), OnFormCreate, When creating a control dynamically Best regards, Link to comment Share on other sites More sharing options...
sertatar76 Posted August 15, 2018 Share Posted August 15, 2018 Hi I wanted to clarify to the "When creating a control dynamically" I need to recreate chart. ... FreeAndNil(UniChart1); UniChart1 := TUniChart.Create(Self); UniChart1.ClientEvents.UniEvents.Add( 'chart.beforeInit=function chart.beforeInit(sender, config)' + '{config.colors = ["#556677", "#112233", "#995577]}'); ... It not work. Link to comment Share on other sites More sharing options...
Sherzod Posted August 15, 2018 Share Posted August 15, 2018 Hi, Did you assign a name to the component? Link to comment Share on other sites More sharing options...
sertatar76 Posted August 16, 2018 Share Posted August 16, 2018 Probably not, I did not quite understand what was meant Link to comment Share on other sites More sharing options...
Sherzod Posted August 16, 2018 Share Posted August 16, 2018 UniChart1.Name := ? Link to comment Share on other sites More sharing options...
sertatar76 Posted August 16, 2018 Share Posted August 16, 2018 Thanks, what you need. Added name and it works Link to comment Share on other sites More sharing options...
Recommended Posts