Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which way that TAction has been fired?

Tags:

delphi

There are a lot of ways how user can trigger an action (TAction) execution: shortcut keys, toolbar button, popup menu button etc. Is it possible to get information how that action has been triggered?

I'm just thinking about implementation of activity log to figure out the most popular ways to use different features in GUI.

update

I need to collect some stats about how an user interact with application GUI.

It's not the best idea to create a separate action for every button just because you need to implement logging. Ulrich Gerhardt's answer looks suitable. I can assign a handler to TActionList.OnExecute event and write log from one place.

like image 976
Roman Yankovsky Avatar asked Mar 31 '11 14:03

Roman Yankovsky


People also ask

What are the four types of termination?

Involuntary termination. Voluntary termination. Wrongful termination. End of a work contract or temporary employment.

What is the meaning of get fired?

Getting fired means that an employee's job is terminated for reasons such as poor work performance or unethical behavior such as stealing company equipment. However, an employer can fire workers without any valid reason if they're at-will employees.


1 Answers

Maybe you can use ActionComponent:

Use ActionComponent to discern which client component caused this action to execute. For example, examine ActionComponent from an OnExecute event handler if you need to know what user action triggered this action.

When the user clicks a client control, that client sets ActionComponent before calling the action's Execute method. After the action executes, the action resets ActionComponent to nil (Delphi) or NULL (C++).

There is also TApplication.OnActionExecute, TActionList.OnExecute and probably more "hooks".

like image 172
Uli Gerhardt Avatar answered Sep 28 '22 11:09

Uli Gerhardt