editable text field and button is not editable when added to the Manager of the Horizontal

I find layout, when I added the button and EditField horizontally, Manager, I'm not able to write something in the EditField and not able to click on the button

public class MyStorySearch extends MainScreen
{

    private VerticalFieldManager mainManager;
    private VerticalFieldManager subManager;
    private Bitmap _backgroundBitmap = Bitmap.getBitmapResource("a.png");
    private int deviceWidth = Display.getWidth();
    private int deviceHeight = Display.getHeight();
    LabelField lbl;
    ButtonField gobtn= new ButtonField("Go");
    HorizontalFieldManager hfm = new HorizontalFieldManager(Manager.FOCUSABLE|Manager.EDITABLE);
    private Field editfild;
    Bitmap bitmapImage = Bitmap.getBitmapResource("storysearch.png");
    BitmapField fieldDemo;

    public MyStorySearch()
    {
        super(NO_VERTICAL_SCROLL);
        //this manager is used for the static background image
        mainManager = new VerticalFieldManager(
                          Manager.NO_VERTICAL_SCROLL |
                          Manager.NO_VERTICAL_SCROLLBAR )
        {
            public void paint(Graphics graphics)
            {
                graphics.clear();
                graphics.drawBitmap(0, 0, deviceWidth,
                         deviceHeight, _backgroundBitmap, 0, 0);
                super.paint(graphics);
            }
        };

        //this manger is used for adding the componentes
        subManager = new VerticalFieldManager(
                         Manager.VERTICAL_SCROLL |
                         Manager.VERTICAL_SCROLLBAR )
        {
            protected void sublayout(int maxWidth, int maxHeight)
            {
                int displayWidth = deviceWidth;
                int displayHeight = deviceHeight;

                super.sublayout( displayWidth, displayHeight);
                setExtent( displayWidth, displayHeight);
            }
        };

        //add your component to this subManager
        lbl = new LabelField("SUNRAYS SEARCH", LabelField.USE_ALL_WIDTH | DrawStyle.HCENTER);
        Font myFont = Font.getDefault().derive(Font.PLAIN, 10, Ui.UNITS_pt);
        lbl.setFont(myFont);
        subManager.add(lbl);
        subManager.add(new SeparatorField());

        editfild = new EditField(){
            protected void layout(int width, int height) {
                setExtent(width*85/100, 30);

            };
        };
        editfild.setBorder( BorderFactory.createSimpleBorder( new XYEdges(2, 2, 2, 2),
                new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK), Border.STYLE_SOLID));
        editfild.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));

        hfm.add(editfild);
        hfm.add(gobtn);

        subManager.add(hfm);

        //add subManager over the mainManager
        mainManager.add(subManager);

        //finally add the mainManager over the screen
        this.add(mainManager);
    }
}

The following code shows an EditField and a button, and I can type in the EditField and click the button.  It is not perfect, but at least it works.

I don't know what the problem is with your code.  I suggest review you my code, review your code and investigate things that are different.

Two areas I would focus on your layout and the sublayout.  As stated in a previous post, if you must code a setExtent in a layout, then you should really think about creating your own Manager - I gave you links to do this several times.  And if you plan to use a standard field and to make it work properly, you must use the sublayout.  Here is a link to help you create custom fields:

http://supportforums.BlackBerry.com/T5/Java-development/create-custom-fields/Ta-p/444962

Edit:

Thanks for the update of these discussions.

And I'm sorry.   I forgot to paste the code...  Here, it is now...

        EditField editfild = new EditField(){
            protected void layout(int width, int height) {
                super.layout(width*85/100, height);
            };
        };
        editfild.setBorder( BorderFactory.createSimpleBorder( new XYEdges(2, 2, 2, 2),
                new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK), Border.STYLE_SOLID));
        editfild.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
        ButtonField gobtn= new ButtonField("Go") {
            protected boolean navigationClick(int status, int time){
                Status.show("button clicked");
                return true;
            }
        };
        HorizontalFieldManager hfm = new HorizontalFieldManager();
        hfm.add(editfild);
        hfm.add(gobtn);
        this.add(hfm);

