How to add different Actions on different buttons. How to receive the first screen in a stack

Got two problems I have to solve.

Let's start with my first.

Source:

public class core extends MainScreen implements FieldChangeListener{
    public core()
    {
        super();
        try{
            setTitle("Mobile Inspection Manager");
            RichTextField MainMenu = new RichTextField("Main Menu",RichTextField.TEXT_ALIGN_HCENTER);
            FontFamily fof = FontFamily.forName("Times New Roman");
            Font fon = fof.getFont(Font.PLAIN, 32);
            MainMenu.setFont(fon);
            add(MainMenu);
            SeparatorField Sep = new SeparatorField();
            add(Sep);
            add(new RichTextField(""));
            ButtonField but1 = new ButtonField("Equipment", ButtonField.CONSUME_CLICK) ;
            but1.setMinimalWidth(360);
            but1.setPadding(7,0,7,0);
            add(but1);
            ButtonField but2 = new ButtonField("Messenger", ButtonField.CONSUME_CLICK) ;
            but2.setMinimalWidth(360);
            but2.setPadding(7,0,7,0);
            add(but2);
            ButtonField but3 = new ButtonField("Reports", ButtonField.CONSUME_CLICK) ;
            but3.setMinimalWidth(360);
            but3.setPadding(7,0,7,0);
            add(but3);
            ButtonField but4 = new ButtonField("Preferences", ButtonField.CONSUME_CLICK) ;
            but4.setMinimalWidth(360);
            but4.setPadding(7,0,7,0);
            add(but4);
            ButtonField but5 = new ButtonField("Update/Sync", ButtonField.CONSUME_CLICK) ;
            but5.setMinimalWidth(360);
            but5.setPadding(7,0,7,0);
            add(but5);
            ButtonField but6 = new ButtonField("About", ButtonField.CONSUME_CLICK) ;
            but6.setMinimalWidth(360);
            but6.setPadding(7,0,7,0);
            add(but6);
            ButtonField but7 = new ButtonField("Exit", ButtonField.CONSUME_CLICK) ;
            but7.setMinimalWidth(360);
            but7.setPadding(7,0,7,0);
            but7.setChangeListener(this);
            add(but7);
        }catch(Exception e){

        }
    }
    public boolean onClose()
    {
            Dialog.alert("Goodbye!");
            System.exit(0);
            return true;
    }
    public void fieldChanged(Field field, int context)
    {
        master.Application.closeApp();
    }
    public void InfoScreen(){
        MainScreen Version = new ui.about.version();
        master.Application.changeScreen(Version);
    }
}

I've defined several buttons for the main Menu.

How can I add these buttons Actions?

I added one already to the Exit button. We work.

My first idea was to add a method to implement the InfoScreen.

But I get a Java error.

Browsing through the Internet I have not found a solution.

I took most of the developer Sources.

But I don't know what I should do now.

How can I declare different Actions for different buttons?

2. question.

I am swaping with screens with the pushScreen command.

Is there a way to return to the previous screens?

1 Add this as a change listener to each button.  In your fieldChanged method, mount ButtonField field, extract label and branch code according to it.

2. pop removes the screen from the top of the stack so underneath the screen becomes visible. Stack screen blackBerry is just that - a battery.

By the way - are you sure that you have found the font Times New Roman family?  There is no such family on BlackBerry.  Extract his name by using fof.getName () and display it in, say, Dialog.info - you might be surprised.

Tags: BlackBerry Developers

