Skip to main content

Adding Menus to an existing Xlet

1 reply [Last post]
Joined: 2010-07-04

It seems the usual route is to have the GRIN application be the main application that runs an Xlet, has anyone had any success with having a normal xlet use GRIN extensively?

What I would like is an easy way to get input into the application, but implementing GRIN has been an afterthought. In my main Xlet, it has similar methods and purpose as the GrinXlet, but loading an image from an imagemap (the entire initialisation of the animation area) takes a long time, if it even loads.

I've been able to get an image up eventually, but when replaced with text it seems to flash once then disappear (if it shows up at all). What could be the cause of this? The xlet implements the right interfaces and calls the AnimationEngine.start in the start of the Xlet and initializsation of the engine is done in the initXlet.

Would there be an easier way to get input (as in a psuedo on screen keyboard) from the user in an Xlet?

Also, what does the exports command in GRIN do? Finding it difficult to find an explanation of its purpose.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-11-08

IMHO handling user input isn't the biggest benefit of using GRIN... as a matter of fact, how GRIN generally works is that the xlet that starts the show is responsible for passing in key input to the show, via calling show.handleKeyPressed() or show.handleKeyReleased(). In GrinXlet, the xlet is the one who is registering UserEventListener to the org.dvb.event.EventManager and passing along all captured events to the grin show, in userEventReceived(UserEvent) method. If you just want to get remote control input in your xlet, then you can just duplicate GrinXlet code for UserEvents, seems to me...

As of exports command, if you're asking about this, below,

exports ::= "exports" "segments" name_list
"features" name_list
"handlers" name_list ";"
[ "named_commands" name_list ]
# If this isn't set, then everything is public
# The names in name_list may contain wildcards like
# "*", "?", "[wxz]" and "[1-5]".
.. then it specifies the list of names that Java code can use to access objects during runtime, via show.getSegment(String name), show.getFeature(String name) etc. This option allows grin to throw away the names that's not exported and save some runtime memory.