|
Zugg |
Posted: Mon Apr 18, 2005 11:31 pm
Changes to zApp events |
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri May 06, 2005 4:46 pm |
Actually, zApp already does this. I should have mentioned this before, but whenever you reference any script in a plugin (whether its an event script or just a normal button or action script), zApp always appends the script in the plugin to the *end* of the previous script.
Scripts are added in the order that the plugins are loaded.
I thought about allowing a plugin to execute *before* the existing script, but from a security point of view, if a script is in an encrypted ZXL file, I don't want the user to have any way to bypass this script execution.
Anyway, internally zApp doesn't actually append the scripts. Instead, zApp has a list of scripts for each "script event". Normal scripts are implemented as events now. For example, the default button script is actually the OnClick event handler. Since every event has a list of scripts, zApp just executes the scripts in the list one by one in the order they were defined.
For example, even in your main application you can do this:
Code: |
<BUTTON...>
<SCRIPT Event='OnClick'>
...first script goes here...
</SCRIPT>
...do some more stuff here
<SCRIPT Event='OnClick'>
...this second script gets executed after the first...
</SCRIPT>
</BUTTON> |
Sorry for not mentioning this anywhere before. I guess I need a section on scripts and events in the Plugin reference.
There *is* a way to completely override a script, as long as it's not protected. Instead of using the SCRIPT tag, you can assign a string directly to the "Onxxx" property. For example: Button.OnClick = "this is my script". When you perform this direct assignment, then the first script in the list (the primary script) is replaced with your new value.
While you can replace the primary script in this way, there is no way to clear or replace any plugin scripts. I might add a way to do that in the future.
In addition, scripts can be "protected". If a script is defined within an encrypted ZXL file, then only code within that same ZXL file is allowed to replace scripts. Once you are in a plugin, you can't replace scripts from a ZXL file. In a normal text ZML file, you can set the "Lock" property of a script to True. That prevents other code from modifying it.
Anyway, I think the system works as requested without needing a lot of wierd syntax. It just works like you'd expect it to work. |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|