Similar Questions

  • How to change the first screen click Start then explores

    When I right click on the Start button and select Explorer, file system structure always opens to the C:\Users\my user id\AppData\Roaming\Microsoft\Windows\StartMenu. How can I make C:\Users\my user id\Documents open to a more useful directory for example?

    Hello

    The option explores when right click on the start menu will take you to the path that you have described. You open the location of the real record of the entries that are found in the Start Menu.

    This can not be configured to open somewhere else, because the right click tells explore from the menu start the computer you want to explore the folder that uses for its programs in the start menu.

    Closest to you what you are looking for the solution will create a similar shortcut for the steps that precede and place it on the desktop or in an accessible place quickly to allow you to quickly access the Documents folder.

    Hope this information is useful.

  • Captivate 9 - How to add multiple actions to a button

    HI all, on Captivate 9 I have created a status display slide with four buttons, so when the user clicks on each button, they will see different content.

    I want to force the navigation to make sure that the user clicks on THE 4 buttons (in order that), before being able to see the button "NEXT" will appear on the screen that will allow them to move to the next slide.

    I think I need to create variables and stocks advanced on each button to create this logic, but how do I add additional actions on the same button? Under 'The ACTION', I see that all the buttons have an action to open the contents of the status display when you click on:

    action-captivate.jpg

    Is it possible to add another action to the same button?  Please share instructions to help me create the logic to do this? Thank you very much.

    You need user variables and conditional action with two decision for each of your buttons. I posted this workflow many times, but it's so hard to find the wire. Another try:

    1. Create 4 variables v_one, v_two... v_four with a default value of 0. they will be changed to 1 when the user clicks on the associated button.
    2. Create a conditional advanced action for each button, with two decisions:
      1. First decision 'Always' is a standard simulated action
        IF 1 is equal to 1
        Assign the v_one with 1
        Change the State of...             the action that you had one this time
      2. Second decision "CheckVars".
        IF v_one is equal to 1 AND
        v_two is equal to 1...
        ....
        is equal to 1
        See the Bt_Next
        Select Bt_Next

    Create a similar action to each button, only the first decision will have to be modified (the variable and the state change).

    The Bt_Next button should be hidden in the output to start with. Don't forget to define points of suspension of the 4 buttons at this very moment. For the next button, you can have a break at the same time or later.

  • Mr President, how can I enter two rows at the same time with different default values that only the first line to use see?

    Mr President.

    My worm jdev is 12.2.1

    How to enter two rows at the same time with different default values that only the first line to use see?

    Suppose I have a table with four fields as below

    "DEBIT" VARCHAR2(7) , 
      "DRNAME" VARCHAR2(50),
      "CREDIT" VARCHAR2(7) , 
      "CRNAME" VARCHAR2(50),
    

    Now I want that when I click on a button (create an insert) to create the first line with the default values below

    firstrow.png

    So if I click on the button and then validate the second row with different values is also inserted on commit.

    The value of the second row are like the picture below

    tworows.png

    But the second row should be invisible. It could be achieved by adding vc in the vo.

    The difficult part in my question is therefore, to add the second row with the new default values.

    Because I already added default values in the first row.

    Now how to add second time default values.

    Concerning

    Mr President

    I change the code given by expensive Sameh Nassar and get my results.

    Thanks once again dear Sameh Nassar .

    My code to get my goal is

    First line of code is

        protected void doDML(int operation, TransactionEvent e) {    
    
            if(operation != DML_DELETE)
                 {
                     setAmount(getPurqty().multiply(getUnitpurprice()));
                 } 
    
            if (operation == DML_INSERT )
                       {
                               System.out.println("I am in Insert with vid= " + getVid());
                           insertSecondRowInDatabase(getVid(),getLineitem(),"6010010","SALES TAX PAYABLE",
                            (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100));      
    
                           }
    
            if(operation == DML_UPDATE)
                              {                                                    
    
                                 System.out.println("I am in Update with vid= " + getVid());
                             updateSecondRowInDatabase(getVid(),
                                 (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100));      
    
                              }                      
    
            super.doDML(operation, e);
        }
        private void insertSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4, Object value5)
                  {
                    PreparedStatement stat = null;
                    try
                    {
                      String sql = "Insert into vdet (VID,LINEITEM,DEBIT,DRNAME,AMOUNT) values " +
                 "('" + value1 + "','" + value2 + "','" + value3 + "','" + value4 + "','" + value5 + "')";  
    
                      stat = getDBTransaction().createPreparedStatement(sql, 1);
                      stat.executeUpdate();
                    }
                    catch (Exception e)
                    {
                      e.printStackTrace();
                    }
                    finally
                    {
                      try
                      {
                        stat.close();
                      }
                      catch (Exception e)
                      {
                        e.printStackTrace();
                      }
                    }
                  }  
    
                  private void updateSecondRowInDatabase(Object value1, Object value5)
                  {
                    PreparedStatement stat = null;
                    try
                    {
                      String sql = "update vdet set  AMOUNT='"+ value5+"' where VID='" + value1 + "'";                     
    
                      stat = getDBTransaction().createPreparedStatement(sql, 1);  
    
                      stat.executeUpdate();
                    }
                    catch (Exception e)
                    {
                      e.printStackTrace();
                    }
                    finally
                    {
                      try
                      {
                        stat.close();
                      }
                      catch (Exception e)
                      {
                        e.printStackTrace();
                      }
                    }                  
    
                  }
    

    Second line code is inside a bean method

        public void addNewPurchaseVoucher(ActionEvent actionEvent) {
            // Add event code here...
    
            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
                   DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("VoucherView1Iterator");
                   RowSetIterator rsi = dciter.getRowSetIterator();
                   Row lastRow = rsi.last();
                   int lastRowIndex = rsi.getRangeIndexOf(lastRow);
                   Row newRow = rsi.createRow();
                   newRow.setNewRowState(Row.STATUS_NEW);
                   rsi.insertRowAtRangeIndex(lastRowIndex +1, newRow);
                   rsi.setCurrentRow(newRow);
    
                   BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry();
                   DCIteratorBinding dciter1 = (DCIteratorBinding) bindings1.get("VdetView1Iterator");
                   RowSetIterator rsi1 = dciter1.getRowSetIterator();
                   Row lastRow1 = rsi1.last();
                   int lastRowIndex1 = rsi1.getRangeIndexOf(lastRow1);
                   Row newRow1 = rsi1.createRow();
                   newRow1.setNewRowState(Row.STATUS_NEW);
                   rsi1.insertRowAtRangeIndex(lastRowIndex1 +1, newRow1);
                   rsi1.setCurrentRow(newRow1);
        }
    

    And final saveUpdate method is

        public void saveUpdateButton(ActionEvent actionEvent) {
            // Add event code here...
    
            BindingContainer bindingsBC = BindingContext.getCurrent().getCurrentBindingsEntry();      
    
                   OperationBinding commit = bindingsBC.getOperationBinding("Commit");
                   commit.execute(); 
    
            OperationBinding operationBinding = BindingContext.getCurrent().getCurrentBindingsEntry().getOperationBinding("Commit");
            operationBinding.execute();
            DCIteratorBinding iter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("VdetView1Iterator");// write iterator name from pageDef.
            iter.getViewObject().executeQuery();  
    
        }
    

    Thanks for all the cooperation to obtain the desired results.

    Concerning

  • How to adapt the start screen on all webworks App blackberry blackberry devices?

    I'm working on blackberry webworks app targeting blackberry 7 & lower OS versions. I have a 360 x 480 pixels boot image that adapts perfectly to the BlackBerry curve Smartphone 9380. But the same splash image does not fit into other devices with different screen sizes. So, now I have created the home screen with a different resolution. But I don't know how to use it? Can someone like me how to select the splash screen dynamic based on the resolution of the device or other means to solve this problem?

    Unfortuantely on BBOS, you can have a single element of the rim: loadingScreen:
    http://developer.BlackBerry.com/BBOS/HTML5/documentation/rim_loadingscreen_element_834680_11.html

    Whereas the BB10, you can have several elements of the rim: splash that the device would automatically take the best resolution of.

    Because it is a property of config/xml, there is no way to dynamically assign values. You would need a separate for each loadingScreen dimensions version.

  • Liquid Z 3 How to use the small screen-receving-phone-call?

    Hello

    I would like to know how to use the small screen that appear in a case to receive a phone call.

    There are two types of screen wen we receive a phone call. I know how to use a larger. But not for the little ones. Aid for the small indicates that we have to drag the green phone symbol that I guess, but to fall on what? The manual doesn't explain it at all, it is not obvious!

    Thank you very much for your help!

    With "appellant float" activated, simply to press the Red or green button, no need to call, if the "small screen" is that of the attachment

  • How to fix the black screen of my hp pavilion g6

    How to fix the black screen of my hp pavilion g6

    Try a hard reset, works sometimes. Disconnect all external devices first.

    battery and power cord 1 / removal

    2 - Press the power button for 30 seconds

    3 reinstall only the power cord for the first start.

    4. turn on

  • How to use the Print Screen function?

    I've seen various descriptions of how to use the print screen function.

    It would be nice to actually tell one that works.  None have worked for me.

    [Fn] and Prt SCr does not work.

    CTRL and Prt SCr does not work.

    CTRL, Alt, and Prt SCr does not work.

    [Fn], Ctrl and Prt SCr does not work.

    If anyone knows the correct method to activate the screen capture function which would be a good thing.

    From the looks of things, HP has a big problem with this function.

    Here's a microsoft articleon the use of the screenshot function.

    This should answer your questions.

    Thanks for taking a peek.

  • TouchSmart laptop computer: I have HP Touchsmart (15-d020dx). How to disable the touch screen feature?

    I have HP Touchsmart (15-d020dx). How to disable the touch screen feature?

    Hello

    Follow the steps listed in the link below

    http://h30434.www3.HP.com/T5/desktop-audio-video-monitors/how-to-disable-touch-screen/TD-p/569755

  • Columns of folder: by default, how can return the first column 'Name' without having to move it manually every time?

    Something's happened awhile and when I create a folder which appears the first column is the column 'Date modified '. By default, how can return the first column 'Name' without having to move it manually every time?

    Hello

    I suggest you to visit these links and check if it helps:

    http://Windows.Microsoft.com/en-us/Windows-Vista/working-with-files-and-folders#section_4

    http://Windows.Microsoft.com/en-us/Windows-Vista/folders-frequently-asked-questions

    It will be useful.

  • How to disable the touch screen of HP 23-h027c

    My touch screen is sensitive even to small bugs! Living in a tropical island, this is an inconvinience. So I want to disable the touch screen and use the mouse and keyboard only. How to disable the touch screen? Help welcome. Thanks: Pedro [personal information edited by Moderator]

    Enter the device, as shown in the following image Manager right click of the device touch screen and choose disable.

  • How to disable the Welcome screen in windows 7 Home premium

    original title: disabling the welcome in Windows7 home premium screen.

    How to disable the Welcome screen in windows 7 Home premium. Therefore, type the user name and password when connecting

    Hello

    1. If you have Windows 7 Professional or ultimate edition, open the Group Policy Editor and navigate to the following policy.

    Computer Configuration / Windows Settings / Security Settings / Local political / Security Options.

    In the right pane, double-click the policy:

    Interactive logon: do not display last user name - change to "Enabled".

    2. If you have the Home Premium version, you can set this policy using the registry.

    * Make sure that you back up the key before making changes

    Open Regedit and navigate to the following location.

    HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem\\\

    In the right pane, locate the dontdisplaylastusername value. Double-click this value and change the value to 1 data. Click OK.

    If this value is not present, right-click and select new/DWORD (32-bit) Value.

    Name the dontdisplaylastusername (respect for case-sensitive) value, and then make the above change.

    Here is a screenshot of the login window.

    http://i196.Photobucket.com/albums/aa86/rvmv/ManualLogOn.jpg

    Let us know the results.

    Concerning

  • How to set the first character as selections in the EditField.

    Hi friends,

    I am a third-party application that I have to set the first character as capital.

    so please help me how to set the first tank as capital.

    Take a look at AutoTextEditField - maybe you can use this to do it automatically...

  • How to show the main screen (home screen of blackberry)

    Hi guys,.

    I need to know how to show the main screen (home screen of the blackberry), even if it's in any screen (like saying "Calculator" etc)...

    This must be done by programming... is there a solution for this?

    Thanks in advance,

    I also had. This is to disconnect incoming call and display the main screen (home screen of the blackberry).

    EventInjector.invokeEvent (new EventInjector.KeyCodeEvent (EventInjector.KeyCodeEvent.KEY_DOWN, (char) Keypad.KEY_END, 0, 100));
    EventInjector.invokeEvent (new EventInjector.KeyCodeEvent (EventInjector.KeyCodeEvent.KEY_UP, (char) Keypad.KEY_END, 0, 100));

  • How to refresh the entire screen?

    Hello

    Please can someone tell me how to refresh the entire screen?

    Refresh here means clear all fields and show empty fields.

    Thank you

    Afonso Tyagi

    Hey,.

    as I usually do, is to create a separate function that manually assigns to each field and property reverts to its original state. There is not a function that does it for you. You must create your own. hope that helps good luck!

Maybe you are looking for