![]() |
Send a param with catchEvent?
is it possible to send a param with catchEvent?
such as I have these in a GuiShowImgCtrl of a character PHP Code:
I know I could make two short functions but I was wondering if I could combine them. Both attempts when I try to send a param fails to get the event, my question is moreso how to determine which mouse button was pressed? |
afaik it's not possible without separate functions
use this instead of name when you're catching events. PHP Code:
PHP Code:
|
Quote:
|
Quote:
Proof, from a wiki article written by Stefan: PHP Code:
|
I'm pretty sure when you catch an event you'll get the same arguments as when you just handle the event directly (i.e. MyControl.onMouseDown(...)). And the first argument for onMouseDown() is the mouse button iirc:
PHP Code:
|
Why does the wiki show it as:
Quote:
|
Quote:
I suppose I could be wrong about this, but it seems very unlikely to me that Stefan would accept the name of an object rather than the object. It's like sending the player's account to a function instead of the player object—it doesn't make sense. In addition, Quote:
|
It would be funny if it coerced the object into its name, and then back into an object to actually apply the relevant changes to it in order to catch the event.
|
My whole question is, if it works, why is it allowed? I do use quotes for guiProfile names too, just purely because it highlights the names. Which I like.
|
Quote:
For example, you can check if a value exists like this: PHP Code:
Basically, relying on the coercing can make strange bugs crop up in edge cases that are hard to find until they actually break something. It's usually best to be explicit. I personally dislike dynamically typed languages and think they should slowly fade out of existence. |
| All times are GMT +2. The time now is 09:02 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.