Tags: BlackBerry Developers

Similar Questions

  • AM and pm do not appear when I put the time as "hh: mm tt" or "SS tt" on Windows 7

    Hi. I recently installed Windows 7 and everything is ok, but I can't set the time, like I always do.

    You do know that Windows has the set time as "Hh: mm" (a short) and "HH" (a long) by default. I love the 12-hour format, and I always change... But on Windows 7, I put it as "hh: mm tt" and 'SS tt' and 'h' and 'h' do not appear (example: it looks like this--> "07:23" when it is 19:23). Windows is not return an error when I put like that (if I write to you, for example, "hh: mm tt" return returns an error).

    I think it is a bug of Microsoft... any ideas? If I'm right, how can I report this to the company?

    Greetings.

    Hello

    By default, Windows 7 displays the time in 24-hour format, so if you want to get the AM/PM symbols, then proceed as follows:

    1. click on start, type intl.cpl and press ENTER, then the region and language dialog box appears.
    2 here, click the additional settingsbutton that loads the Custom Format window.
    3 now click on the timetab in this window and set the long and short time of hh hh: mm tt.
    4. click on the apply button and your system clock displays now AM or PM (if it is applicable at the time).

    Kind regards
    Amal-Microsoft Support.
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • T440s - keys alt and space do not work when you press the up and left arrow

    Hi all -

    I just got my T440s a few weeks ago and I love it. I just discovered a weird problem: both alt keys and the space bar don't work when holding the up arrow and left the keys simultaneously. I discovered this while playing a racing game. As holder until left and arrows, by pressing the alt key or the space bar to have no effect, and the laptop makes a sound 'blip '.

    All other keys seem to work all by holding + arrows left and rising + right arrow key does not change a thing.

    I looked at the ease of access settings (I have Win7 Pro 64) and turns off all filters, sticky keys keys, etc. I use the latest version of the BIOS, if that's any help.

    It's a little boring, so I'd appreciate any help. Thank you!

    https://en.Wikipedia.org/wiki/Rollover_%28key%29#Key_jamming_and_ghosting

    Will probably not not to be repairable. Recommend rebind the keys for a game of combinations work.

  • Files and settings are not transferred when I use the files and the Settings Transfer Wizard

    Two XP computers are same all critical Service Pack 3 with the update.  Same version of FAST.

    Running FAST on the old computer (files and settings) creates the USMT2. The UNC file.

    Run FAST on the NEW computer concludes the USMT2. UNC file and works through its steps.

    Both measures take about two hours to complete.

    When FASTING is complete on the new computer he wants to disconnect the user.  At this point, it seems that it worked without errors.  (no error messages at all)

    After the Cup then turn it back, it's as FAST does not work.

    FASTWiz.log is 175KO on OLD PC and 72KO on NEW

    Don't know what to look for or what could be the problem.

    Both computers have MigWiz.exe version 5.1.2600.5512

    I'm glad you worked on it.  Thanks for letting me know.

  • Align the text field and a button.

    Hi all

    I use Oracle APEX 5.0.1.

    I tried to create a search page that contain a text field and a button.

    But I can't align the text field and button, so they can have the same top position.

    Could someone please help me solve this problem?

    APEX-ARE-Search.jpg

    Thank you and best regards,

    Troy.

    Hello.

    Have you tried to add a css attribute to the button? like: style = "top: 4px;

    Concerning

  • I create a text field and I can't get the text to start typing in the upper left corner

    I created a pdf file for and added to the text boxes. The text want to start in the middle left of the text field and I can't seem to start in the upper left corner. Any suggestions?

    Set as Multiline field, under Properties - Options.

  • You just edit Contacts in GMAIL and I can not restore my contacts from the previous version. I followed your instructions, but it has not restored nearly 500

    You just edit Contacts in GMAIL and I can not restore my contacts from the previous version. I followed your instructions, but it has not restored nearly 500 contacts that I have that are in other contacts.

    Hi robertsjohn125,
    Contacts are not supported in Firefox, unless you take on Firefox Desktop and Hello of Firefox?

    Where to manage your contacts, this might help to direct you to the correct support.

  • Try to retrieve the contents of a text field and use it in a conditional statement

    Hello world

    I have a form with a text field and a button. The text field is called "orderNo" and the button is called "genOrder".

    Initially, the text field is empty, and clicking on the button fills the text with an appropriate order number field.

    I have need to check the text field for the data (content) before you write the order number, in this way, if an order number is already present in the text field, it will be over written.

    My intention is to use an if / else structure to perform the tests, but I do not know how to retrieve the content of the text field (if the content is present!).

    If anyone can suggest how I can go about extracting the contents of a text field and then use it in an if / else statement it will be greatly appreciated.

    Kind regards

    DAVO

    currentOrderNo = this.getField("orderNo").value;

    If ("currentOrderNo == null | currentOrderNo ==" ") {}

    the field is empty, fill it with a new value

    } else {}

    the field is not empty, something else

    }

  • Pop the text field scrolling buttons on the stage

    Hello all;

    I am very new to Flash so please bare with me. If anyone can point me to some examples I would really appreciate it. I have 5 buttons on my stage (in fact they are just text that I made in buttons); I would like the user to be able to click on each of them, and it appears a text field scrolling where they can read and scroll the information in the text field and then they can go back and click Next and so on. On the left side of the stage is the buttons and on the side right would be the scrolling text field. Now I realize that I could accomplish this using frameworks separated for each button and just pointing to these images, but I feel that there is an easier way... There must be there is something I'm definitely missing...

    Thank you d ' attribute
    T

    A warning first. I have not tested this code, but it covers most of what is needed to do this with AS3.

    var source: String = "myTxtFile.txt";
    var dataFormat:String = pouvez;

    var loader: URLLoader = new URLLoader();
    loader.dataFormat = dataFormat;

    loader.addEventListener (Event.COMPLETE, completeHandler);

    var request: URLRequest = new URLRequest (source);
    try {}
    Loader.Load (request);
    } catch (error) {}
    trace ("there was an error loading the text file");
    }

    function completeHandler(evt:Event):void {}
    var variables: URLVariables = new URLVariables ((evt.target comme URLLoader) .data);

    for (var i: uint = 1; i<= variables.numvars="" ;="">

    var n: String = "button" + i;
    myTexts [n] variable = [n];

    }
    }

  • I have an Iphone 6 and can't send or receive text messages to Iphone users not.  I can send the Imessages blue very well, but it is impossible to send green messages any idea how to solve this

    I have an Iphone 6 and can't send or receive text messages to Iphone users not.  I can send the Imessages blue very well, but it is impossible to send green messages any idea how to solve this

    SMS or text messages, are a specific function of the carrier. You must have an addition of text on your cell phone plan. If you can not send SMS, you must contact your operator to solve the problems.

  • My cd-writer/DVD disc tray does not open when I press the Open button. He is not blocked and has no disk in it. How can I me t to operate?

    Cd-writer/DVD disc tray does not open when you press the Open button, or when you use the buttons to control the media on the keyboard. How can I restore it to its operating state?

    Hi John,.

    Please let me know exactly what happened when you tried my suggestions of first and second.

    Of your most recent post, looks like you're watching the wrong part of the Device Manager. Optical drive is listed under "readers of CD-ROM/DVD-ROM". The info you gave appear under "drives". If the drive is not listed under "readers of CD-ROM/DVD-ROM" or there is no such section in Device Manager, then Windows do not see. If windows can't see it then this means that there is no power or that the drive is broken.

    When you pushed the drive back in, the player no longer has much of the book or did you have to push all the way. If the latter, it means that the drive has no power or is broken.

    With respect to the opening of the case, I guess I should ask first if it's a laptop or desktop?

    Tricky

  • How can I prevent the text fields and drop downs changed after the form has been signed using a digital certificate? Thank you.

    Hi all

    How can I prevent the text fields and drop downs changed after the form has been signed using a digital certificate? Thank you.

    There is also a checkbox on the dialog box 'Sign' to lock document after signing.

  • How can I change the Home Page of Adobe to English? Happens to be french and I do not understand. I press the translator button but nothing changes!

    How can I change the Home Page of Adobe to English? Happens to be french and I do not understand. I press the translator button but nothing changes!

    Adobe - Choose your area

  • I have two text fields, where the user will sign a text field and the other text field should be mandatory

    I have 2 text fields, and how can I do a condition when the text 1 field is entered, then they must enter data into the text field 2.  I know it seemed simple, but I'm just a beginner in this... Thanks in advance!

    Hello

    I'm sorry, I forgot this matter.

    Please try this code...

    If (this.isNull)

    {

    TextField2.validate.nullTest = 'error ';

    }

    on the other

    {

    TextField2.validate.nullTest = "disabled";

    }

    Hope than that,

    S, candy.

  • the mouse movement is not displayed when you preview the project and after publication

    I missed a step when you change a demo of simulation? Here's the problem:

    When I edit in the timeline of a slide, I can move the appearance of the mouse movement and change the length of its duration; I can click on "show/hide elements" for the mouse, the text caption and select box to show or hide in the slide.

    All the changes reflect in preview > play Slide. But in preview > project or preview > in the browser or publish it to any format, except for the presence has changed and the duration of the movement of the mouse shows, others seem out of my control: 1) no mouse movement; (2) the pointer still displays its final position on the slide since the beginning of the slide; (3) the hidden nail box appears.

    That's happened?

    I come off some defect? Where is it?

    Thank you!

    Your question is not quite clear to me, but this sentence "I can click on" show/hide elements "for the mouse, the text caption and select box to show or hide the slide." is ring a Bell! Have you used the "eye" icon in the timeline panel to "hide" the objects? That is not intended to hide the version published, only to temporarily hide for editing purposes, have has too many objects on the slide. If you really want to hide an object permanently, so it does not appear after the publication or during a preview (play Slide is not a preview, is also only for editing, synchronization) you must use the 'other' "eye" icon you will find at the top left of the properties of this object Panel. Quite confusing to have twice the same button to completely different purpose (there is even a third version in Drag Drop & who still has another feature, just hide the links in the D & D).

