CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

JQButton and Action

by mkarimpour » 29 Sep 2013 08:35

Dear Friend,

I have a JQButton and ActionList with one action named "actEdit". This action have OnExecute routine to do something.
Then I assign JQButton.Action to actEdit. Now when I click the button OnExecute event was fired. Now I want to reach the component that run this action. The code something like this:
procedure actEditExecute(Sender: TObject);
var
AC: TComponent;
begin
AC:= TAction(Sender).ActionComponent;
WebApplication.ShowMessage(AC.ClassName); <-- AV raise here
end;
I debug it and found that Sender parameter is TIWCGJQButtonOptions, so for reaching to component instance you must use TIWCGJQButtonOptions(Sender).Button;
In the VCL when we do same with the TBitBtn component or else, TAction(Sender).ActionComponent is button or else.
I think it is a bug of your component. If anyone wants to write cross code (win and web) with actions, one code will not work.
When we write this code at Action.OnExecute then TAction(Sender).ActionComponent must the component that run the action(Action assigned to it).

Your Sincerely
Mehdy Karimpour
Your Sincerely
Mehdy Karimpour
mkarimpour
 
Posts: 77
Joined: 08 Jul 2012 07:21

by Jorge Sousa » 29 Sep 2013 17:19

Hi mkarimpour

You're absolutelly right! Is a "we didn't see that coming" bug :)

To be fixed in next releases.

Thanks
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by mkarimpour » 12 Oct 2013 10:23

cgdevtools_support wrote:Hi mkarimpour

You're absolutelly right! Is a "we didn't see that coming" bug :)

To be fixed in next releases.

Thanks



Core
- Fixed: resize of controls in design-time (Chromium)
- Implemented: Action Sender


Dear Friend,
I downloaded the latest beta release 1.7.0.3010 and tested.
In this release the Sender of Action.OnExecute event is TAction, but the TAction(Sender).ActionComponent is always nil.
Suppose, one action assign to two JQButton or more. You must do something like this on your Action.OnExexute event handler:

if TAction(Sender).ActionComponent = JQButton1 then
// do something
else
if TAction(Sender).ActionComponent = JQButton2 then
// do something
else
...
if TAction(Sender).ActionComponent = JQButtonN then
// do something;

PS: VCL action behavior is yardstick.

Your Sincerely
Mehdy Karimpour
Your Sincerely
Mehdy Karimpour
mkarimpour
 
Posts: 77
Joined: 08 Jul 2012 07:21

by Jorge Sousa » 12 Oct 2013 15:44

Hi Mehdy

Yes you're right, we forgot to assign TBasicAction.ActionComponent

It's done now for next releases

Regards
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by mkarimpour » 16 Oct 2013 11:02

cgdevtools_support wrote:Hi Mehdy

Yes you're right, we forgot to assign TBasicAction.ActionComponent

It's done now for next releases

Regards


Dear Friend,

I downloaded the latest beta release 1.7.0.3027 and tested.

1.7.0.3016

Core:
If Action is used TBasicAction.ActionComponent is updated before calling the Event


The problem was not solved. The TAction(Sender).ActionComponent is still nil. I wrote before for you:
Suppose, one action assign to two JQButton or more. You must do something like this on your Action.OnExexute event handler:

if TAction(Sender).ActionComponent = JQButton1 then
// do something
else
if TAction(Sender).
ActionComponent = JQButton2 then
// do something
else
...
if TAction(Sender).ActionComponent = JQButtonN then
// do something;

* VCL action behavior is yardstick.
Your Sincerely
Mehdy Karimpour
mkarimpour
 
Posts: 77
Joined: 08 Jul 2012 07:21

by Jorge Sousa » 16 Oct 2013 14:26

Hi Mehdy

This was a problem with the change, it's now fixed in next release.

Regards
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58


Return to JQButton & JQButtonSet

cron

Who is online

Users browsing this forum: No registered users and 2 guests

Contact Us.