setFocus on a ground is originally setFocus on other fields

I implement the 't' and 'b' button functionality so I want to concentrate on the last field on the screen.  I have this job, but when the background field is a bitmap like this:

http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800345/...

It sets the focus on the highest field and bottom most field.

I tested other fields and it is only this "churn" bitmap that is causing the problem.  It is indeed strange.

Thanks Peter, it's what I was trying to do well enough.  However, the fact that the lower field could be non-Focus adds a bit of complexity.  If I add another field non-focusable below the background image in your code, it breaks the functionality.

I ended up writing a recursive method that takes a Manager and returns the focusable field below:

 private Field getBottomMostFocusableField(Manager manager) {

        int fieldCount = manager.getFieldCount();

        for (int i = fieldCount - 1; i >= 0; i--) {
            Field field = manager.getField(i);

            if (field.isFocusable()) {
                if (field instanceof Manager) {
                    return getBottomMostFocusableField((Manager) field);
                } else {
                    return field;
                }
            }
        }

        return null;
    }

It seems to work now.

Thanks for your help once again!

Tags: BlackBerry Developers

Similar Questions

  • Exception - called setFocus on a field that is not attached to a screen.

    I'll have a lot of areas in my screen. I'm trying to set the focus on the particular area. To do this, I use field.setFocus (). But it gives this exception

    setFocus call on a field that is not attached to a screen. But the field is added to the screen. I don't know what the problem is with me.

    How can I do this?

    Thanks for any help.

    Oh. I'm sorry. I resolve myself. I called this method until I added this field to display.

  • How can I setFocus on a field

    When the user clicks on a 'new' button, our dynamic form xds creates a new line for them to enter data.  By default, the first field (after a button) Gets the focus.  We want to do is to have the third field gets focus.

    I'm assuming that the 'new' button, I'd do a setFocus on something.  But as a beginner, I wouldn't put money on that.

    I think that what lack us is the index of the line.  Otherwise, it looks like this:

    xfa.host.setFocus (data.sfPage.sfParent.sfTableRow.phone)

    TIA,

    Jerry

    It is on the right track.  A few things:

    Only, you will want to use addInstance when the user adds a new line.  This will cause a new line to appear on the form.  The newly added row is returned to you so that you can reference objects that it to, say, initialize certain values.

    Your check for error will happen later, probably when you press "submit" button so that you can validate the data.  At that time all lines will be added already and you no longer want to use addInstance or you will get only the new lines.  Instead, it is the time that you will have to wrap the lines (more on that later).

    When you want to indicate an error on a line, set the focus isn't the best way.  You can only set the focus on a single object, so if you have several lines with an error it no longer displays an error.  Your current script no longer shows that the last of them found. Better to use a nail color from the getgo. It is more complicated.

    If all you want to do is to ensure that a field is filled in, make it mandatory. the submission process will not proceed unless all required fields are filled.  If you want to do more advanced bugcheck on your data, you can use the script.

    There are many messages in the forum on the management of the validations before shipment.  A simple method is to place a hidden on the form and one submit button (visible) normal button labeled Submit that really is not a shipment.  In the second click event of the button, you put the validation script.  If the script detects any error then the script will run a click on the hidden submit button that will submit the form.  Otherwise the script will highlight errors and terminate; No shipment will be held.

    This is an update to your script.  I do not know the true structure of your form so I guess a little bit to the appropriate hierarchy, and you have to fill in names for values that are in italics. This script should reside in the click to the "dummy" event submit button.

    Get instances of line how much we have

    var nRows is TableName. _sfTableRow.count;

    var curRow = null;

    var valid = true;

    Loop through all rows

    for (var i = 0; i)< nrows;="">

    {

    Get the next instance of the line

    curRow = tablename.resolveNode ("sfTableRow [" + i + "]");

    Controls go here:

    If (curRow.phone.rawValue == "")

    {

    Do the red border and indicate that there is an error

    curRow.phone.border.edge.color.value = "255,0,0";

    valid = false;

    }

    }

    Form only if all fields are valid

    If (valid)

    submitbutton. execEvent ('click');

    on the other

    xfa.host.msgBox ("Please fill out all the fields in red before sending the form");

  • setfocus automatic entry field once the character max on previous set

    Hi I was hoping that someone can help me, I have had a decent look on the net, but have not yet encountered a difficulty.

    I have 2 fields of seizure and once the first is full (is character max), id like it auto focus to the next field, without the need for tab.

    Thanks in advance.

    Try:

    txt_1.OnChanged = function() {}

    If (this.length > = this.maxChars) {}
    txt_2.SetFocus ();
    }
    }

  • 'DAC reference ground connection' property causes the other channel to stop working

    Can I set allow connect DAC refers to a property on the ground on one channel and not the other?

    I have a channel of analog output of a card PCI-6251 set so the DAC reference can be set on the ground.

    I understand that this will work only if the reference of the DAC is the internal value. Since it's the default I him did not.

    I write out, then adjust the level to the ground.

    I try to write to each other on the same card and it will not work. Sometimes he changes temporarily but goes back to 0 volt. Most of the time it just does not change.

    If I remove the aforementioned property and action off the coast of the first string, the other channel works very well.

    Can't use this independent property? Or is it possible to fix this?

    The DAC reference connect to the ownership of the land can not be set for each channel.  In the LV help for this property (right click on the property in the property node and go to help for AO. DAC. Ref.ConnToGnd to go to the specific help page) it says:

    Grounding the internal DAC reference has the effect of grounding of all channels of analog output and stop the generation of waveform on all channels of analog output independently know if channels belong to the task at hand.

    If you can't limit what output channels will be grounded, it will be on the ground all channels that have the reference set inside.  If you try to change the property ' link DAC refers to the ground "to False for some channels and true for other channels, you will get the error 200106: property must have the same value for all channels on the device.

    A solution for this is instead set the DAC reference to the ground, put the source on the outside, and use APFI 0.  What you could do is outwardly wire GND AO for the APFI 0 (pin 20).  Then set the DAC reference outside.  The problem is that unlike the DAC reference connect to the ownership of land, which can be changed during execution of the task, the source of reference property is not editable during execution of the task.

  • How loose and remove the response messages of the original e-mail so I can send the original email to others?

    I find myself with a group of response attached to the original e-mail messages.  I can provide the original e-mail message exclusively to others so I want to detach and remove all the response information.

    Hello

    What email program are you using?

    Perhaps it would be not possible to separate the original message response message. You may need to contact the provider of e-mail for assistance on this issue.

    If you are referring to Hotmail or Windows Live Mail so here are the links of support that might help you.
    http://windowslivehelp.com/product.aspx?ProductID=1
    http://windowslivehelp.com/product.aspx?ProductID=15

  • Field.SetFocus causes no stack trace error

    Hi guys,.

    I have a custom GridFieldManager that stores mutlitple fields. I did a manual swap, i.e. to remove the index 1 and 2 fields and share their locations.  I need to remove the Manager before inserting the. This works very well for 2 fields and after this operation, I am able to set the focus, i.e. on which fields to index 2 except when I do the swap for the 2nd last and last operation. After that I moved the 2nd last field of the last clue, and I'm trying to set the focus on the field to the last index, I get an error no. Stack Trace and no other error message. Please help me for this problem.

    In the method that you call it from? If you call setFocus() on a field before there was a screen, you get an exception. As mentioned above, 'no trace of the stack' is not your error. Catch a Throwable to get a stacktrace.

    A way around this if you call setFocus() to a device that is not allowed, you can wrap in UiApplication.invokeLater ().

  • Pressure sensor ground loop problem

    Hello

    I have an interesting problem, I hope someone can help me with.

    I'm measuring pressure with a pressure sensor.  We see a lot of noise with the measure, and I believe that we have a ground loop.  I have checked the noise is 60 Hz.  What is interesting is that the case of the pressure sensor is connected to the Earth.  When we put on the sensor of metal pressure in the booth, we see the noise.  When disconnect us the stand noise pressure sensor disappears.  The stand is connected to the Earth.  I'm feeding the sensor with a 24V power supply which is also connected to the Earth.  I think that this is the ground loop.

    My problem is that the 24V power supply should be grounded for safety and the I cannot isolate the ground pressure sensor.

    I attached how I got the system wired.  How to connect up to my analog input module pressure sensor OR 9215 to break the ground loop?

    Thank you

    Dan

    Ahhhh Yes,

    I have solved this problem.  It is a ground loop.  I had the field related to 2 places.

    We have removed one of the references on the ground and poof everything worked fine.

    One of the problems I've found is a reference of external power supplies and others do not.  If you provide an additional reference to the Earth... Ground loop!

    Ground loops can be mean terrible things.  According to my experience, they are the number one electric goofiness and the noise causes.

    I have compiled some resources on my website to help people

    http://www.autosofttech.NET/resources

    The best is field wiring and considerations of noise for analog signals

    If you want the final word on the subject see this book

    Techniques of reduction of noise in electronic systems

    Hope that helps!

  • How to move the original system to the SSD newly installed without an optical drive?

    I want to buy a W530 and spare SSD upgrade.

    I want to order one without a DVD player.

    How to move the system of origin, drivers and other software for the SSD newly installed without an optical drive?

    Hope someone could help me. Thank you.

    The two utilities that I mentioned manage alignment automatically. Also, I photographed my hard drive, then restored the SSD. I have no clone, which means a direct copy of the HDD to the SSD.

    I just went through this myself in July, using Acronis True Image 2012 to get my existing on my 256 GB SSD mSATA HARD disk image. It worked like a charm. I checked that the SSD has been properly aligned.

    See:

    Migrate to SSD

    and:

    Check the alignment of SSD

    Now stop worrying!

  • "Generalized box Expierance" Sysprep.exe re-validate my Windows 7 license on the original motherboard

    I bought myself a new motherboard to replace the pre-built that I have

    and had to use the Sysprep.exe to boot on the new motherboard

    However I did not know that what is causing my Windows become invalid license
    To avoid buying a new license, can I use Sysprep.exe to Resintall the HARD drive on the old Board and have to re-validate the Windows license.

    The former Council will use a different CPU, however
    Point being, it is that I use the old parts of the original computer and others to build a computer for my girlfriend

    If she will ask the Commission to origin, can I give this HARD and buy my self a new copy of Windows for my self

    because I think that the less expensive road would then buy him a copy of windows and myself, a new license

    Or do I now have to purchase a license for this copy of windows now that I've done the OOBE Sysprep.exe?

    Hello

    Whenever there is a change of material in the computer operating system begins to exit the tolerance mode. You must activate the operating system to help online or by phone activation.

    Refer to this link: activate Windows 7 on this computer

    http://Windows.Microsoft.com/en-in/Windows7/activate-Windows-7-on-this-computer

    You can give your girlfriend the old hard drive (Note: it must enable the operating system again). However, you must make sure that the same product key is not used in another computer. If you don't use it, you will get a message that you are a victim of counterfeit software.

    I hope this helps.

  • I lost my Home Basic windows vista and windows 7 update disk, I have the original key, how can I found the file to download my o.s. in Italian language. Thank you.

    I lost 2 original disk windows, other windows Vista Home Basic Upgrade to windows 7 Home premium SP 1. I want to download my o.s. once my language is Italian, were I can find the link to download. Thank you m..

    Try to download again, maybe a corrupted download.

  • Cloned VM Windows domain mess up original VMS machine account

    If I have a XP or 2003 vm in the field and clone, what are the suggested steps to make it appear the clone if it does not interfere with the original VMs domain computer account? If I bring the clone of the network I can't remove it from the area, if I put on the network and try to delete/re-add to the field under a new name he saw the original machine in the field.

    Thank you

    w00005414 wrote:

    So just for clarification, I start the new virtual machine (the clone) and log in as local administrator but keep it out of the network and although it is out of the network, I'll in and remove the domain and change the name of the machine (is this license so that it is out of the network?) then when it restarts (always outside the network)

    Yes, it's fine. We do it all the time. Own is up as much as possible, then stop it.  From there, you can convert it into a template and set him off.

    > I've run it through sysprep and restart and place it on the network?

    Yes, it will work.

    What we usually do, is the clone of cleaning as the best possible (join the Working Group and the change of hostname) and convert it to a template.  From there, you can deploy oversized and use a customization specification and the new virtual machine deployed off the coast of your new model will come in single line.

  • Prevent development leave Manager then moving left/right

    I have a screen with a manager at the top, lower-left editfield and a button at the bottom right. I am trying to find a way to make sure if the user tries to move their development (with wheel) left/right, it moves back and fourth between these two fields. If the user moves to the top (in other fields), it will go directly to the Manager at the top, and if they move down it will stay on all the areas that they were on.

    I could get this to work with navigationMovement, but then the editfield would no longer work.

    Anyone have any ideas?

    After looking around the docs a bit more, I've finally came up with this solution. It is a bit hardcoded for my specific case, but should help others who have similar problems.

    protected int moveFocus(int amount, int status, int time) {
        int original = getFieldWithFocusIndex();
        int result = super.moveFocus(amount, status, time);
        boolean fieldChanged = (original != getFieldWithFocusIndex());
    
        // Move focus vertically
        if ((status & Field.STATUS_MOVE_FOCUS_VERTICALLY) == Field.STATUS_MOVE_FOCUS_VERTICALLY) {
            if (amount > 0) { // Move Down
                 // Just stay at the original field
                if (fieldChanged) getField(original).setFocus();
            } else { // Move Up
                // If the field changed leave manager
                if (fieldChanged) {
                    return -1;
                }
    
                // If the field didn't change return the result
                return result;
            }
        }
    
        // Don't leave the manager
        return 0;
    }
    
  • Confirming a design where I need to save where the user navigated to the screen.

    A matter of design, which is a good implementation of the following?

    I need to be able to save the location of the place where the user has scrolled, then when the user:

    1. Changing screens and returns to the previous screen.
    2. The application farm (moves the application at bottom) and opens the app again (move the app in the foreground).

    The user scrolls automatically here where the user was before.

    For example, if I have a VerticalFieldManager with the following text read only fields:

    • LabelField
    • LabelField
    • LabelField
    • LabelField
    • LabelField
    • ButtonField

    The user scroll down to the third LabelField — two actions user above performs, returns to the screen, and scrolls down to the third TextField again.

    Is the hardest part, I can't count on own dirty, muddy, or fields because it is read only the data and a ButtonField.

    I can't use Manager.setFocus because the fields have an accent.

    I think I can use Manager.setHorizontalScroll and Manager.getHorizontalScroll, but is there a better way?

    Not sure that your arguments to change my suggestion.

    "The user must be able to close the application."

    If they close the applciation that they lose their position.  It happens in most of the applications.  Browsers do not open up on top of the page you were viewing when you close, for example.

    "The user must be able to request the application thoroughly using the end key of red color"

    You will not be able to stop this.  It will just happen.  Nothing for you to do.

    "This is a pile of high display a screen where the Menu button is the main navigation.".

    This does not preclude that I proposed either possible.  If you pop a screen and then later push it, my understanding (and experience) are that he's going to be redisplayed as it was when you jump it.  The screens are objects, they don't stop screens just because they aren't on the stack of the screen.

    Also, I see no problem in what you descrtibed for a touchscreen device.

  • back to the top of the screen

    Currently if a user clicks on a button on the screen that an image is loaded in the upper part of the screen, is possible to make the made screen scroll up automatically?

    The best thing to do is to setFocus on the field that you want the user to see.  Maybe it's not the top.  If you really want the top, I think you can do this by using setVerticalScroll (0) on the manager who will be on top.  but we need to focus on something that can be seen on this position too.

Maybe you are looking for

  • menu button not shown

    Button, or menu bar tool is not available and I cannot locate where to activate

  • MS Office 2007 too slow and cannot be uninstalled

    Hello I want to uninstall my MS Office 2007 trial version that came with my new laptop (Vista OS) and install my version of Word 2000 instead. After 4 weeks of trying to use I would say that it is simply too slow, also in conjunction with other softw

  • Account live to be extinct?

    I received this email from: * address email is removed from the privacy *.  They said that this is an alert!  I think they are scamming and are looking for accounts.  It says my Live accountcloses in 48 hours if I do not give my name, e-mail, usernam

  • When browsing the net I get ads on the same page as my email

    Whenever I have begin to surf the net for anything, I get a lot of ads related to what I'm looking for. The ads appear on the same page as my email. Most embarrassing and I continue having remove the ad.  How can I stop this?

  • Help! RV042 access rule

    Good day to all... I have set up my purchase new RV042 router, in the access rule, I deny all the services of the source is Lan and WAN are. My concern is that I want to allow LAN to access the internet, so i ' ved create another rule allowing http,