Several buttons and a listener?

Hello everyone, I basically have 3 buttons I need to have different actions. I tried to use separate listeners for each, but failed due to the error Illegalstateexception. Now, I tried to use if statements, but nothing happens when I click on them! Here is my code:

import com.samples.toolkit.ui.container.VerticalButtonFieldSet;

Import net.rim.device.api.ui.Field;
Import net.rim.device.api.ui.FieldChangeListener;
Import net.rim.device.api.ui.UiApplication;
Import net.rim.device.api.ui.component.ButtonField;
Import net.rim.device.api.ui.container.MainScreen;

/**
* A class that extends the class screen, which offers default standard
* BlackBerry GUI applications behavior.
*/
/ public final class screen extends StartScreen
{
/**
* Creates a new object StartScreen
*/
public StartScreen()
{
Set the displayed title of the screen
setTitle ("start screen");
VerticalButtonFieldSet buttonSetOne = new VerticalButtonFieldSet (USE_ALL_WIDTH);
buttonSetOne.setMargin (15,15,15,15);
        
final ButtonField newButton = new ButtonField ("New revision Guide", ButtonField.CONSUME_CLICK);
final openButton ButtonField = new ButtonField ("existing Open Guide", ButtonField.CONSUME_CLICK ");
final exitButton ButtonField is new ButtonField ("Quit the Application", ButtonField.CONSUME_CLICK);.
        
newButton.setMargin (5,5,5,5);
openButton.setMargin (5,5,5,5);
exitButton.setMargin (5,5,5,5);
        
buttonSetOne.add (newButton);
buttonSetOne.add (openButton);
buttonSetOne.add (exitButton);
        
Add (buttonSetOne);
        
buttonSetOne.setChangeListener (new FieldChangeListener() {}
' Public Sub fieldChanged (field field, int context) {}
If (field is (newButton))
{
UiApplication.getUiApplication () .pushScreen (new ChooseLayout());
}
ElseIf (field == (openButton))
{
UiApplication.getUiApplication () .pushScreen (new GuideList());
}
If (field is (exitButton))
{
Close();
}
}
} );
}
}

When I tried to search for this problem, I saw that others had to make paintings for the buttons? Sorry, I'm just a beginner, and I have no idea what to change.

Oh wow I didn't expect to be that simple! Right, so the three keys need to be addressed then, not the game real button... Thank you very much, Mr President!

Tags: BlackBerry Developers

