Horizontal Scrolling in AbsoluteFieldManager

Hello

I am trying to add several labels to an AbsoluteFieldManager as follows:

        final AbsoluteFieldManager man = new AbsoluteFieldManager();

        man.add(new LabelField("1", Field.FOCUSABLE), 20, 0);
        man.add(new LabelField("2", Field.FOCUSABLE), 30, 100);
        man.add(new LabelField("3", Field.FOCUSABLE), 0, 200);
        man.add(new LabelField("4", Field.FOCUSABLE), 0, 220);
        man.add(new LabelField("5", Field.FOCUSABLE), 150, 240);
        man.add(new LabelField("6", Field.FOCUSABLE), 300, 260);
        man.add(new LabelField("7", Field.FOCUSABLE), 300, 280);
        man.add(new LabelField("8", Field.FOCUSABLE), 300, 300);
        man.add(new LabelField("9", Field.FOCUSABLE), 300, 320);
        man.add(new LabelField("10", Field.FOCUSABLE), 350, 320);
        man.add(new LabelField("11", Field.FOCUSABLE), 400, 320);
        man.add(new LabelField("12", Field.FOCUSABLE), 450, 320);
        man.add(new LabelField("13", Field.FOCUSABLE), 500, 320);
        man.add(new LabelField("14", Field.FOCUSABLE), 550, 320);
        man.add(new LabelField("15", Field.FOCUSABLE), 600, 320);
        this.add(man);

When I move on the trackpad, the next label Gets the focus. This works well in the direction y. All labels with Label '12' are visible. When I try to get the focus to the next label, '12' Label loses focus. '13' label now has the development in-house, but it is not visible and no scrolling happens. Ditto for the "14" and "15". It is easy to notice, the focus moves to the 14 and 15, because it takes a lot of movement on the trackpad to return to 12. But why the AbsoluteFieldManager scrolls at 13, 14 and 15 to make them visible?

I also tried to add the AbsoluteFieldManager to a HorizontalScreenManager that has vertical and horizontal scrolling. Then, it is even possible to scroll, but not yet all of the labels are visible.

Is that what I can do to make it possible that the AbsoluteFieldManager scrolls auotmatically once a field outside of the visible area Gets the focus?

Thank you

Hello

Finally, I made my own AbsoluteFieldManager. It works really well. You can position your fields anywhere and just highlight the field you want. I also substitute nextFocus() which now moves according to the movement of pad/trackball. I think it is fairly intuitive and not according to the order of the fields. You can also use it on Blackberry OS prior to 5, where AbsoluteFieldManager is not supported.

This thread helped me a lot:

http://supportforums.BlackBerry.com/T5/Java-development/AbsoluteFieldManager-on-OS-prior-to-5-0/TD-p...

Here is the code, feel free to use or improve.

import java.util.Vector;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.XYPoint;

public class ImageMenuFieldManager extends Manager
{

    protected Vector _coordinates;

    public ImageMenuFieldManager()
    {
        super(Manager.VERTICAL_SCROLL | Manager.HORIZONTAL_SCROLL);
        _coordinates = new Vector();

    }

       public int getPreferredWidth()
      {
            return Integer.MAX_VALUE >> 1;
       }

       public int getPreferredHeight()
        {
           return Integer.MAX_VALUE >> 1;
       }

    protected void sublayout(final int maxWidth, final int maxHeight)
    {
        int totalWidth = 0;
        int totalHeight = 0;
        final int noOfFields = getFieldCount();
        final int maxSize = Integer.MAX_VALUE >> 1;

        for (int i = 0; i < noOfFields; ++i)
        {
            final XYPoint fieldPos = (XYPoint) _coordinates.elementAt(i);
            final Field field = getField(i);
            layoutChild(field, maxSize - fieldPos.x, maxSize - fieldPos.y);
            setPositionChild(field, fieldPos.x, fieldPos.y);
            totalWidth = Math.max(totalWidth, field.getExtent().X2());
            totalHeight = Math.max(totalHeight, field.getExtent().Y2());
        }
        setExtent(Math.min(maxWidth, totalWidth), Math.min(maxHeight, totalHeight));
        setVirtualExtent(totalWidth, totalHeight);
    }

