Fields button

Hi, I have the following code, in which case I would have some button fields made visible within the application. My code is as follows:

This is a replacement code that corrects a number of problems with your code.  I suggest you compare that with your code and see if you understand what the parties are trying to do.

You will find a reference very valuable.

http://supportforums.BlackBerry.com/T5/Java-development/MainScreen-explained/Ta-p/606644

Import net.rim.device.api.system.Bitmap;
Import net.rim.device.api.system.Display;
Import net.rim.device.api.ui.component.ButtonField;
Import net.rim.device.api.ui.component.BitmapField;
Import net.rim.device.api.ui.component.LabelField;
Import net.rim.device.api.ui.container.MainScreen;
Import net.rim.device.api.ui.container.VerticalFieldManager;
Net.rim.device.api.ui import. *;
SerializableAttribute public class AppLogoMainscreen extends form {}
public AppLogoMainscreen() {}
Bitmap logoBitmap = Bitmap.getPredefinedBitmap (Bitmap.EXCLAMATION);
BMF BitmapField = new BitmapField (logoBitmap, BitmapField.FOCUSABLE)
{
protected boolean navigationClick (int status, int time)
{
createAndDisplayMainMenu();
Close();
Returns true;
}
};
Add (BMF);
}
public void createAndDisplayMainMenu() {}
Screen newScreen = new MainScreen(Manager.NO_VERTICAL_SCROLL |) Manager.NO_VERTICAL_SCROLLBAR);
VerticalFieldManager backgroundManager = VerticalFieldManager(Manager.USE_ALL_WIDTH | nouveau Manager.USE_ALL_HEIGHT)
{
Bitmap logoBitmap2 = Bitmap.getPredefinedBitmap (Bitmap.EXCLAMATION);
int imgWidth = logoBitmap2.getWidth ();
int imgHeight = logoBitmap2.getHeight ();
int imgXPos = 5;
int imgYPos = 15;
int imgTop = 0, imgLeft = 0;
public void paint (Graphics graphics)
{
graphics.setBackgroundColor (Color.PALEGREEN);
Graphics.Clear;
graphics.setColor (Color.FORESTGREEN);
graphics.fillRect (0, 0, 480, 80);
graphics.fillRect (0.0, 20, 360);
graphics.fillRect (460, 0, 20, 360);
graphics.fillRect (0, 340, 480, 20);
graphics.drawBitmap (imgXPos, imgYPos, imgWidth, imgHeight, logoBitmap2, imgLeft, imgTop);
imgXPos = 425;
graphics.drawBitmap (imgXPos, imgYPos, imgWidth, imgHeight, logoBitmap2, imgLeft, imgTop);
Super.Paint (Graphics);
}
};
ButtonField premierButton;
ButtonField champButton;
ButtonField div1Button;
ButtonField div2Button;
ButtonField confButton;
premierButton = new ButtonField ("Premiership", ButtonField.CONSUME_CLICK);
champButton = new ButtonField ("Champtionship", ButtonField.CONSUME_CLICK);
div1Button = new ButtonField ("L1", ButtonField.CONSUME_CLICK);
div2Button = new ButtonField ("Leauge 2", ButtonField.CONSUME_CLICK);
confButton = new ButtonField ("Conférence", ButtonField.CONSUME_CLICK);
backgroundManager.add (premierButton);
backgroundManager.add (champButton);
backgroundManager.add (div1Button);
backgroundManager.add (div2Button);
backgroundManager.add (confButton);
LabelField labelField = new LabelField();
backgroundManager.add (labelField = new LabelField ("Football Ground App", Field.FIELD_HCENTER)
{
protected void paint (Graphics g) {}
int prevColor = g.getColor ();
g.setColor (Color.WHITE);
Super.Paint (g);
g.setColor (prevColor);
}
});
Font myFont = Font.getDefault (.derive(Font.BOLD |)) Font.ITALIC, 11, Ui.UNITS_pt);
labelField.setFont (myFont);
backgroundManager.add (labelField = new LabelField ("For BlackBerry", Field.FIELD_HCENTER)
{
protected void paint (Graphics g) {}
int prevColor = g.getColor ();
g.setColor (Color.WHITE);
Super.Paint (g);
g.setColor (prevColor);
}
});
labelField.setFont (myFont);
newScreen.add (backgroundManager);
UiApplication.getUiApplication () .pushScreen (newScreen);
}
}