Similar Questions

  • CP4 - Pause a slide with several buttons and continue after clicking a specific button

    Hi all

    I know that a break has been discussed, with the idea that you can use a clickbox (tiny/transparent) to pause the slide in CP4.

    My problem is that I have a few buttons to show/hide a scenario/question in a slide that is suspended with a clickbox.  I would like a particular button to advance the slide (for example, the button 'Next').  Currently * any * button will UN-pause the slide even if all the buttons use advanced actions and are not defined for advnace slide to the click.

    Basically, I want to achieve this goal:

    http://kb2.Adobe.com/community/publishing/871/cpsid_87182.html

    Scroll down for the film and ignore everything apart as a result of clicking on the US/Europe/ISO buttons, you don't advance the slide. (I don't like on all counters/times etc.).

    BB

    (just in case it is useful to my slide includes):

    (1) invisible clickbox to pause at the top of the timeline (i.e. "put on the map"

    (2) an another clickbox with a legend of success/failure (that I want to advance the slide)

    (3) a "Hide" button that hides the name of a legend and shows another button (all with a tip action)

    (4) a "show" button that shows the 'hide' button and the legend (by peak action)

    (5) a couple of areas of turnover used to mimic navigation so that the user can click in the right place for (2).

    )

    Hello

    What's you point to one of my articles? Oh, I see now you are intrigued by the little film. It was created with Captivate 5 and CP4 is a little heavier.

    I just answered a question similar, but explained by adapting the user file. He wanted to have several areas to click that showed a text caption and offer the user the opportunity to click as many times as he wanted to in order any on those select boxes. Only when you click on the continue button (or click box), there should be a navigation to the next slide. If I understand you correctly, this is a similar case?

    My workflow: do NOT use multiple actions for areas of click to show/hide captions. He must not trust at all, and in addition you must go back the playback head to avoid it continues after clicking on a CB. Create a tip action for every click like this screenshot:

    Here, a single text of the legend was hidden, but can be extended to many of course. The last instruction (assignment) is important: it puts the read head back a frame, so that it remains before the point of interruption.

    I blogged about this type of micro-navigation once, but the examples are for CP5 and later versions:

    Micro-navigation in Captivate

    Lilybiri

  • Several buttons and rdcmndGotoFrame with rdinfoCurrentFrame

    I'm working on a project using the buttons and multiple advanced actions to allow users to make a self-assessment with a rating scale. The buttons are how they enter their rating.  I had the problem of when I clicked on one of the buttons it would advance the slide instead of wait for the user to click on the next button. I searched the forums and found the solution to use rdcmndGotoFrame with rdinfoCurrentFrame, that fixed my issue of the advance slide and let my rankings correspond correctly to the top.  But now I have the problem that the slides with side buttons do not play, even when none of the buttons were clicked to trigger rdcmndGotoFrame with rdinfoCurrentFrame.

    I would be very happy to help.  Thank you!

    Hi Laurie,

    Does not look further for the reason of corruption in this action InitSlide, but with a fresh mind have now some questions and answers:

    • the InitSlide action makes no sense at all; You must have misunderstood this other thread, because the variables that you are reset to 0 for each slide will be re-populated by actions on the various buttons. change the action on enter to the 3 critical thinking slides to continue (BTW, don't use not identical ID even for slides, when you use the button to its use in the interface the user advanced, Actions the same slide jumped 3 times, ID was quite confused until I realized that you used the same label on slide three times)
    • the variables that might perhaps need to reset to 0 are those which are incremented after each slide as v_Critical... (another tip: check the shorter labels...) ; but this can be necessary if you allow the user to resume all the slides; is this the case? Reset would be enough once, entering the first criticism... drag

    You do not have to stagger the buttons as you did on the first slide of critical thinking, with the statement that Rewinds the playhead in the tip action, they have the same point of suspension. Another tip (I was born as a sensei): label the buttons, if you graduate them before you create / label advanced actions, you can even use the same label for actions, makes it much easier to attach to buttons (what about Bt_CT1_1 for the first button on the first slide, Bt_CT2_7 for the seventh button on the second slide etc...)

    Does make sense?

    Lilybiri

  • Several buttons and an EventListener

    Hello world

    I put 10 buttons on my stage, name it "b1", "b2", "b3", "b10".

    All of these buttons should use the same function.

    Is it possible to dynamically?

    var r: Array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].

    for (var i = 0; i <.) Length; i ++) {}

    button = "b" + a [i];

    This [button] .addEventListener (MouseEvent.CLICK, onClick_b);

    function onClick_b(pEvt: Event): void {}

    my_mc. Play();

    }

    }

    Only the button 'b10' play my function.

    Someone at - it an idea how all other buttons serve this function?

    Thank you! C.

    If you want to use the table 'a' then your for loop just needs to be:

    var a: Array = new Array (bone, btwo, bthree);

    for (var i in a) {}

    a [i] .addEventListener (MouseEvent.Click, onClick_b);

    }

    The line key = 'b' + a [i]; has several problems. You not report 'button' to be a variable, then you will probably get an error. Using the button is not necessary in all cases. The part, "b" + a [i]; feel bad a letter b for each of the elements of the array. The problem with that is that you end up with a string. When you try to add an event listener to this string, you will get another error.

    The names of instances of objects on the stage are not strings, they are values of property and so they are not presented with quotes around them. A button instance on the stage with an os name, or adeux, just shows that, OS, not "BONES", in the code.

  • Several buttons and dynamic (?) EventListener

    Hello world

    I put 10 buttons on my stage, name it "b1", "b2", "b3", "b10".

    All of these buttons should use the same function.

    Is it possible to dynamically?

    var r: Array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].

    for (var i = 0; i <.) Length; i ++) {}

    button = "b" + a [i];

    This [button] .addEventListener (MouseEvent.CLICK, onClick_b);

    function onClick_b(pEvt: Event): void {}

    my_mc. Play();

    }

    }

    The service plays only the 'b10' button.

    Someone at - it an idea how all other buttons serve this function?

    Thank you! C.

    what you want is:

    for (var i = 0; i)< a.length;="" i++)="">

    getChildByName("b"_+_a[i]).addEventListener (MouseEvent.CLICK, onClick_b);

    }

  • Buttons and videos does not

    I have several buttons and videos related to each other.  When I click on a button, it will run only a video and not the video I want for this button.  Any help?

    Thank you

    Try if it works:

    SYM. $("Subdivision_-_20_sec_1") .css ({height: "200px", width: "300px"});

    SYM.$("Subdivision_-_20_sec_1") [0]. Play();

    HTH,

    Vivekuma

  • Disappear several buttons to create the message window after installing Enigmail and GNUpg

    Hello.

    I decided to install the Thunderbird PGP module (Enigmail). During the installation, it was necessary to install additional software GnuPG. After restart Thunderbird in create message windows several buttons disappear as: fonts, links, etc. (see photo).

    I uninstalled Enigmail and GnuPG, but the situation with row of missing button has not changed.

    I installed the new Thunderbird software at the top of the old installation and don't change the situation with row of button disappeared.

    I repeat the installation on a new computer to get started with Thunderbird and after that with Enigmail and GNUPG and I got the same result with line disappears in create message window.

    Thank you in advance.
    Cryospin

    Enigmail works very well with HTML email. That's why default Enigmail to plain text message composition. The installation wizard did ask you if it
    should these settings and let you inspect these changes.
    You must undo the changes in the settings of your account under Composition & addressing. Just check "compose messages in HTML format.

  • Listener of the Volume buttons and switch off &amp; on

    I want to do tha background applications and I would add the listener for the Volume buttons and light switch off & on. Please help me how I can do this.

    Thanks in advance.

    Thanks peter & simon. Its has helped for the my requirement.

    public MyApp() {}
    Push a screen onto the stack in the user interface for rendering.
    pushScreen (new MyScreen());
    addKeyListener (new ShortcutHandler());
    }

    private class ShortcutHandler implements KeyListener {

    {} public boolean keyChar (key char, int status, int time)
    Returns false;
    }

    {} public boolean keyDown (keycode, int, int times)
    If (Keypad.KEY_VOLUME_DOWN is {Keypad.key (keycode))}
    Returns true;
    {} Else if (Keypad.KEY_VOLUME_UP == {Keypad.key (keycode))}
    Returns true;
    {} Else if (Keypad.KEY_LOCK == {Keypad.key (keycode))}
    Returns true;
    }
    Let the system to pass the event to another auditor.
    Returns false;
    }

    {public boolean keyRepeat (keycode int, int times)
    Returns false;
    }

    {public boolean keyStatus (keycode int, int times)
    Returns false;
    }

    {} public boolean keyUp (keycode int, int times)
    Returns false;
    }

    }

  • How to use commons composition on-board charger to charge several compositions with a next button and back?

    I work on an interactive book and have set up each page as a separate publication on the edge.

    I use the common edge JS library to load several compositions in a main composition.

    You can see how it works here: edge Commons - Extension Library to animate Edge and Edge reflow. EdgeDocks.com

    The way in which the municipalities of edge tutorial is set up requires a button for each publication that I want to load. I'm interested in loading multiple compositions with a 'next' and 'back' button and a 'shot left, the "forehand" on the content symbol gesture loaded in each composition. I also have the characteristics of drag on the icon content do not interfere with the interactive elements on the charged composition.

    Please suggest a solution that works without adding additional scripts beyond the Commons of edges and jquery.

    Sort of. I use this code inside an action for a button symbol. But it does not work perfectly. Trying to debug.

    I would like to know if you have a bit of luck.

    Check if there is already a pageCounter

    If (typeof EC.pageCounter = "undefined") {}

    It does not exist, so initialize it to the first page

    EC.pageCounter = 2;

    }

    check if the page is only 1 digit - patch for single digit

    If (EC.pageCounter< 9)="">

    It is, so we need complete a 0 on the front.

    EC.pageCounterString = '0' + EC.pageCounter;

    for example, 01... 09,11,12, 13... 115, 222352...

    }

    else {}

    EC.pageCounterString = EC.pageCounter;

    }

    EC.loadComposition (EC.pageCounterString + "/ publish/web /" + EC.pageCounterString + ".html", sym.$("container"));

    EC.pageCounter = EC.pageCounter + 1;

    TODO for back - 1

  • Slide several boxes and align itself with several locations and reveal the button

    Hi I am developing a game where the user chooses from a range of boxes to the left of the screen and can drag the 3 of them separately from 3 boxes to right ther. each box can be moved anywhere, and the order is not important. Once the 3 boxes are all full, I want a new button to appear. I finished a tutorial and I have a box works perfectly, but no matter what I try, I can't work with several boxes and locations. Here is a list of the instance names of film clips more my actionscript. I have attached a link to the flash file. Any help would be really appreciated. See you soon

    LINK

    http://www.sainters.NET/flash_preview/flash_test/Flash test_v6.fla.zip

    INSTANCE NAMES

    1 box = 'circle_mc.

    Box 2 = "circle_mc2."

    the two grey boxes are called = "targetCircle."

    ACTIONSCRIPT

    function dragSetup (clip, targ) {}
    clip.onPress = function() {}
    startDrag (this);
    this.beingDragged = true;
    };

    clip.onRelease = clip.onReleaseOutside = function () {}
    stopDrag();
    this.beingDragged = false;
    If (eval (this._droptarget) == targ) {}
    this.onTarget = true;
    _root. Targ.gotoAndStop (2);
    } else {}
    this.onTarget = false;
    _root. Targ.gotoAndStop (1);
    }
    };
    the following variables can store the start position of clips
    clip.myHomeX = clip._x;
    clip.myHomeY = clip._y;
    the variables below are going to store the position of end of clips
    clip.myFinalX = targ._x;
    clip.myFinalY = targ._y;
    clip.onEnterFrame = function() {}
    all these actions basically just to say "If the mouse is in place (in other words - the clip is not moved).
    then replace the MC to its original start (with a smooth movement) point ".
    If (! this.beingDragged & &! this.onTarget) {}
    This ._x-= (this._x-this.myHomeX)/5;
    This ._y-= (this._y-this.myHomeY)/5;
    If the circle is moved on any part of the target, it slides toward the center of the target
    } else if (! this.beingDragged & & this.onTarget) {}
    This ._x-= (this._x-this.myFinalX)/5;
    This ._y-= (this._y-this.myFinalY)/5;
    }
    };
    }

    dragSetup (circle_mc, targetCircle);

    You can probably do all the things you want to do.  I will make them for you well.  Trying to figure out how what I've provided works and then try to reason things for the changes you want to perform.

  • Cp6: How to stop a slide with several buttons in a nonlinear presentation?

    Hello

    I would be very grateful for a solution to this issue, as I failed to find one yet in this forum.

    The presentation is non-linear, which means that the first slide is a kind of menu that you can choose another slide to explore and always comes back to the first.

    Each slide has several buttons that activate different audio files, and there is a button on the arrow in the lower right corner to jump to the first slide.

    The problem is that the slide does not stop after that you click on some of the audio buttons and continue on the next slide (instead of take a break until the user clicks on the arrow button). When I click a few buttons and listen to audio, eventually the slide automatically continues to the next slide.

    I tried:

    • Add button click box with "break project up to what the user clicks
    • change all the buttons for timing-> break after...
    • change only the arrow for Timing-> button pauses after...
    • and will not take unnecessarily long time to slide

    Any ideas?

    Thanks in advance,

    The best

    Acted

    You don't say 'how' to play the audio? In any case, the default behavior of interactive objects that trigger a simple action is out the read head. If you replace the simple action by a standard tip action one line, the playhead is not released. Watch this video (posterous is down once, again can not point to my blog):

    http://www.YouTube.com/watch?v=M3nKi-DB6Fw

    Lilybiri

  • Safari, showing buttons and titles of different language

    I have a problem that Safari shows some titles and buttons in a weird language. When I copy the title it sticks as an Englishman. I set the language as British English in language preferences. Also, I deleted the extensions, and he has not made a difference. I changed same encoding of text in several languages and it is yet to make a difference. Here are some pictures to illustrate.

    OOpen the application book fonts in Applications, file > restore the standard fonts and restart.

  • I missed the SHIFT key and press several keys in the lower corner of my keyboard LH. Firefox split up into several iterations, and I had to reboot.

    I missed the SHIFT key and press several buttons in the lower left corner of my keyboard. Firefox has lost the tab that I was using and divided into a separate iteration for each other (plus two I had closed). I could not recover and had to close all but one of them and restore all my tabs.

    What I had done and how I should have recovered?

    First, you need to update to Firefox 18.0.1 Firefox updated to the latest version. The version you are on is bug and little course.

    Second, it looks like you may have entered groups of tabs. Use tab groups to organize a large number of tabs is that look familiar?

  • Why push button and stop button does not work in the structure of the casing and buckle my VI? (code attached)

    I am a beginner. I'm trying to create a simple VI only switches beetween two types of signals like sine and triangle when someone press on the push button and at the same time, save the data in the file to my desktop. I also have a stop button which no longer record data.  Here are my questions and dproblems:

    1. when I press the button, it does not the true and false in the structure of the case so that I can see the triangle wave stops and begins the sine waveform table.

    2 when I press the stop button, I want the program still running, but the process of writing data in time the loop stops. I don't mind if the graph of the wave stops too but it would be better for the user to see the wave form is running, but the data will stop recording.

    3. Although the condition of the loop did not accept the local variable for the stop button inside the loop or within the structure of the case, so I put the button outside all the loops and the structure.  (I know that this is a problem, I do not know how to use a single button several times in a single code. The local variable did not work the world premiere? I have to?)

    4. the data file it creates hase a lot of lines and columns. I expect a time column and a column of mixed signals based on the push button amplititude this user press every time.  I did that with the acquisition of data and a sensor, it automatically gives me the voltage and time in a column. I tried 2D and 1 d and it has not changed anything.

    Thank you for your help

    Like you said, you read only your entries at the beginning, then whatever value they had before you hit run is worth to be seen by the rest of the code. Programming LabVIEW is based entirely on the data flow and parallelism. It is incredibly powerful and has led to its success over the years (coupled with graphical programming), but is usually one of the first things the new developers stumble on. This is a simple resource to familiarize themselves with its functioning. The function to highlight execution is a great way to watch how your application uses data streams.

    Simple code goes like this:

    • Containing the main code of while loop

      • Inside of the whole loop is all user interaction code or modify the code entry
      • Stop the terminal loop is attached to stop certain criteria or user selection of a stop button
    • Loop initialization above all if necessary
    • Closing referrals and communications, etc after all loop

    It's very simple code. If you want to watch in more advanced architectures that are scalable, Google "LabVIEW State Machine" or "LabVIEW producer consumer."

    If you are just starting, you should do a free training have the capabilities of LabVIEW.

    "Give me six hours to chop down a tree and I will spend the first four sharpening the axe.  -Abraham Lincoln

    Here are some free training focused mainly on LabVIEW and hardware tools to help get started.

    Training center of NOR

    NEITHER start-up

    -Hardware Basics

    -Guide of MyRIO project Essentials (a lot of good simple circuits with links to youtube events)

    -LabVEW databases

    -DAQ Application tutorials

    -CRIO Developer's guide

    Learning OR training videos resources

    Introduction to LabVIEW for 3 hours

    Introduction to LabVIEW for 6 hours
    Paced self-study for students
    Self Paced Training beginner to advanced, required SSP
    LabVIEW training Wiki

  • There's that one button and a single call back could be defined in a toast using HTML5?

    Dear all, I have read the toast associated documents and ask yourself who is only a button and a single reminder could be set for a toast using HTML5? I want to display three buttons and defined three call back for my bread, is possible? If it is not possible to use the toast to do this, how could do this using another approach? Your comment and suggestion would be very useful. Thank you https://developer.blackberry.com/html5/apis/blackberry.ui.toast.html

    Toasts are really intended to be notifications from style UI components. That's why we provide a button if you want some specific user recommended. But they are not designed to be a notification of modal style.

    If you want to display several options for a user to select, you can use a dialog box according to the following documentation:

    - https://developer.blackberry.com/html5/apis/blackberry.ui.dialog.html

    You can take our HTML and CSS and make your own toast and just show/hide div as you wish if ours is not flexible enough for you.

Maybe you are looking for