image bitmap field not seized touch event

Hi all

I've implemented a customButton class that extends from BitmapField to tuchscreen.

The CustomField is FOCUSABLE.

I placed 6 these customButtons in a horizontal field.

First 3 buttons are getting clicked correctly but the last three are not capture any key event.

The procedure is the same for all. But still this is happening.

Can someone tell me why its happening? How can I solve this problem?

I solved the problem

the code is shown in the link

http://supportforums.BlackBerry.com/T5/Java-development/capturing-click-event-of-buttons-oat-right-c...

Tags: BlackBerry Developers

Similar Questions

  • custom bitmaps field not change image when click on

    I created a custom bitmap field and I change the image on the center of my field of custom bitmaps and unfocus

    but when I implement the method of navigation click to change the image when you click on this image does not change...

    my custom bitmap field filed only to focus or unfocus on the image does not change my field of custom bitmaps.

    Bitmap onfocus = Bitmap.getBitmapResource("111.png");
                    Bitmap onunfocus = Bitmap.getBitmapResource("666.png");
                    mybutton1 = new CustomBitmapField(0,"",onunfocus,onfocus,Field.FOCUSABLE){
                         protected boolean navigationClick(int status, int time) {
    
                             mybutton1.setBitmap(Bitmap.getBitmapResource("favu.png"));
    
                             return true;
    
                         }
    
                    };
    add(mybutton1);
    

    and my class of field customBitmap is

    public class CustomBitmapField extends BitmapField {
    
        Bitmap Unfocus_img, Focus_img, current_pic;
        int width;
        String text;
        Font font; 
    
        public CustomBitmapField(int width, String text, Bitmap onFocus, Bitmap onUnfocus, long style) {
            // TODO Auto-generated constructor stub
            super();
            Unfocus_img = onUnfocus;
            Focus_img = onFocus;
            current_pic = onFocus;
            this.text = text;
            this.width = width;
    
        }
        protected void layout(int width, int height)
        {
            setExtent(current_pic.getWidth(), current_pic.getHeight());
        }
        protected void paint(Graphics graphics)
        {
            /*try
            {
                    FontFamily fntFamily = FontFamily.forName("BBAlpha Sans");
                    font = fntFamily.getFont(Font.BOLD,14);
            }
            catch(Exception e)
            {
                font = Font.getDefault();
    
            }
            graphics.setFont(font);
            graphics.setColor(Color.WHITE); */
            graphics.drawBitmap(0, 0, current_pic.getWidth(), current_pic.getHeight(), current_pic, 0, 0);
    
            //graphics.drawText(text, width, 7);
        }
        protected void onFocus(int direction)
        {
            super.onFocus(direction);
            current_pic = Unfocus_img;
    
            this.invalidate();
        }
      protected void drawFocus(Graphics graphics, boolean on)
      {
    
        }
        protected void onUnfocus()
        {
            super.onUnfocus();
            current_pic = Focus_img;
            invalidate();
        }
        public boolean isFocusable() {
            return true;
        }
        protected boolean navigationClick(int status, int time) {
    
            fieldChangeNotify(0);
            return true;
        }
    
    }
    

    When you debug this code, which of your methods of navigationClick, is actually used?

    When you expect the bitmap change, the code should lead object so that to happen.  Paint running?  This is the correct Bitmap painting?

    If you answer these questions, I think that you figure to yourself what is the problem.

    While you're there, you can also watch the following Threads that you have started or contributed to.  Can you solve or continue to contribute to these?

    http://supportforums.BlackBerry.com/T5/Java-development/gif-animation-not-displaying-properlly/m-p/2...

    http://supportforums.BlackBerry.com/T5/Java-development/timepicker-issue/m-p/2387819

    http://supportforums.BlackBerry.com/T5/Java-development/ListField-focus-color-problem/m-p/2407881#m2...

  • Zoom on the image Bitmap field

    Good morning to all"

    I want to zoom in on BitmapField. Is it possible to BB?

    TNX your tips.

    What do you mean by 'zoom in '?  If you want to enlarge a bitmap image, you can use EncodedImage.scaleImage32 (as long as you are able to get your image as an EncodedImage data).  Here's an example of utility code I had to scale an image based on its width or height.  Using this as a basis, it should be simple enough to adapt it to your specific needs.  If not, let me know; I have a lot of image processing code.

     public static EncodedImage scaleImageToWidth(EncodedImage encoded, int newWidth) {
            return scaleToFactor(encoded, encoded.getWidth(), newWidth);
        }
    
        public static EncodedImage scaleImageToHeight(EncodedImage encoded, int newHeight) {
            return scaleToFactor(encoded, encoded.getHeight(), newHeight);
        }
    
        public static EncodedImage scaleToFactor(EncodedImage encoded, int curSize, int newSize) {
            int numerator = Fixed32.toFP(curSize);
            int denominator = Fixed32.toFP(newSize);
            int scale = Fixed32.div(numerator, denominator);
    
            return encoded.scaleImage32(scale, scale);
        }
    
  • dominant touch event handler replaces all other fields

    I have the code following, which uses gestures to perform scrolling on my hfm, but substitution of this hfm, replace essentially all fields on the screen, making them useless. How is this possible, I thought that this specific touchEvent belonged to the hfm? How to work around this problem and just disable scroll for the hfm?

    gallery = new CustomHFM(){
    
                protected void sublayout(int maxWidth, int maxHeight){
                    super.sublayout(maxWidth, 200);
                    setExtent(maxWidth,200);
                }
    
                protected boolean touchEvent(TouchEvent message){
    
                    int eventCode = message.getEvent();
    
                    if(eventCode == TouchEvent.GESTURE){
                        System.out.println("SWIPE GESTURE");
                        TouchGesture g = message.getGesture();
                        int gesturecode = g.getEvent();
                        int direction = g.getSwipeDirection();
    
                            //gallery.setHorizontalScroll(page_two, true);
                        if(direction == TouchGesture.SWIPE_WEST)
                            slideNext();
    
                        if(direction == TouchGesture.SWIPE_EAST)
                            slidePrev();
    
                        pressed = true;
                    }
    
                    if(eventCode == TouchEvent.UP){
                    pressed = false;
    
                    //slide();
                    }
    
                    return true;
                }
            };
    

    I want to just do not use the default scroll and do my own thing! Any suggestion would be appreciated, I'm really in the fire right now.

    OK, this is a different problem.  I suspect that you must reject touch events that are not actually within your HFM.  Then add code like the following at the beginning of your touchEvent method:

    int x = message.getX (1);
    int y = message.getY (1);
    If (x < 0="" ||="" y=""> < 0="" ||="" x=""> getExtent () .width: y > getExtent () .height) {}
    Outside the scope
    Returns false;
    }

    If this is not enough, so be sure that your touchEvent method is called.  If it really is, then I think you have a problem with a Manager.  You have all Directors complicated on your screen.  Try to simplify the screen so that you don't use native components RIM (and nothing implying positioning as AbsoluteFieldmanager and see if the problem persists.)  If so, then see if you can post an example of the sample that shows the problem so that we can all try.

  • How to manage touch event in the field

    Hello

    I created field checkbox custom, when am touch event for her manipulation, emphasis is gettting inside, and when I try to click on any other components such as the box native, afer by unchecking the custom check box, the custom box is clicking again.

    How to handle this?

    Thank you

    Rakesh Shankar

    There are certain basics that one needs to understand to effectively manage key events:

    (1) touch events are sent to the field currently has focus and the enveloping managers, including the active screen.

    (2) default response of the system to the event down is to divert attention to the field to the position of touch If there is a focusable it. If there is no focusable point touch field, the field currently has focus is unchanged. There's no "unfocus everything ' method in BlackBerry (there might be, but it is not readily available - there is a protected method focusRemove, but it is supposed to be used in conjunction with a later focusAdd protected in cases where the field has changed its focus rectangle - a classic example is any input field or text such as EditField or RichTextField view)

    (3) the default action of TouchEvent.CLICK is to call trackwheelClick (which, by default, invokes navigationClick) which is a great way to ensure consistency between the 'clicks' and clicks touchpad screen. The same is true for unclicks finally managed by navigationUnclick.

    If you want to disable the click by default if the key is outside all focusable fields and will not disrupt the rest of the system, just return true if the event is to CLICK, but the contact details are outside the scopeand actions super.touchEvent otherwise. And keep your return true; on all UNCLICK events: it's a good idea if you don't want to see the context menu from appearing each time or field click reaction called twice.

    The example of Peter was written when I've heard most of it already, but now I realize that you can do a lot easier. See part highlighted the previos section.

    Good luck!

  • A touch event image resizing

    Hi I want to resize an image in touch event if the user stretch the image should increase the size of the image and reduces the image should reduce the size of the image, is it possible thanks in advance

    It is, and this example should help you:

    Rotate and scale of bitmaps

    http://supportforums.BlackBerry.com/T5/Java-development/rotate-and-scale-bitmaps/Ta-p/492524

  • Images bitmap will be not smooth.

    Hello again,

    I'm loading external images and try to get them to smooth out, but for some reason, this isn't the case. I've tried everything I can find on the internet in the last 10 hours or and nothing has worked.

    The code on my movieclip (first image) is:

    var Ldr:Loader = new Loader();

    var UrlR:URLRequest = new URLRequest("myImage.jpg");

    LDR.x = 340

    LDR.y = 0

    addChild (Ldr);

    LDR. Load (UrlR);

    everything works fine to get the image on the stage.

    I have tried many variations of the following (immediately after the code above):

    var myBitmap = new Bitmap (image Bitmap (Ldr.content) .bitmapData, "auto", true);

    OR Bitmap (Ldr.content) .smoothing = true;

    ETC.

    I also tried:

    internship. Quality = StageQuality.BEST;

    on my first frame of the main timeline, but my images were still in staircase

    My pictures are of very high resolution, so I know this isn't a resolution problem. Anyway, they look crappy when they size down too. also, I'm sure that smoothing is the question, because I have a very similar image in the library (details at the same time and a similar resolution, etc.), and it is great when I allow smoothing in the bitmap properties panel.

    Anyone know what is missing in my code?

    Thank you!

    Robin

    AFTER loading is completed, apply your image bitmap and smoothing.

  • iLLEGALARGUMENT EXception on touch event

    package mypackage;
    
    import java.util.Vector;
    
    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FocusChangeListener;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.Manager;
    import net.rim.device.api.ui.TouchEvent;
    import net.rim.device.api.ui.TouchGesture;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.XYRect;
    import net.rim.device.api.ui.component.BasicEditField;
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.component.SeparatorField;
    import net.rim.device.api.ui.component.Status;
    import net.rim.device.api.ui.container.HorizontalFieldManager;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    public class PlaylistTab extends MainScreen  implements FocusChangeListener{
    
        private int _xCoord = 0; //The x coordinate for the top left corner of the image.
        private int _yCoord = 0; //The y coordinate for the top left corner of the image.
        private int _xTouch = 0; //The x coordinate of the previous touch point.
        private int _yTouch = 0; //The y coordinate of the previous touch point.
    
        private LabelField tab1;
    
        private LabelField tab2;
    
        private LabelField tab3;
    
        private LabelField spacer1;
    
        private LabelField spacer2;
    
        private VerticalFieldManager tabArea;
    
        private LabelField tab1Heading;
    
        private BasicEditField tab1Field1;
    
        private BasicEditField tab1Field2;
    
        private LabelField tab2Heading;
    
        private BasicEditField tab2Field1;
    
        private BasicEditField tab2Field2;
    
        private LabelField tab3Heading;
    
        private BasicEditField tab3Field1;
    
        private BasicEditField tab3Field2;
    
        private VerticalFieldManager tab1Manager;
        private VerticalFieldManager tab2Manager;
        private VerticalFieldManager tab3Manager;
        int tabNum = 1;
        public PlaylistTab()
        {
            super(NO_VERTICAL_SCROLL | NO_VERTICAL_SCROLLBAR);
            //HorizontalFieldManager hManager = new HorizontalFieldManager();
            HorizontalFieldManager hManager = new HorizontalFieldManager(NO_VERTICAL_SCROLL | NO_VERTICAL_SCROLLBAR | NO_HORIZONTAL_SCROLL  | NO_HORIZONTAL_SCROLLBAR);
            Font font = getFont().derive(Font.PLAIN, 35);
            tab1 = new LabelField("Songs", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_SELECT)
            {
                protected boolean navigationClick(int status,int time){
    
                    return true;
                }
                protected void layout(int width, int height) {
                    super.layout(width, height);
                    //    this.setExtent(this.getWidth(), 60);
                    this.setMargin( ( getHeight() - this.getPreferredHeight()), 0, 0, (getWidth() - this.getPreferredWidth()));
                }
            };
            tab2 = new LabelField("Album", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_SELECT)
            {
                protected boolean navigationClick(int status,int time){
    
                    return true;
                }
                protected void layout(int width, int height) {
                    super.layout(width, height);
                    //    this.setExtent(this.getWidth(), 60);
                    this.setMargin( ( getHeight() - this.getPreferredHeight()), 0, 0, (getWidth() - this.getPreferredWidth()));
                }
            };
            tab3 = new LabelField("Artist", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_SELECT)
            {
                protected boolean navigationClick(int status,int time){
    
                    return true;
                }
                protected void layout(int width, int height) {
                    super.layout(width, height);
                    //    this.setExtent(this.getWidth(), 60);
                    this.setMargin( ( getHeight() - this.getPreferredHeight()), 0, 0, (getWidth() - this.getPreferredWidth()));
                }
            };
            spacer1 = new LabelField(" | ", LabelField.NON_FOCUSABLE);
            spacer2 = new LabelField(" | ", LabelField.NON_FOCUSABLE);
    
            tab1.setFocusListener(this);
            tab2.setFocusListener(this);
            tab3.setFocusListener(this);
            hManager.add(tab3);
            hManager.add(spacer1);
            hManager.add(tab2);
            hManager.add(spacer2);
            hManager.add(tab1);
    
            add(hManager);
            add(new SeparatorField());
    
            tab1Manager = new VerticalFieldManager(VERTICAL_SCROLL | VERTICAL_SCROLLBAR );
            tab2Manager = new VerticalFieldManager(VERTICAL_SCROLL | VERTICAL_SCROLLBAR );
            tab3Manager = new VerticalFieldManager(VERTICAL_SCROLL | VERTICAL_SCROLLBAR );
    
            tabArea = displayTab3();
            add(tabArea);
    
        }
        public void focusChanged(Field field, int eventType) {
            if (tabArea != null) {
                if (eventType == FOCUS_GAINED) {
                    if (field == tab1) {
                        System.out.println("Switch to Tab 1");
                        delete(tabArea);
                        tabArea = displayTab1();
                        add(tabArea);
                    } else if (field == tab2) {
                        System.out.println("Switch to Tab 2");
                        System.out.println("Switch to Tab 1");
                        delete(tabArea);
                        tabArea = displayTab2();
                        add(tabArea);
                    } else if (field == tab3) {
                        System.out.println("Switch to Tab 3");
                        System.out.println("Switch to Tab 1");
                        delete(tabArea);
                        tabArea = displayTab3();
                        add(tabArea);
                    }
                }
            }
    
        }
    
        public VerticalFieldManager displayTab1() {
            try
            {
                tabNum = 3;
                final VerticalFieldManager Content= new VerticalFieldManager(Manager.USE_ALL_WIDTH|Manager.VERTICAL_SCROLL);
                Content.setMargin(5,0,0,0);
                int mas  = 0 ;
                Vector oleg = new Vector();
                SQLManager poligs = new SQLManager();
                poligs.getSongDownload(oleg, 0);
                while(mas < oleg.size())
                {
                    Song temp = (Song) oleg.elementAt(mas);
                    Content.add(new A_Song(temp.songId, temp.songName, false,temp.albumCover,temp));
                    mas++;
                }
                tab1Manager.deleteAll();
    
                HorizontalFieldManager topManager = new HorizontalFieldManager()
                {
                    public void paint(Graphics graphics)
                    {
                        graphics.setBackgroundColor(0x00000000);
                        graphics.clear(); super.paint(graphics);
                    }
                    protected void sublayout( int maxWidth, int maxHeight )
                    {
                        int width = Display.getWidth();
                        int height = this.getPreferredHeight();
                        super.sublayout( width, height);
                        setExtent( width, height);
                    }
                };
                CustomTextBox editField = new CustomTextBox();
                int pol = Display.getWidth() / 2;
                editField.setWidth(pol);
                ButtonField button = new ButtonField("Search");
                topManager.add(editField);
                topManager.add(button);
    
                //  tab1Manager.add(topManager);
                tab1Manager.add(Content);
            }
            catch(final Exception e)
            {
    
                e.printStackTrace();
                System.out.println("------------------- ");
            }
            return tab1Manager;
        }
    
        public VerticalFieldManager displayTab2() {
            try
            {
                tabNum = 2;
                final VerticalFieldManager Content= new VerticalFieldManager(Manager.USE_ALL_WIDTH|Manager.VERTICAL_SCROLL);
                Content.setMargin(5,0,0,0);
                int mas  = 0 ;
                Vector oleg = new Vector();
                SQLManager poligs = new SQLManager();
                poligs.getSongDownloads(oleg, 0);
                while(mas < oleg.size())
                {
                    Albums temp = (Albums) oleg.elementAt(mas);
                    Content.add(new A_Album(temp.albumId, temp.albumName, false,temp.albumCover,temp));
                    mas++;
                }
                tab2Manager.deleteAll();
                tab2Manager.add(Content);
            }
            catch(final Exception e)
            {
    
                e.printStackTrace();
                System.out.println("------------------- ");
            }
            return tab2Manager;
        }
    
        public VerticalFieldManager displayTab3() {
            try
            {
                tabNum = 1;
                final VerticalFieldManager Content= new VerticalFieldManager(Manager.USE_ALL_WIDTH|Manager.VERTICAL_SCROLL);
                Content.setMargin(5,0,0,0);
                int mas  = 0 ;
                Vector oleg = new Vector();
                SQLManager poligs = new SQLManager();
                poligs.getSongDownloadss(oleg, 0);
                while(mas < oleg.size())
                {
                    Artist temp = (Artist) oleg.elementAt(mas);
                    //Content.add(new A_AddSingersFM(temp.songId, temp.songName, false,temp.albumCover,temp,-1, tb, logIn,logOut,1,0,0, Register));
                    Content.add(new A_Artisti(temp.artistId, temp.artistName, false,temp.artistPhoto,temp));
                    //  int m = temp.getSongId();
                    mas++;
                }
                tab3Manager.deleteAll();
                tab3Manager.add(Content);
            }
            catch(final Exception e)
            {
    
                e.printStackTrace();
                System.out.println("------------------- ");
            }
            return tab3Manager;
        }
        protected boolean touchEvent(TouchEvent touchEvent)
        {
            int eventCode = touchEvent.getEvent();
    
            if(eventCode == TouchEvent.GESTURE){
                System.out.println("SWIPE GESTURE");
                TouchGesture g = touchEvent.getGesture();
                int gesturecode = g.getEvent();
                int direction = g.getSwipeDirection();
    
                //gallery.setHorizontalScroll(page_two, true);
                if(direction == TouchGesture.SWIPE_WEST)
                {
    
                    if(tabNum == 3)
                    {
                        delete(tabArea);
                        tabArea = displayTab2();
                        add(tabArea);
                    }
                    else if(tabNum == 2)
                    {
                        delete(tabArea);
                        tabArea = displayTab3();
                        add(tabArea);
                    }
                }
    
                if(direction == TouchGesture.SWIPE_EAST)
                {
    
                    if(tabNum == 1)
                    {
                        try
                        {
                            delete(tabArea);
                        }
                        catch(Exception e)
                        {
                            try
                            {
                                tabArea = displayTab2();
                            }
                            catch(Exception ef)
                            {
                                add(tabArea);
                                return false;
                            }
                            add(tabArea);
                            return false;
                        }
                        try
                        {
                            tabArea = displayTab2();
                        }
                        catch(Exception ef)
                        {
                            add(tabArea);
                            return false;
                        }
                        add(tabArea);
                        return false;
    
                    }
                    else if(tabNum == 2)
                    {
                        try
                        {
                            delete(tabArea);
                        }
                        catch(Exception e)
                        {
                            try
                            {
                                tabArea = displayTab1();
                            }
                            catch(Exception ef)
                            {
                                add(tabArea);
                                return false;
                            }
                            add(tabArea);
                            return false;
                        }
                        try
                        {
                            tabArea = displayTab1();
                        }
                        catch(Exception ef)
                        {
                            add(tabArea);
                            return false;
                        }
                        add(tabArea);
                        return false;
                    }
                }
            }
            //The touch event was not consumed.
            return false;
        }
    }
    

    On the sidelines, East or West navigation events I illegalargument exception.and my page crashing.

    However, when I run the same code through the debugger it works fine. I put my debugging inside the touchevent ifs and elses togglepoints.

    And note, if it crashes and I click on an illegal argument exception... I go back to the home page and as if the touchevent function was called twice and 2 strips was skipped.

    It works fine but through debugger.any help?

    very strange, I did this and it worked

    protected boolean touchEvent(TouchEvent message)
        {
            try
            {
                int eventCode = message.getEvent();
    
                if(eventCode == TouchEvent.GESTURE){
                    System.out.println("SWIPE GESTURE");
                    TouchGesture g = message.getGesture();
                    int gesturecode = g.getEvent();
    
                    switch(gesturecode) {
    
                        case TouchGesture.SWIPE:
                            int direction = g.getSwipeDirection();
                        //gallery.setHorizontalScroll(page_two, true);
                        if(direction == TouchGesture.SWIPE_WEST)
                        {
    
                            if(tabNum == 3)
                            {
                            //  delete(tabArea);
                            //  tabArea = displayTab2();
                            //  add(tabArea);
                                tab2.setFocus();
                                return super.touchEvent(message);
                            }
                            else if(tabNum == 2)
                            {
                            //  delete(tabArea);
                            //  tabArea = displayTab3();
                            //  add(tabArea);
                                tab3.setFocus();
                                return super.touchEvent(message);
                            }
                        }
                        else if(direction == TouchGesture.SWIPE_EAST)
                        {
    
                            if(tabNum == 1)
                            {
    
                                        //delete(tabArea);
                                        //tabArea = displayTab2();
                                        //add(tabArea);
                                        tab2.setFocus();
                                        return super.touchEvent(message);
    
                            }
                            else if(tabNum == 2)
                            {
    
                                    //delete(tabArea);
                                    //tabArea = displayTab1();
                                    //add(tabArea);
                                    tab1.setFocus();
                                    return super.touchEvent(message);
    
                            } }
    
                        break;
                    }
                }
                    //The touch event was not consumed.
                    return super.touchEvent(message);
            }
            catch(Exception eol)
            {
                return super.touchEvent(message);
            }
        }
    

    I do this on tab2.setfocus (), if I call setfocus it works... but if icall it separately as it is not and it hangs. very strange

    // delete(tabArea);
                            //  tabArea = displayTab2();
                            //  add(tabArea);
    
    
    
  • Layer to a bitmap on another bitmap field field

    Is it possible to layer an image bitmap bitmap field control?

    Attached image shows what im trying to achieve, image number 2 is superimposed on the picture number 1. Also image number 2 appears higher than the number of image 1. I use JDE 5.0

    Thank you

    As usual, for a custom navigation you will override some methods of the API. Check

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

    I never specifically rode two BitmapFields, but to accomplish what you're trying to do, I think you must first create a custom presentation Manager. Override the navigationMovement() method to handle changes in focus with trackpad events. Look at the setChildPosition() of the method in the handler class that handles how the fields are positioned in the layout. I don't know what happens when you ride the x coordinates of two fields with setChildPosition().

    If the overlap BitmapFields does not work, you can always implement style bitmap buttons that overlap by substituting object and methods of navigation of your custom layout manager.

    Scott

  • Question touch event for mutil - Manager on a screen

    Hi all

    I will say the case:

    I have a screen there is a main VerticaFieldManager that holds two VerticalFieldManager and a field

    the two children-VerticalFieldManagers hold some LabelField.

    When one of them is selected, it will be lit high.

    Then, extending from screen and override touchEvent() and shows a "Hit" said dialog and highlight the OK field.

    because the touchEvent is a shipped process, where the touchEvent occur, each field will receive this event.it never check what field is developed and send the event in this area, (if I'm wrong, please advice).

    Here's the question.

    When user getX and getY to get point touch, then the user getFieldAtLocation on crib, if X / is greater that the extensions Manager, RIM API returns the field expanded.

    This does not look good.

    Here is my source code:

    /*
     * VFMTester.java
     *
     * © , 2003-2008
     * Confidential and proprietary.
     */
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.system.*;
    import net.rim.device.api.servicebook.*;
    import net.rim.device.api.ui.container.*;
    
    /**
     *
     */
    public class VFMTester extends UiApplication{
        public static void main(String args[]){
            UiApplication app = new VFMTester();
            app.enterEventDispatcher();
        }
        VFMTester() {
            pushScreen(new AScreen());
        }
    
        class AScreen extends MainScreen
        {
            VerticalFieldManager vfm;
            public AScreen()
            {
                super();
                vfm = new VerticalFieldManager();
                vfm.add(new LabelField("Test",Field.FOCUSABLE));
                VerticalFieldManager v1 = new TouchVerticalFieldMananger1();
                for(int i=0;i<10;i++){
                    v1.add(new LabelField("F" + String.valueOf(i+1),Field.FOCUSABLE));
                }
                VerticalFieldManager v2 = new TouchVerticalFieldMananger2();
                for(int i=0;i<10;i++){
                    v2.add(new LabelField("S" + String.valueOf(i+1),Field.FOCUSABLE));
                }
                vfm.add(v1);
                vfm.add(v2);
                this.add(vfm);
            }
            public boolean trackwheelClick(int time, int status){
                Dialog.alert("click");
                return true;
            }
            protected boolean touchEvent(TouchEvent te){
                UiApplication.getUiApplication().invokeLater(new Runnable()
                {
                    public void run()
                    {
                        Dialog.alert("touched!");
                    }
                });
                return super.touchEvent(te);
            }
        }
    
        class TouchVerticalFieldMananger1 extends VerticalFieldManager
        {
            TouchVerticalFieldMananger1()
            {
                super();
            }
            public boolean touchEvent(TouchEvent te)
            {        if(!this.isFocus()) return true;            switch(te.getEvent())
                {
                    case TouchEvent.CANCEL:
                        System.out.println("CANCEL");
                    break;
                    case TouchEvent.CLICK:
                        System.out.println("CLICK");
                    break;
                    case TouchEvent.DOWN:
                        System.out.println("DOWN");
                    break;
                    case TouchEvent.GESTURE:
                        System.out.println("GESTURE");
                    break;
                    case TouchEvent.MOVE:
                        System.out.println("MOVE");
                    break;
                    case TouchEvent.UNCLICK:
                        System.out.println("UNCLICK");
                    break;
                    case TouchEvent.UP:
                        System.out.println("UP");
                    break;
                }
                if(!te.isValid()) return true;
                int x = te.getX(1);
                int y = te.getY(1);
                int index = this.getFieldAtLocation(x,y);
                if(index < 0 ) return true;
                Field f = getField(index);
                f.setFocus();
                this.invalidate();
                return true;
            }
        }
        class TouchVerticalFieldMananger2 extends VerticalFieldManager
        {
            TouchVerticalFieldMananger2()
            {
                super();
            }
            public boolean touchEvent(TouchEvent te)
            {
    
                if(!this.isFocus()) return true;            switch(te.getEvent())
                {
                    case TouchEvent.CANCEL:
                        System.out.println("CANCEL");
                    break;
                    case TouchEvent.CLICK:
                        System.out.println("CLICK");
                    break;
                    case TouchEvent.DOWN:
                        System.out.println("DOWN");
                    break;
                    case TouchEvent.GESTURE:
                        System.out.println("GESTURE");
                    break;
                    case TouchEvent.MOVE:
                        System.out.println("MOVE");
                    break;
                    case TouchEvent.UNCLICK:
                        System.out.println("UNCLICK");
                    break;
                    case TouchEvent.UP:
                        System.out.println("UP");
                    break;
                }
                if(!te.isValid()) return true;
                int x = te.getX(1);
                int y = te.getY(1);
                int index = this.getFieldAtLocation(x,y);
                if(index < 0 ) return true;
                Field f = getField(index);
                f.setFocus();
                this.invalidate();
                return true;
            }
        }
    }
    

    1:

    If the user has first select a field on one of them VerticalFieldManager, it will always be there and cannot be changed to the other domain.

    2:

    even if I check the field has focus or not, but it doesn't work anymore.

    Is there something wrong on my source code? or logical is false, or my understanding is wrong?

    Any advice pls.

    Thank you.

    We see this issue as well. Our workaround for this is to check the coordinates x, y of touch to make sure that they are within the scope of the current field, and then re - delegate the event so if x is outside the scope of the field.

  • Touch event of overlay question

    For our articles, we use an overlay to simulate a background image with "background-attachment: fixed" property css on mobile devices. This overlay 'pointer-events' set to none, then it does not interact with touch events.

    However scrolling is barely on the DPS Android app. It scrolls only in small steps. It works fine when loading the article Chrome (Android).

    There is also no question about the IOS version of the DPS app.

    Here is an example article reproduce the problem:

    Dropbox - Overlay_Issue.zip

    Any idea what's going on?

    Hello Sander,

    Thanks for sharing a nice, clean, the HTML file that reproduces the issue. I get the question on my camera as well. I logged a bug against the Android Viewer to investigate on what is happening.

    Neil

  • Content of the image that is not defined in the TileList component

    I have two images on a canvas, it is directly on the Web using the inline code, the other is embedded in a tilelist. The two images of rendering. When I click and drag the image online, the drag proxy appears normally. When I click on and drag the image in the tile list, I get an error when I try to make a copy of the bitmap image. This happens because the content of the image in the tile list is null, even if the source value is correct and the image has been loaded. I'm assuming that he is some kind of problem itemRenderer, but I'm not clear on how it retains the source of the image, but not the content. If it is the image of duplication and making reference to another bitmap, how do I enter this bitmap?

    The code is lower except for the image.

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML "layout ="absolute"creationComplete =" init () "> "

    < mx:Script >
    <! [CDATA]
    Import mx.collections.ArrayCollection;
    Import mx.managers.DragManager;
    Import mx.core.DragSource;

    [Bindable] private var images: collection ArrayCollection = new ArrayCollection collection;

    private function init (): void {}
    i.source="images/1.PNG '; //Set the image source which is placed directly on the canvas, this image has a drag proxy
    var i2:Image = new Image; //Create new image to add to the list of tile, this image is not a proxy valid drag because the content is missing
    I2.source="images/1.PNG ';
    images.addItem (i2);
    }
    private void mouseMoveHandlerTileList(event:MouseEvent):void
    {
    var tl:TileList = TileList (event.currentTarget);
    var image: Image = tl.selectedItem as Image;
    If {(image)
    Here the image contains the right source, but no content.
    initiateDrag (event, image);
    }
    }

    private void mouseMoveHandlerImage(event:MouseEvent):void
    {
    var image: Image = Image (event.currentTarget);
    If {(image)

    Here the image contains content
    initiateDrag (event, image);
    }
    }

    private void initiateDrag(event:MouseEvent,_image:Image):void {}
    var dragInitiator:Image = image;
    var ds:DragSource = new DragSource();
    ds.addData (image, "item");
    var dragProxy:Image = new Image;
    var data:BitmapData=Bitmap(image.content).bitmapData.clone(); /image. Happy is not null for canvas used, but has the null value for image in the list of tile
    dragProxy.source = new Bitmap (data);
    DragManager.doDrag (dragInitiator, ds, event, dragProxy);
    }

    []] >
    < / mx:Script >
    < mx:Canvas id = 'c' width = '100 percent"height ="100% ">

    < mx:Image id = 'i' mouseMove = "mouseMoveHandlerImage (event)" x = "400" y = "400" / > "
    < mx:TileList id = dataProvider "t" = "{images}" mouseMove = "mouseMoveHandlerTileList (event)" "
    x = "0" y = "0".
    >

    < mx:itemRenderer >
    < mx:Component >
    < mx:Image source = "{data.source}" / >
    < / mx:Component >
    < / mx:itemRenderer >
    < / mx:TileList >
    < / mx:Canvas >
    < / mx:Application >

    If this post has answered your question or helped, please mark it as such.

    To access the items in the container when using some renders can be problematic, because Flex recycle items for large sets of data.

    So this code works very well, but uses a Repeater. You may need to do some thinking to rework your concept, but it works:


    http://www.Adobe.com/2006/mxml">
     
        Import mx.collections.ArrayCollection;
    Import mx.managers.DragManager;
    Import mx.core.DragSource;
           
    [Bindable] private var images: ArrayCollection = new ArrayCollection([) collection

    'assets/images/BobSmith.jpg '.
    ]);

    private void mouseMoveHandlerTileList(event:MouseEvent):void {}
    var image: Image = Image (event.currentTarget);
    If {(image)
    initiateDrag (event, image);
    }
    }
               
    private void mouseMoveHandlerImage(event:MouseEvent):void {}
    var image: Image = Image (event.currentTarget);
    If {(image)
    initiateDrag (event, image);
    }
    }
               
    private void initiateDrag(event:MouseEvent,_image:Image):void {}
    var dragInitiator:Image = image;
    var ds:DragSource = new DragSource();
    ds.addData (image, "item");
    var dragProxy:Image = new Image;
    var data:BitmapData=Bitmap(image.content).bitmapData.clone(); image. Happy is not null for canvas used, but has the null value for image in the tile list
    dragProxy.source = new Bitmap (data);
    DragManager.doDrag (dragInitiator, ds, event, dragProxy);
    }
    ]]>
         
     
       
         
                     
         

       

       
     

  • Are the touch events in new broken ripple?

    Hello

    I have a PlayBook application that uses touch events to shake things. I tested it in the stand-alone version of ripple and the physical device.

    Now I think on porting the app to BB10, so I downloaded the verion of ripple Chrome and I found that in the waving of the new, I can't move any object!

    I've identified the problem, but I don't know how to cope. Here is a small HTML file that shows the problem:

    http://www.w3.org/1999/xhtml">
    
    
    
        
    child

    So basically there is a div container that listenes to the touchstart and if this event happens that it displays an alert. In the ripple of old (and on the PlayBook device) If you press the 'child' div the alert is also shown (the event is pushed down and intercepted by containers). In the waving again, it happens.

    Any suggestions? I can force ripple action as does the Playbook? Maybe I should use another technique to capture touch events?

    Hi razorek,

    I'm not sure of the reason (his behavior of WebKit), but the propagation of the event using the AddEventListener method will allow when you use touchstart. Take a look:

    http://www.w3.org/1999/xhtml">
    
    
    
        
    child

    Also, when using ripple for Chrome, please make sure that "Emulate touch events" are not verified, since ripple there are tactile own emulation system and it may come into conflict with it.

    F12 (Open Developer Tools) > click on the gear icon in the lower right > Exceptions tab > emulate the Touch events. I'll also post this work around for that matter https://github.com/blackberry/Ripple-UI/issues/344 github page

  • stimulate the touch event handling in PRC?

    I want to stimulate the touch event in another application. can someone help me in explaining to me with a code example.

    I'll pass on this one, whenever I give you an answer to a topic, change you what you wanted in the first place.
    First of all, you wanted to listen to the event:
    http://supportforums.BlackBerry.com/T5/native-development/touch-does-not-fire-for-Q10/TD-p/3026980

    Second, you were finally made in the PRC:
    http://supportforums.BlackBerry.com/T5/native-development/touch-event-handling-in-CPP/TD-p/3027043

    Third, you asked to simulate a key event in this thread I made.

    Now, this isn't what you want, you want to simulate a click on a button.

    I'll let someone else answer that one.

  • 6.0 touch event propagation problem

    I was wondering if anyone has seen this behavior:

    When you tap the radio button on the torch, the radio button actually called navigationClick method as well as the touchEvent reminder screens...   This navigation click returns with status equal to 0.

    Only occurs on RadioButtonField, all other fields correctly call touchEvent only when they are hit.

    Wonder why screens/field navigationClick method would be called on a single touchscreen device.

    Dnepr wrote:

    Looks good, if I manually using the touchEvent turning true that he will not call navigationClick.

    If the field does NOT consume the event, it calls navigationClick.

    Interesting!

    In fact, it is very intuitive - if I use TouchEvent.CLICK, I wait for the rest of the framework simply accept that and jump any further processing, including conversion to navigationClick().  If I have not (return false) or if I delegate the rest of the processing to the framework (super.touchEvent (message)), I expect to continue its default processing of return.

    I hate a lot of things on the behavior of BlackBerry, but this bit is OK in my book

Maybe you are looking for