get_last
adys
Junior Member
Is its safe to call get last from a function that called from the EVENT and not inside the Event code itself?
I mean if I have button event, and in the button event I call to function doX that call to function doY. inside doY i need the Tp that cause the event, so I call get_last with my global TP_LIST.
That works ok, I just wonder if that is safe and if what will happend if some event will enter in multiy TP enviroment.
thanks
Ady.
I mean if I have button event, and in the button event I call to function doX that call to function doY. inside doY i need the Tp that cause the event, so I call get_last with my global TP_LIST.
That works ok, I just wonder if that is safe and if what will happend if some event will enter in multiy TP enviroment.
thanks
Ady.
Comments
-
Pass the TP number to the function, this way you can have multiple panels using the function.
DEFINE_FUNCTION whatEver(integer nPNL) { //nPNL is your get_last panel number } //############################################# BUTTON_EVENT[dTP,btArray] { PUSH: { whatEver(get_last(dTP)); } } -
That what I am trying to avoid

I have lots of written code that need to be changed - or to pass the TP or just to call get_last.
The question is if it safe, if there is a kind of build in protection on it -
I'm not really sure what you are asking but, you should have all events/functions look to the TP that triggered the event. If you are working in a large system with many TPs this is a MUST! It is good practice to store feedback in a structure and only send feedback to TPs that need to be updated.
-
I am just asking if its safe to ask get_last after some time that the event happend?
Or maybe I can get the new event data (event that I am still on the flow of the first event)?
An example:
BUTTON_EVENT
.....
get_last.
..
...
call Function X
call Function Y
..
Function Y Body
{
get_last
}
There is a chance that in the time between the button event and the get_last call inside function Y a new event will trigger.
The question is, what get_last will return? the new event TP of the current event TP? -
No, it's not safe. The value could have changed. In many cases, it's not likely, but it is possible. The best practice is to keep get_last inside the event handler, and pass the return value to your function.
-
DHawthorne wrote:No, it's not safe. The value could have changed. In many cases, it's not likely, but it is possible. The best practice is to keep get_last inside the event handler, and pass the return value to your function.
Thanks, that what I wanted to know. -
DHawthorne wrote:The best practice is to keep get_last inside the event handler, and pass the return value to your function.
Isn't that in a sense what the code snippet that GSLogic provided below does. The get_last function w/in the whatever function occurs in the Button_Event and its returned value is passed to the function whatever.Code: DEFINE_FUNCTION whatEver(integer nPNL) { //nPNL is your get_last panel number } //############################################# BUTTON_EVENT[dTP,btArray] { PUSH: { whatEver(get_last(dTP)); } }__________________
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums
