ChoiceGroup
is an Item
object, and to use commands like you describe you need ItemCommandListener:
A listener type for receiving notification of commands that have been invoked on Item objects. An Item can have
Commands
associated with it. When such a command is invoked, the application is notified by having the commandAction() method called on theItemCommandListener
that had been set on the Item with a call to setItemCommandListener()...
To set "play" command for the choicegroup, use method Item.addCommand(Command)
:
Tones.addCommand(Play); // add command to item
Tones.setItemCommandListener(/*... define item cmd listener*/); // set listener
Above code could be written eg right before invoking disp.setCurrent(frm)
in your code snippet.