Jump to content

Recommended Posts

Posted

Hello everyone,

Is it possible to somehow perform my function through ExtEvents

I create MyFunctionOnButtonClick (Sender: TObject) and replace TButton.onClick with it.

How can I use this MyFunctionOnButtonClick and replace TBUtton.ClientEvents.ExtEvents.click

My problem is:

1. I have my own OnClick control function for all buttons, and replace it with Form creation.

2. This function performs some actions on the server.

3. It's slow and I want to speed up and run the ClientSide function.

4. I guess this is possible by replacing ExtEvents.click with my feature, right?

 

I found some example, but dont know how to apply it:

or 

here I use it in a moment:

------------------ Form.Create

      IF Component.ClassType = TuniButton then
          TuniButton (Component).OnClick := MyFunctionOnButtonClick ;

------------  MyFunctionOnButtonClick

procedure MyFunctionOnButtonClick (Sender :TObject);

begin

ShowMessage ('ButtonClicked');

IsButtonClicked := True;

end;

 

I want to replace with:

      IF Component.ClassType = TuniButton then
          TuniButton (Component).ClientEvents.ExtEvents.Click := MyFunctionOnButtonClick ;

Posted

Hello,

1 hour ago, irigsoft said:

3. It's slow and I want to speed up and run the ClientSide function.

4. I guess this is possible by replacing ExtEvents.click with my feature, right?

You need write JavaScript code.

Posted
5 minutes ago, Sherzod said:

Hello,

You need write JavaScript code.

Thanks,

My code use some VCL components, external DLL s and  data from visual components to execute different functions on dll's,

like example :

GETFUNC - start function on POSFunction.dll (where are my functions plased)

OnBtnClick - > GETFUNC (SetPropValue,MyLabel.Caption, GetPropValue|myButton1|Caption);

OnBtnClick - > GETFUNC (GetFieldValue,MyDBGridMenu,EndPrice,nil);

OnBtnClick - > GETFUNC (CALCULATE,Result_1 * 1.20, 4);

OnBtnClick - > GETFUNC (SetPropValue,MyLabelResult.Caption, Result_3);

 

and so on.

 

 

Posted
3 minutes ago, irigsoft said:

My code use some VCL components, external DLL s and  data from visual components to execute different functions on dll's,

In this case, you should use a server-side handler.

Posted
3 minutes ago, Sherzod said:

In this case, you should use a server-side handler.

Ok, 

My problem is when click on some button, no mather what function executes, showmask wait some 2-3 seconds .

This i want to speed up.

Posted
Just now, irigsoft said:

My problem is when click on some button, no mather what function executes, showmask wait some 2-3 seconds .

Is it on the developer's machine? Or have you deployed to the server (If so, network speed, is there antivirus software installed)?..

Posted

I try it on different servers, and different client devices, even on server machine : localhost

Wait Showmask is 2 seconds.

1. I think, some client - server execute proccesses have wait time, how to analize this

2. If I use javascript on extEvents.click it is possible to get from VCL values, like: get label2.caption on javascript code?

3. If I use MyButton.ExtEvents.click, it is possible to combine VCL.MyButton.OnClick and Extevents.click?

Posted
14 minutes ago, irigsoft said:

2. If I use javascript on extEvents.click it is possible to get from VCL values, like: get label2.caption on javascript code?

Yes.

14 minutes ago, irigsoft said:

3. If I use MyButton.ExtEvents.click, it is possible to combine VCL.MyButton.OnClick and Extevents.click?

I don't fully understand what you mean when you say combine, but I guess in this case you will send a request to the server anyway.

Posted
2 minutes ago, Sherzod said:

Yes.

I don't fully understand what you mean when you say combine, but I guess in this case you will send a request to the server anyway.

In the begining on my project i try to create button.onClick and on same button.clientevents.extevent.click  functions , but button.onclick not execute if ExtEvents.click exist.

Posted
1 minute ago, irigsoft said:

In the begining on my project i try to create button.onClick and on same button.clientevents.extevent.click  functions , but button.onclick not execute if ExtEvents.click exist.

I couldn't reproduce this behavior. Can you make a simple testcase?

Posted

If I understand your answer correctly, if I use Button.OnClick will a request always be sent to the server?
I have to say that it is on the StandAlone Application, it may be delayed or for this reason

Posted
1 minute ago, Sherzod said:

I couldn't reproduce this behavior. Can you make a simple testcase?

I tried an older version, maybe that's the reason. Will try again with 1503

Posted

Is there a way to get value from visual components through javascript.

Now in my project I am looking for a component with Form.FindComponent for each panel, shape, frames and this can lead to a delay

Posted
2 minutes ago, Sherzod said:

Yes.

Okay, I'll explain a simple functionality and if you can give me advice on how to optimize it in combination javascript and vcl.

On btn.onclick I must get label1.caption from MyForm

get label2.Caption from MyForm.MyPanel2 and change value to MyForm.Label3 with results from label1 and label2

I use External dll, to set value Label3.caption, but if I must get values from label1 and label2 i use MyForm.FindComponent by name and after find it i get properties value

So:

1. When Click on button - how to get values from label1 and label2 by javascript

2. After get it I save result on uniMainmodule.variable - ResultVariable

3. Send ResultVariable value to external dll and wait to execution bring result from dll.

4. apply new value to label3.caption

 

Posted
12 minutes ago, irigsoft said:

Is there a way to get value from visual components through javascript.

 

1 minute ago, Sherzod said:

For example, for UniLabel1:


MainForm.UniLabel1.text;
\FMSoft\Framework\uniGUI\Demos\Desktop\ClientEvents-1

 

Posted
4 minutes ago, Sherzod said:

For example, for UniLabel1:


MainForm.UniLabel1.text;

 

If I use ExtEvent.click and want to set label3.caption to uniMainmodule. variable how to apply it?

like:

function click(sender, e, eOpts)
{
 uniMainmodule.MyVariable := MainForm.uniLabel1.caption

 uniMainmodule.MyVariable2 := MainForm.uniPanel1.uniGroupBox.uniLabel8.caption

}

after that on Button.OnClick

Send to external dll with function ChangedatawithDLL (Label4,Caption, uniMainModule.MyVariable + uniMainModule.MyVariable2)

Posted
9 minutes ago, irigsoft said:

Can You explain me, if i have Myfunction on uniMainmodule, how to execute it from ExtEvents.click, some example please if You can.

Only using the server side handlers.

Posted
7 minutes ago, irigsoft said:

thanks, in my case obviously only the server can perform all the functionality.

If you know how the function works (I mean the code), then you can try to port this code to JS.

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...