×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    19

    ChoiceGroup Command Action HELP

    I am trying to set up and Exclusive choicegroup that i can use to determine which form the user will proceed to next. However, when I make the commandAction function it does not recognize the choicegroup that I declared. I don't think I'm supposed to instantiate the group again inside the commandAction, but right now that's the only way I can get it to compile. Here is some of my code...

    public void commandAction(Command c, Item item){
    ChoiceGroup cgIncidentType = new ChoiceGroup("Category", Choice.EXCLUSIVE);

    if(c==exitCommand)
    {
    exitRequested();
    destroyApp(true);
    notifyDestroyed();
    }
    if(c == Next1){
    if(item == cgIncidentType)
    {

    if(cgIncidentType.getSelectedIndex()==5)
    {//go to last menu option (gang)
    javax.microedition.lcdui.Display.getDisplay(this).setCurrent(SubGangID);
    flag1="6";
    } else if(cgIncidentType.getSelectedIndex()==4) {//go to suspicious activity page
    javax.microedition.lcdui.Display.getDisplay(this).setCurrent(SubSuspActivity);
    flag1="5";
    }

    }
    }


    }

    Right now the program doesn't do anything when I click the next button which is added to my choicegroup. Does anyone see a problem with my command setup????

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    170
    Hi,
    I would realize it with switch - case.
    If you whant to switch to an other form you have to use "display.setCurrent(yourForm);"

    import javax.microedition.lcdui.*;
    public Display display = Display.getDisplay(this);

    Now you can access the setCurent Function using the global Objekt display.

    This should work.

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    19
    its working now, thanks for the help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×