    protected int nextFocus(final int direction, final int axis)
    {

        final int focusFieldIndex = this.getFieldWithFocusIndex();

        final int size = _coordinates.size();
        final XYPoint position = (XYPoint) _coordinates.elementAt(focusFieldIndex);
        int shortestAbsoluteDistance = 0;
        int nearestIndex = focusFieldIndex;
        for (int i = 0; i < size; i++)
        {
            //skip focus field
            if (i != focusFieldIndex)
            {

                final XYPoint p = (XYPoint) _coordinates.elementAt(i);
                final int xDistance = p.x - position.x;
                final int yDistance = p.y - position.y;
                final int absoluteDistance = (xDistance * xDistance) + (yDistance * yDistance);

                //point p is in direction right
                if (direction > 0 && xDistance > 0 && axis == Manager.AXIS_HORIZONTAL)
                {
                    if (absoluteDistance < shortestAbsoluteDistance || shortestAbsoluteDistance == 0)
                    {
                        shortestAbsoluteDistance = absoluteDistance;
                        nearestIndex = i;
                    }
                }
                //point p is in direction left
                if (direction < 0 && xDistance < 0 && axis == Manager.AXIS_HORIZONTAL)
                {
                    if (absoluteDistance < shortestAbsoluteDistance || shortestAbsoluteDistance == 0)
                    {
                        shortestAbsoluteDistance = absoluteDistance;
                        nearestIndex = i;
                    }
                }

                //point p is in direction down
                if (direction > 0 && yDistance > 0 && axis == Manager.AXIS_VERTICAL)
                {
                    if (absoluteDistance < shortestAbsoluteDistance || shortestAbsoluteDistance == 0)
                    {
                        shortestAbsoluteDistance = absoluteDistance;
                        nearestIndex = i;
                    }
                }

                //point p is in direction up
                if (direction < 0 && yDistance < 0 && axis == Manager.AXIS_VERTICAL)
                {
                    if (absoluteDistance < shortestAbsoluteDistance || shortestAbsoluteDistance == 0)
                    {
                        shortestAbsoluteDistance = absoluteDistance;
                        nearestIndex = i;
                    }
                }

            }
        }

        return nearestIndex;

    }

    public void add(final Field field)
    {
        throw new IllegalArgumentException("You need to provide x and y coordinates to add a field. Use add (Field field, int x, int y) instead");
    }

    public void add(final Field field, final int x, final int y)
    {
        super.add(field);
        this._coordinates.addElement(new XYPoint(x, y));
        updateLayout();
    }

}

Tags: BlackBerry Developers

