Jump to content
uniGUI Discussion Forums
Sign in to follow this  
zanona

beforeinit in runtime

Recommended Posts

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

Share this post


Link to post
Share on other sites

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,

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×