×

Discussion Board

Results 1 to 6 of 6

Hybrid View

  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    4

    Question Getting back to the same form

    I have a form with 4 StringItem.And 3 of them are attached with different StringItemCommand. I want to get back to the same form clicking one of the three StringItems(Button) making some modification in the 4th String Item(actually clicking on of those will change an int variable.)
    Getting stuck with this.

  2. #2
    Registered User
    Join Date
    Mar 2013
    Location
    United Kingdom
    Posts
    161

    Re: Getting back to the same form

    Quote Originally Posted by faysal515 View Post
    I have a form with 4 StringItem.And 3 of them are attached with different StringItemCommand. I want to get back to the same form clicking one of the three StringItems(Button) making some modification in the 4th String Item(actually clicking on of those will change an int variable.)
    Getting stuck with this.
    Can you give us a sample midlet/code to demonstrate this?

  3. #3
    Registered User
    Join Date
    May 2013
    Posts
    4

    Re: Getting back to the same form



    When I'll click the high or low StringItem(button) it will get back to the same page.but the guessed number will be changed. Where should I write the method?

  4. #4
    Registered User
    Join Date
    Mar 2013
    Location
    United Kingdom
    Posts
    161

    Re: Getting back to the same form

    To me that looks like you don't need to move to another form, you just want to update the number label when a button is clicked? Surely it's just a case of adding an addActionListener event on both of your buttons and implementing whatever logic you have to update the number label?

  5. #5
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,104

    Re: Getting back to the same form

    One way is to create a subclass of your StringItem which holds a new field. That new field is a reference to its screen.

  6. #6
    Registered User
    Join Date
    May 2013
    Posts
    4

    Re: Getting back to the same form

    I tried your way.Surely the number changes but not in my way.I observed that whenever I click whether high or low , the function which I'm calling is executed twice.
    This is StringItem Code.
    else if (item == stringItem3) {
    if (command == highItemcmd) {
    // write pre-action user code here
    updatehigh();

    switchDisplayable(null, getChance1());
    // write post-action user code here

    }
    } else if (item == stringItem4) {
    if (command == lowItemcmd) {
    // write pre-action user code here
    updatelow();


    switchDisplayable(null, getChance1());
    my custom made functions
    public void updatehigh(){
    lend=mid;
    mid=(fend+lend)/2-extra;

    }

    public void updatelow(){
    fend=mid;
    mid=(fend+lend)/2-extra;


    }
    public void flush(){
    fend=0;
    lend=100;
    extra=(fend+lend)%2;
    mid=(fend+lend)/2+extra;
    counter=0;
    g="";

    }
    When the game is done, I let the user to choose whether they want to play again?
    When they fire play again button,I call the flush method which basically reinitialize all the variable.But it doest seem working.
    Let me help solve why are my functions are executing twice?

Similar Threads

  1. How to set Form to Back in LWUIT??
    By rajan701v in forum Mobile Java General
    Replies: 6
    Last Post: 2011-02-17, 11:00
  2. problem in back and forth of LWUIT form and normal form in j2me
    By jugal.inani in forum Mobile Java General
    Replies: 8
    Last Post: 2010-06-09, 12:24
  3. want to open form when back to first ap , how?
    By nokia_lin in forum Symbian User Interface
    Replies: 0
    Last Post: 2009-04-15, 02:41
  4. How can i get a form's back button event?
    By advocatee in forum Symbian C++
    Replies: 1
    Last Post: 2003-07-28, 04:09
  5. cannot jump from canvas back to form
    By prakala in forum Mobile Java General
    Replies: 1
    Last Post: 2003-05-23, 02:47

Posting Permissions

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