Similar Questions

  • Can I use horizontal scroll to switch between tabs?

    I find it useful to switch between tabs with the side-scrolling my mouse wheel. Can I configure Firefox in this way?

    Apparently FireGestures doesn't support scrolling directly if you can't make it work. I have no local way to test it, because nobody doesn't know I have a mouse with a horizontal scrolling. FireGestures provides alternatives (I use the tab scrolling of line), however, and supports scripts , if you want to try to use the technical information provided by cor - el.

    One avenue would be to use the mouse like Logitech Setpoint or Microsoft Intellipoint software to set the scrolling to run the FF Ctrl + PgUp and Ctrl + PgDown hotkey combo. This would negate native scroll, however.

    You can leave your comments at https://input.mozilla.org/en-GB/feedback/ if you do not want to see this feature implemented. I think you're better of trying to get an add-on to do this though, as horizontal scrolling appears to remain a characteristic very niche.

  • Why the horizontal scroll bar does not disappear when windows are maximized, but reappears when minimize?

    I'm a fool to the computer. I fix my car and I don't fix my computer. If there is no easy solution, I'll pay someone to do it for me. So, is there an easy way to retrieve my horizontal scroll bar? I've updated to the latest Firefox (35). I restored my computer to an earlier date when everything was ok. I downloaded another browser (Chrome) to see if that would fix it. Nothing has worked. The system I use is Windows 7 64 bit. I tried not to do anything, because this has led to big problems in the past. Suggestions, or I need to take the machine to my fix - it person?

    Thanks for any assistance yu might be able to provide.

    Bingo! You have reason, cor - el. Thank you.

    I never noticed this before. Sometimes (when I'm too lazy to get up and do my glasses or cannot find them) I just increase the size of the window.

    To me it seemed that the scroll bar was still there, and then it wasn't. Hours lost, but a lesson learned. I did not mention that I am a fool to the computer, I don't?

    Thank you!!!

  • The horizontal scroll bar is not here on some websites.

    The horizontal scroll bar is missing when I visit certain websites. This is one of the Web sites, but there are many others still: http://www.fixya.com/support/t23137801-cannot_connect_android_tablet_arris

    I know it is contained to the left or to the right of the portion of the screen I see because I can get by using the arrow keys on some Internet sites. On other sites, the arrows do not move the screen, but I know that it is contained on the side because I can see the edges of the images and buttons.

    I tested two other browsers on the example site that I mentioned above. Internet Explorer does not have the problem, Chrome has the same problem with the scroll bar, like Firefox.

    This problem is tolerable on Web sites were the arrows are a substitute, but on other sites, it makes the site unusable.

    I have disabled all browser extensions, and that did not solve the problem. Change the screen resolution has no effect on the problem. I use Windows XP on a ten year old desktop computer. Windows updates are installed automatically.

    McGyver

    While I don't see anything poking out around the edges of this page, I'm blocking part of the content of the site (e.g., Facebook integration, text-link advertising), so very likely your seems different from mine.

    When you compare IE on the same page, what types of photos/buttons do you find on the edges?

    She brings the peripheral from the edge elements if you zoom 'out' of the page holding the key Ctrl and tapping the button several times? You can return to your preferred zoom level by holding the CTRL key and tapping the button you like +.

  • How do horizontal scrolling via mousewheel tilt work in FF 20.0.0.1?

    EDIT: I solved this problem on my end. It turns out that my mouse manufacturer had a "helper" program that has been screwing the horizontal tilt support. Stop smoking it solved the problem. To other people having the same problem, I recommend that you check the utility of using your mouse.

    -

    I give myself to understand that previous versions of Firefox support a horizontal scrolling when it is used with a scroll wheel mouse that supported messages of tilt. However, I was unable to make it work on Firefox 20.0.1. I tried to disable scrolling smoothly, hardware acceleration, restart in safe mode, but it doesn't seem to make a difference.

    (The troubleshooting information below represent the usual configuration of my browser, disable all extensions).

    However, other applications seem to handle mousewheel tilts very well; I tried it with applications as simple as Notepad on Windows and they scroll horizontally in response to the inclinations of mousewheel. I'm puzzled; delete Mozilla tilt support in future versions of Firefox?

    Great to hear that you got it working! Thank you to come back and post the resolution for other users who may have the same problem.

  • After Firefox 12, some form in our help desk application fields do not display correctly. They appear as fields of horizontal scroll instead.

    We use a system of assistance to work (remedy of the BMC IT Service Management). In version 12 Firefox, all fields are displayed correctly in the form. However, if I switch to a version higher than 12, some fields appear as fields of horizontal scrolling (without displaying the data in them). Therefore, I am forced to stay on version 12 for the work.

    Found that it is actually a problem with the BMC Remedy system in use (version 7.1). Here are the details if anyone is interested: https://communities.bmc.com/communities/message/256456

  • Some web sites do not display a bar of horizontal scrolling but IE don't

    For example: http://shop.ghirardelli.com/category-exec/category_id/35/nm/Sale/?utm_source=chocomail & utm_medium = pos1_save10 - 30 DL & utm_campaign = 20111124

    This site uses the CCS code (overflow-x: hidden) to hide the horizontal scroll bar.

    It is also missing in Google Chrome.

  • LPX without horizontal scroll bars

    cannot scroll. the horizontal scroll bars do not appear in the main window and not in the mixer. Why? any idea? new bug?

    Go to the preferences of OS X system...-> general

    The value of the Show scroll bars always...

  • Horizontal scrolling problem the office 2016

    Hello, I'm an old fan of Thinkpad, used more than 12 thinkpad machines.

    My current main machine is X 1 carbon 3rd gen, OS Windows 10

    I'm very frustrated, because the two Touchpad and trackpoint horizontal scrolling in MS office 2016, particularly excel and onenote, does not work.

    I tried to install and reinstall the drivers and formatted the machine several times.

    I tried to find the solution on the web, but there is no clear solution to this subject so far, unfortunately.

    Above all, I am very angry with the ignorance and slow technical support from Lenovo.

    Because this problem was published for more than a year.

    An idea for horizontal scrolling?

    In response to the customer, reports that horizontal scrolling in MS Office was not supported on ThinkPad several models running Windows 10, an update of the Synaptics driver was published for this problem.

    Models:

    ThinkPad P50s

    ThinkPad T460s, T560

    ThinkPad X 250

    ThinkPad X carbon 1 (types of Machine: 20BS, 20BT 20FB, 20 CF)

    Tablet ThinkPad X 1 (20GG, 20GH)

    ThinkPad X 1 Yoga (types of Machine: 20FQ, 20FR)

    Version 19.3.4.39

    (Fix) Fixed an issue where a horizontal scrolling may not work in MS Office when the Firefox browser was opened.

    (Fix) Fixed an issue where scrolling icon may have overlay of black color in the recent Windows 10 environment.

    Synaptics ThinkPad UltraNav Driver, v 19.3.4.39, can be downloaded here: http://support.lenovo.com/us/en/downloads/DS118386

    Thank you

  • ThinkPad Compact Bluetooth keyboard: how to enable horizontal scrolling?

    Hi all

    any advice on "how to enable horizontal scrolling" on my Bluetooth keyboard external ThinkPad?

    It is available with my current ThinkPad 450 and was with my a previous T420.

    I bought the keyboard because it has the same layout and the trackpoint, but I had no idea that the behavior would be different.

    Thank you very much for your help.

    Goodbye Kenny

    Hello

    I just noticed on the driver it seems that horizontal scrolling has been fixed.

    1.5.1.0 2016-03-11
    Fixed, HScroll.

    Here is the driver for download.

    Concerning

  • ListBox with visible horizontal scrolling

    Hello

    We all know that a listbox control comes with a default vertical scroll bar (which can be selected or deselected).

    I have attached a vi that has the list box with visible horizontal scroll bar.

    Now, I did my self by playing with custom control and I'm unable to reproduce the same since I forgot how I did it. has anuone tried before and if yes throw some light on this?

    Guru

    First use a "multi-column listbox" with visible horizontal scroll bar. Then replace you it with a simple "Listbox" and the property is preserved.

    It's strange, but it works. I guess the simple "Listbox" is a mild form of listbox multicolumn with limited options...

  • X 1163 projector shows smaller than the computer screen image and creates the horizontal scroll bar

    I just bought an Acer X 1163 projector for use in presentations. I like the brightness, size and features. I am disappointed to make a PowerPoint slideshow, you need to buy another remote, but it is an easy fix.

    Here's what's really about me!

    When I pull a Web site or other things on my laptop for the presentation, it has a horizontal scroll bar and does not fit it on the screen. I tried different settings and who are seeking an answer online, but can't find what I can do to get the image to display without a horizontal scroll bar.

    I'm almost beginning to panic that I bought this for a large presentation I have to give next week. I hope it's one of those stupid questions with an easy answer.

    Thanks in advance for your help.

    My techy boyfriend just called. Here is the solution. (It kills me when someone has a question asked and more later said: "never mind, I figured it" and never says how do to the next person to come.)

    The question seems to be in the computer resolution setting and how it automatically resets when plugging n the projector. To resolve this problem (at least in windows 7) follow these steps:

    Right click on the desktop

    Click on display

    Click on change display settings

    Select the 1366 x 768 resolution

    It shows exactly what I'm looking for now on my computer.

    Thank you for having a forum to ask in all cases

  • Problem with setting "Horizontal scrolling with tilt wheel"

    All of a sudden, everytime I open a spreadsheet it acts as if I am pressing the arrow button to the right and the active cell moves to the right as quickly as possible.

    At the same time:
    1. my wireless Microsoft mouse leave with the scroll wheel.
    2. when I click a down arrow, the menu is displayed for a split second, then disappears.
    Any ideas what may have caused this?
    * original title - Excel-unstoppable to the right at the opening of automatic pagination

    1 only with Excel

    2 Microsoft 6000v2.0
    3. since Monday morning, when I opened a spreadsheet
    4. the system changes. I didn't touch anything.
    5. the keyboard is clear. It only happens in Excel.
    I managed to do stop by disabling "horizontal scrolling with tilt wheel" in the mouse properties. Absolutely, I know for a fact that nobody changed this setting, but it became somehow activated.
  • Horizontal scroll bar went

    Horizontal scroll bar on web pages has disappeared.  How can I get that back?

    Hello

    Check the right lower setting on IE - + 100% (can be defined below) - set if necessary.

    Also check the VIEW - ZOOM and VIEW - text size (the average is the default)

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

    What antivirus/antispyware/security products do you have on the machine? Be one you have NEVER
    on this machine, including those you have uninstalled (they leave leftovers behind which can cause
    strange problems).

    If no joy there's something blocking perhaps.

    Start - All Programs - Accessories - System Tools - IE with no Addons - what works best?

    IE - Tools - Internet Options - Advanced - tab click on restore, and then click Reset - apply / OK

    IE - Tools - Internet Options - Security tab - click on reset all default areas - apply / OK

    Close and restart IE or IE with no addons

    not better?

    IE - tools - manage Addons (for sure disable SSV2 if she's here, it is no longer necessary but Java
    installs and it causes more questions - have you never update Java to go back in and turn it off again.) Search
    other possible problems.

    Windows Defender - tools - software explore - look for problems with programs that do not look right.
    Allowed are usually OK and "unauthorized" are not always bad. If in doubt about a program, ask
    topic here.

    Could be a free - BHOremover - BHO - standalone program, needs no installation, download and run.
    not all are bad, but some can cause your question (toolbars are BHO).
    http://securityxploded.com/bhoremover.php

    How to change, add or remove startup programs in Windows 7
    http://www.SevenForums.com/tutorials/1401-startup-programs-change.html

    Also get Malwarebytes - free - use as scanner only.

    http://www.Malwarebytes.org/

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

    Try these to erase corruption and missing/damaged file system repair or replacement.

    Run DiskCleanup - start - all programs - Accessories - System Tools - Disk Cleanup

    Start - type in the search box - find command top - RIGHT CLICK – RUN AS ADMIN

    sfc/scannow

    How to fix the system files of Windows 7 with the System File Checker
    http://www.SevenForums.com/tutorials/1538-SFC-SCANNOW-Command-System-File-Checker.html

    Then run checkdisk (chkdsk).

    How to run check disk in Windows 7
    http://www.SevenForums.com/tutorials/433-disk-check.html

    I hope this helps.

    Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.

  • How do disable you dynamic horizontal scrolling "feature"?

    How do disable you dynamic horizontal scrolling "feature"?
    its totally _ me off. Im trying to use a new program of photo manipulation, but can't zoom in and because it scrolls the work area, I need trouble! Ugh! I swear to God _... it's just ridiculous!
    Please someone tell me how to disable this "feature".

    musgoodw, the best advice I can do is just play with the settings of '' mouse. ''  Just type mouse into the start menu.
    By default, a Synaptics touchpad has a vertical scroll box to the right of the touchpad. Some versions of pilot also (default) enable the horizontal scroll down box.
    Both can be changed to enabled, amount of space used, where they are, speed of scrolling and much more in the config of Synaptics.  You would be pleasantly surprised how you can set one up.  ;)

    HTH,
    Chris [If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message.] [Marking a post as answer, or relatively useful, you help others find the answer more quickly.]

