x6plugins.buttonStandard
The Javascript method buttonStandard gives a button
object the standard behavior of responding to
a single keystroke and responding to enable/disable
commands.
Use this function when you create a custom button to
put onto the screen.
A custom button requires a uniquely named 'action' and
a hotkey. Actions reserved by andromeda are:
A custom button is created in PHP code like so:
<?php
# option 1, straight html
# option 2, or a link
$div = html('div');
$a = $div->h('a-void','My Action');
$a->hp['x6plugIn'] = 'buttonMine';
$a->hp['x6table'] = 'example'; // only if relevant
?>
Then you define a javascript x6plugIn that includes a
single function, main(), which is called when the button
is enabled and is clicked or the hotkey is pressed.
<script>
x6plugins.buttonMine = function(self,id,table) {
// the first line activates normal behavior,
// replace the values in this line with those
// appropriate to your button.
x6plugins.buttonStandard(self,'save','CtrlS');
// Then create the main function
self.main = function() {
// fire off some event
}
}
</script>