Jump to content

beforeinit in runtime


zanona

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

Link to comment
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,

Link to comment
Share on other sites

  • 11 months later...

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

×
×
  • Create New...