Maybe you are looking for

  • IOS 9.3 URL cause mail crashing and do not work in Safari

    With the last update of iOS 9.3, I am more able to follow email URL links.  When I select a link, my Mail app breaks down.  I have also run into similar problems on Safari in trying to follow any URL in a web page.  This problem happens on my iPhone

  • Are there new games for XP like Solitaire, Spider, etc.. ?

    My parents have no access to the web. They like the original games available with XP. I am curious to know if there is other games most - base card - which are similar and not on the web. Thanks in advance.

  • Windows Media Center will not start, ehshell.exe is not signed

    After seven years of flawless performance my Toshiba Qosmio G25-AV513 desperately needing a reload XP MCE 2005.  Since reloading all service packs windows and updates, the only thing I get when starting MC is the following message is displayed. I tri

  • Audio book using Overdrive

    I love my Sansa Clip and use it for books from my local library digital overdrive.  I have a question which I hope someone can help me with.  The clip is very strong for bookmarking so I can go back and forth between books and music.  When I charge t

  • Problem event name: APPCRASH application name: explorer.exe app Version: 6.0.6002.18005

    Please could someone help? I copied stuff from a friend on an external hard drive of mine. It is possible to go on the drive when it is connected and other records, but as soon as I try to go in this specific folder Windows Explorer crashes. My anti-