Skip to main content

accessing form object..

1 reply [Last post]
Joined: 2008-12-18

Hi.Is it possible to access current executing form object..?if can do that..


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-15

It sounds like what you want is to get access to the form that has been set current on the display object.

So you have done something like this in your startApp() method.
Form f = new Form("");

And maybe in the command listener you want to access the Form so you would do something like this:

Form curFrame = (Frame) Display.getDisplay(this).getCurrent();

This assumes that the MIDlet is the commandlistener, or you could have a singleton in your MIDlet so that you would have something like this in the MIDlet class.

public class MyApp extends MIDlet
public static final MIDlet self;
public MyApp() { self = this; }

Then the line would read:
Form curFrame = (Frame) Display.getDisplay(MyApp.self).getCurrent();