Maybe you are looking for

  • Podcasts don't download from 10.0.2 updat

    iPhone 6 s more, iOS 10.0.2 Subscribed podcasts will be updated but not download them since the last update. Download via WiFi, do not use sync to synchronize with iTunes. Suggestions?

  • G7 keyboard - 1320dx Pavilion does not

    My Pavilion G7-1320dx keyboard does not work when I try to enter my password in Windows 7. I have accessed the BIOS and I reset the default values. Yes, the arrow keys work when in the BIOS. After removing the battery and the AC adapter / CC, I press

  • My screen saver pictures is taking pictures of evil records

    I used the Photos of Windows Vista screensaver for quite awhile and even if it used to work very well for some reason any must now images from anywhere in my computer.  I now can't use it at all because I don't want obviously not scanned documents me

  • event ID 7005

    error in Event Viewer: Log name: ApplicationSource: Microsoft-Windows-a-ListenerAdapterDate: 2010-06-25 04:09:18Event ID: 7005Task category: noLevel: errorKeywords: ClassicUser: n/aComputer: AcerDescription:Earphone adapter Protocol "msmq.formatname"

  • No audio device connected

    My laptop shows no audio device. My laptop worked fine for a few days after the formatting, but this occurred.can problem, someone help me how to slove this problem .i have windows 7 and the dell E6400.i latitude have tried to uninstall and reistalli