Good luck...

Tags: BlackBerry Developers

Similar Questions

  • Remove the edge of the field button (JDK 4.5)

    Hello

    It is possible to remove the border around the bitmap button class slot? So everything that appears when the image is just the image without borders.

    Thank you.

    This is my class-

    Import net.rim.device.api.system.Bitmap;
    Import net.rim.device.api.ui.Font;
    Import net.rim.device.api.ui.Graphics;
    Import net.rim.device.api.ui.Ui;
    Import net.rim.device.api.ui.component.ButtonField;

    /**
    * Field button with a bitmap as its label.
    */
    SerializableAttribute public class BitmapButtonNoClickField extends ButtonField {}
    private bitmap Bitmap;
    bitmapHighlight private bitmap;
    Private boolean stressed = false;
    private fonts fonts;
            
    /**
    * Instantiates a new button bitmap field.
    *
    @param bitmap bitmap to use as a label
    */
    public BitmapButtonNoClickField (bitmap image Bitmap image, image Bitmap bitmapHighlight, label As String, int width, make police) {}

    This (bitmap, bitmapHighlight, ButtonField.CONSUME_CLICK |) ButtonField.FIELD_HCENTER | ButtonField.NON_FOCUSABLE | ButtonField.FIELD_VCENTER
    the label, width, police);
              
    }

    public BitmapButtonNoClickField (bitmap image Bitmap image, image Bitmap bitmapHighlight, long style,
    String label, int width, make police) {}
    Super (style);
    This.Bitmap = bitmap;
    this.bitmapHighlight = bitmapHighlight;
    This.font = fonts;
    }

    / * (non-Javadoc)
    * @see net.rim.device.api.ui.component.ButtonField #layout (int, int)
    */
    Protected Sub layout (int width, int height) {}
    setExtent (getPreferredWidth (), getPreferredHeight());
    }

    / * (non-Javadoc)
    * @see net.rim.device.api.ui.component.ButtonField #getPreferredWidth)
    */
    public int getPreferredWidth() {}
    Return bitmap.getWidth ();
    }

    / * (non-Javadoc)
    * @see net.rim.device.api.ui.component.ButtonField #getPreferredHeight)
    */
    public int getPreferredHeight() {}
    Return bitmap.getHeight ();
    }

    / * (non-Javadoc)
    * @see net.rim.device.api.ui.component.ButtonField #paint (net.rim.device.api.ui.Graphics)
    */
    protected void paint (Graphics graphics) {}
    width int = bitmap.getWidth ();
    int size = bitmap.getHeight ();
    Image bitmap b = bitmap;
    If (highlighted)
    b = bitmapHighlight;
    graphics.fillRoundRect (0, 0, getWidth(), getHeight(), 10, 10);
    graphics.drawBitmap (0, 0, width, height, b, 0, 0);
    graphics.setFont (do);
    Super.Paint (Graphics);
    graphics.drawText (label, 0, bitmap.getHeight ());
    }

    }

    If by "the code you posted" you mean advanced buttons, fields and managers, then no, it is not part of any levy JDE.  This has been created separately for reading more advanced developers. You must change the package names here as com.rim... do not work on any real device (works fine in the Simulator, however).

    There was a thread here in this forum about the legality of using the code in this article from book of knowledge - you can read it yourself:

    Legal issues Using - advanced tool buttons, fields and managers

    It wasn't for that resolution, but claim that it was already used in some applications. Personally, I am looking at the source code it orientation rather than a simple copy and paste. New - people claim she has some problems and I've seen questionable code in there in some places, but overall, it's extremely useful.

  • Highlight fields button disappeared

    I tried to search the designer forum before asking this question...

    When I saw an xdp form in the designer, the "Highlight fields" button very quickly, then disappears.  How to view the full time?

    Thank you

    Elaine

    I do not have Acrobat 8 handy but in Reader 8 the same setting applies in the forms section. Oops my mistake it is forms in 9 institutions. I should have said forms and not Executive... Sorry!

    Paul

  • Field button to access a BlackBerry 7 application dialog box

    How to access button of the dialog (Ok, Cancel etc.) field if we create a dialog as follows:

    public static void showDialog(String iMsg) {
    
            Dialog dialog = new Dialog(Dialog.D_OK_CANCEL, iMsg, Dialog.CANCEL,
                    null, 0);
            dialog.setChangeListener(new FieldChangeListener() {
    
                public void fieldChanged(Field field, int context) {
    
                    if (field.getState() == Dialog.OK) {
                        Status.show("Ok Clicked", 1000);
                    } else if (field.getState() == Dialog.CANCEL) {
                        Status.show("Cancel Clicked", 1000);
                    } else {
                        Status.show("None Clicked", 1000);
                    }
    
                }
            });
            dialog.show();
    
        }
    

    I am trying to access like that, but not yet managed.

    I had another effective way to take action on the button of the dialog field actions is:

    public static void showDialog(String iMsg) {
    
            int response = Dialog.ask(Dialog.D_OK_CANCEL, iMsg);
            if (response == Dialog.OK) {
                Status.show("Ok Clicked", 1000);
            } else if (response == Dialog.CANCEL) {
                Status.show("Cancel Clicked", 1000);
            } else {
                Status.show("None Clicked", 1000);
            }
    
        }
    

    But I want to know if its possible to show set button of the dialog field action if we follow the first way to create the dialog box.

    Problem solved:

    OK to be registered listener DialogClosedListener and good code is

    public static void showDialog(String iMsg) {
    
            Dialog dialog = new Dialog(Dialog.D_OK_CANCEL, iMsg, Dialog.CANCEL,
                    null, 0);
    
            dialog.setDialogClosedListener(new DialogClosedListener() {
    
                public void dialogClosed(Dialog dialog, int choice) {
    
                    if (choice == Dialog.OK) {
                        System.out
                                .println("********************************************   OK");
                        Status.show("Ok Clicked", 1000);
                    } else if (choice == Dialog.CANCEL) {
                        System.out
                                .println("********************************************   Cancel");
                        Status.show("Cancel Clicked", 1000);
                    } else {
                        System.out
                                .println("********************************************   None");
                        Status.show("None Clicked", 1000);
                    }
    
                }
            });
    
            dialog.show();
    
  • JavaScript to create a text field + button to open the Web page after the entry

    Hello!

    I am creating an interactive catalog for a customer. My client wishes to their viewers to be able to type a part number in the text field (green box) and when you clicked on the button 'Search' it opens a browser window and add to everything that has been entered into the text behind URL box that will.

    He will go to the search page on their Web site. The URL always starts the same:... com/Research/search_results? search = and behind the = would be what has been typed in the search box.

    Screen Shot 2015-11-11 at 1.59.50 PM.png

    On click on go to... com/Research/search_results? search = 98321


    Help, please! Thank you!

    Say that the text field is called 'SearchCode '. Use this code as your search button MouseUp action:

    var searchCode = this.getField("SearchCode").valueAsString;

    app.launchURL("...com/search/search_results?search="+searchCode);

  • Fields button JavaScript

    Hello, I use Acrobat X Pro Windows to make shapes. I have a form that is put in place that automatically fills the current date on some fields on the page opens. I also have a button which changes the date of the next day, when you click on it. I wonder if there is a javascript code that can make them by clicking twice on the same button will update the 2 days of the current day field, and clicking on it three times for 3 days from today, etc.

    I googled extensively but has not found anything to make the button multiclickable fields.

    Your script fills the field with the date system and 1 day. This is different to a date field value and adding a day.

    To accomplish what you want to do, you get the value of a text field.

    What do you do if this field is empty?

    cDate var = this.getField("date").value;

    test of field value empty;

    If (cDate == "") {}

    field blank, and then set the system date.

    this.getField("date").value = util.printd ("d/m/YY", new Date());

    value refreash;

    cDate = this.getField("date").value;

    } / / end of empty field value

    convert the date to a date object value;

    Kai var = util.scand ("d/m/YY", cDate);

    game from date to date more than 1 day;

    oDate.setDate (oDate.getDate () + 1);

    this.getField("date").value = util.printd ("d/m/YY", anyway);

  • Hidden field button

    I have a button that when clicked hidden fields appear for the user to fill out (thanks Steve for help with that.)  is there a way when you click the button again the fields to hide again?  Here's what I have in the java script for the button

    Form1.Page1.Ambulance2::click - (JavaScript, client)

    Form1.Page1.ambulance_2.presence

    = 'visible ';

    Form1.Page1.patient_2.presence

    = 'visible';

    Thanks for the help

    Hello

    In the click event of the button you can first check the visibility of the fields first. If the fields are invisible and then make it visible and if the fields are visible then do it hidden. For ex: you can try the following script.

    Form1.Page1.Ambulance2::click - (JavaScript, client)

    If (form1.page1.ambulance_2.presence == "hidden" & form1.page1.patient_2.presence == "hidden")

    {

    Form1.Page1.ambulance_2.presence = "visible";

    Form1.Page1.patient_2.presence = "visible";

    }

    on the other

    {

    Form1.Page1.ambulance_2.presence = 'hidden ';

    Form1.Page1.patient_2.presence = 'hidden ';

    }

    In addition to her in the event ambulance_2 docReady and patient_2 add this script: this.presence = 'hidden ';

    Here is a link to a sample form. https://Acrobat.com/#d=n4UdzlyPX-jBZOEyCVB5iw

    Initially, the fields are hidden. Once you click the button, the fields will be visible if you click again, then fields will be hidden.

    Thank you.

    Sidonie.

  • Clear text fields button

    Hi all

    I am very new to Flash, but I need a button to clear all the entries in a form text fields, so that the user can delete all their data and start over.

    Any hepl would be greatly appreciated.

    Concerning

    John

    If you mean you want to deselect everything that is selected in the drop-down list, then you must set the property selectedIndex-1...

    aCb.selectedIndex = - 1;

  • How can I add a custom list field button?

    I have a CustomListField... I need to add a column of buttons on each line in the list... .c a someone hel [p me with the sample code... or the idea...

    Thank you.

    in case it helps. what worked for me is...

    first of the first 2 labels in line-> FOCUSABLE

    line-> NON-FOCUS

    button FOCUSABLE

    Now I can perform different actions when it is clicked on label or click on the button.

    Thanks Peter

  • Field button buttons below the overlay

    I'm sure it's something I do accidentally, but when I try and view a collection of vertical buttons similar to the HelloWorld application in the getting started guide everything except the first button has an area of broad intervention which will overlap the buttons below it, making selection a challenge.  I checked in tab through and observing the yellow rectangle.  My code is below, but this is just a variant of the code example:

    public function AIRHelloWorld()
            {
                var helloButton:LabelButton = new LabelButton();
                helloButton.label = "Hello World!";
                helloButton.addEventListener(MouseEvent.CLICK, showAlertDialog);
                helloButton.x = (stage.stageWidth - helloButton.width);
                helloButton.y = (stage.stageHeight - helloButton.height)/2;
    
                var myFormat:TextFormat = new TextFormat();
                myFormat.color = 0xAA0000;
                myFormat.size = 24;
                myFormat.italic = true;
                myFormat.align = "right";
                var text:TextField = new TextField();
                text.text = "Close Me";
                text.setTextFormat(myFormat);
                var closeButton:Button = new Button();
                closeButton.addChild(text);
                closeButton.addEventListener(MouseEvent.CLICK, closeWindow);
                closeButton.x = (stage.stageWidth - closeButton.width);
                closeButton.y = (helloButton.y - helloButton.height);
    
                addChild(helloButton);
                addChild(closeButton);
                stage.nativeWindow.visible = true;
                stage.nativeWindow.title = "Some App";
    
            }
    

    Hey heavyg,.

    I found the problem. in the code instead of using the LabelButton class, you use the default button ActionScript class. RIM created API and even remade some of the basics such as the button class in order to optimize the functionality with the Tablet OS. Then used the class optimized without a touchscreen button. So I recommend if there is another QNX class for a component (such as a Button) use the QNX version because it will have already been optimized for use in the tablet. Whereas the use of default components will give bugs like these.

    Here is your code of origin, but with two things published. Above all, I replaced the Button object with the LabelButton object and the close text is now part of the LabelButton object instead of a child. The changes are in bold:

    public function AIRHelloWorld()      {         var helloButton:LabelButton = new LabelButton();          helloButton.label = "Hello World!";           helloButton.addEventListener(MouseEvent.CLICK, showAlertDialog);          helloButton.x = (stage.stageWidth - helloButton.width);           helloButton.y = (stage.stageHeight - helloButton.height)/2;
    
              var myFormat:TextFormat = new TextFormat();           myFormat.color = 0xAA0000;            myFormat.size = 24;           myFormat.italic = true;           myFormat.align = "right";         var text:TextField = new TextField();         text.text = "Close Me";           text.setTextFormat(myFormat);         var closeButton:LabelButton = new LabelButton();          closeButton.label = "Close Me";          closeButton.addEventListener(MouseEvent.CLICK, closeWindow);          closeButton.x = (stage.stageWidth - closeButton.width);           closeButton.y = (helloButton.y - helloButton.height);
    
               addChild(helloButton);            addChild(closeButton);            stage.nativeWindow.visible = true;            stage.nativeWindow.title = "Some App";
    
          }
    

    hope that things cleared up. Good luck!

  • How to password - protect a text field button?

    With the help of Adobe Acrobat DC.

    A final touch on page 1 is titled: "the next Page: ADMIN only '."

    How do I password protect the button at the place where rises clicks the button, a password box would jump to the top (so that the next page access is restricted to admin staff only)?

    Thanks in advance!

    Thank you ALL for you insightful wisdom and entry for this.

    And thank you, gkaiseril, for throwing in a sample script. Indeed, I'll start my great experience and see what I see.

    FYI to all: this is not a question of security sensitive or confidential, in what the admin page simply duplicate entries of students area of content on page one (so that our admin person can review the content for save/printout/distribution)...so final, even if a student somehow got around the protection of password for the hidden page template for example, no harm no fault, lol.

    Thanks again to you ALL for your wonderful help on this!

    John

  • Properly aligning the field button in the status bar?

    Hello

    I've set up a status as shown in the picture below scroll bar.

    The icons that were placed between the left and right arrows are not uniform in all devices. I want their position to decide taking into account the width of the screen of the device.

    Can anyone suggest how it should be done? I used GridFieldManager to place this icons.

    Can anyone suggest me something?

    We hope to get an answer soon.

    Hello

    I managed to solve my problem by using TableLayoutManager.

  • Adding listener to the dynamic button fields

    Hello members.

    I am facing a problem when adding buttons dynamic/multiple listener.

    I download the images corresponding to my custom buttons and display buttons in landscape Manager. Now, I need to specify a particular task for each field button. I read different posts, but could not able to find the success it please help me solve this problem.

    My code is: -.

    for (int i = 0; i)<>

    Items (Items) = XMLParseData.LevelOneVector.elementAt (i) obj;

    Bitmap mediumIcon = obj.getmBmpMediumIcon ();
    Btn1 = new BitmapButtonField (mediumIcon, mediumIcon);
    Btn1.setChangeListener ((FieldChangeListener) this);
    scrollhf. Add (btn1);
    }

    My class implements Fieldchangelistner

    and in the field changed the method that I'm confused what measures to follow

    ' Public Sub fieldChanged (field field, int context)
    {

    Please provide me with some help here, I would like to specify each button with forefinger, and then you can add an action to it.
    }

    Thank you

    };

    For this you must use the ButtonFields dashboard. This code can help:

    public class Abc extends MainScreen implements FieldChangeListener
    {
        int size=5;
        ButtonField button[];
        public Abc()
        {
                    size=5;// here give your Vector.size();
            createGUI();
        }
        public void createGUI()
        {
            button=new ButtonField[size];
    
            for(int i=0;i
    

    ==================================================================================

    Do not hesitate to click like button if the solution is correct;

  • Development/unfocus field custom button problem

    Hi all

    I have something weird happens.  I have a custom button field that swaps the images based on a focused state or blur.  I have been using this field custom for awhile now, and I have never had any problems.  Imagine the following provision:

    ______________    ________________________

    | Custom button |    | BasicEditField |

    ------------------------    ------------------------------------------

    When my screen is launched, the focus is on the custom button.  If I move the trackball in a downward movement, the focus is taken the custom button, and its background image changes adequately to what has been defined in the untargeted State.  The BasicEditField then has the focus.  This is the correct behavior.

    If, however, I move the trackball in a movement to the right to the BasicEditField, then the BasicEditField will indeed get the focus, however the custom button field always displays its "highlight" picture  Using print statements, I was able to determine that when I move in a movement to the right with the trackball, the custom field button loses the focus and then gets the focus back to back, that's why it shows the highlighted image.

    Additional info:  This isn't an issue on touch devices, and custom button Manager is a TableLayoutManager.

    Any ideas why this might be happening?  Here's the code to my custom button field:

    public class BitmapButtonField extends Field {
        private String text = "";
        private Bitmap bitmap;
        private Bitmap bitmapHighlight;
        private Bitmap b;
        private boolean highlighted;
    
        public BitmapButtonField(String image, String imageHighlight, long style) {
    
            super(style | Field.FOCUSABLE);
    
            this.bitmap = Bitmap.getBitmapResource(image);
            this.bitmapHighlight = Bitmap.getBitmapResource(imageHighlight);
    
            b = bitmap;
    
        }
    
        public BitmapButtonField(String text, String image, String imageHighlight,
                long style) {
    
            super(style | Field.FOCUSABLE);
    
            this.text = text;
            this.bitmap = Bitmap.getBitmapResource(image);
            this.bitmapHighlight = Bitmap.getBitmapResource(imageHighlight);
    
            b = bitmap;
    
        }
    
        protected void drawFocus(Graphics graphics, boolean on) {
            // Do nothing
        }
    
        public int getPreferredHeight() {
            return bitmap.getHeight();
        }
    
        public int getPreferredWidth() {
            return bitmap.getWidth();
        }
    
        protected void layout(int width, int height) {
            setExtent(getPreferredWidth(), getPreferredHeight());
        }
    
        protected boolean navigationClick(int status, int time) {
            fieldChangeNotify(1);
            return true;
        }
    
        protected void onFocus(int direction) {
            b = bitmapHighlight;
            invalidate();
            System.out.println("FOCUSED");
    
        }
    
        protected void onUnfocus() {
            b = bitmap;
            invalidate();
            System.out.println("UNFOCUSED");
        }
    
        protected void paint(Graphics graphics) {
    
            int topTextPadding = (b.getHeight() - getFont().getHeight()) / 2;
            int sideTextPadding = (b.getWidth() - getFont().getAdvance(text)) / 2;
    
            graphics.drawBitmap(0, 0, getWidth(), getHeight(), b, 0, 0);
            graphics.setColor(Color.WHITE);
            if (text.length() > 0) {
                graphics.drawText(text, sideTextPadding, topTextPadding,
                        Graphics.ELLIPSIS, b.getWidth());
            }
        }
    }
    

    Have you looked at navigationMovement in the TableLayoutManager?  I confess that I rewrote it because it handles no left and right as I wanted.  Perhaps, you might be able to do the same thing.

  • Button 'Reset the field' fillable iOS - removal

    I created a form for some sellers to use when they are to make calls.  It is essentially just rows and rows of 5 areas of text - reference, amount, code of the line, description and price.  They use Adobe Reader for the iPhone.

    One of the comments I received from vendors is that when they use it on an iPhone or another iThing, there is a "reset field" button just above the keyboard that they often hit by mistake.  This button resets only the field that is typed in, however it is causing some frustration.  I have two buttons "reset form" that I created myself at the top of the page.

    My question is, can I remove the button "reset" of the interface, while retaining the ability to reset the entire form if they want to?  Is there a setting on the text boxes that will allow me to say that this field can not be reset, while being able to use a button of entire form remains?

    I don't know what is happening on an Android device on the "reset" button, but I don't think - that someone tried a droid yet.  There is no field button reset when using the form on a machine via Adobe Reader Windows.

    You have no control over the user interface, so you can't remove the button, and you can prevent a field in one way and not another being reset.

Maybe you are looking for