1. Shreyas's Avatar
    Do anyone know how to CONSUME_CLICK for BitmapField like for ButtonField ?

    Code:
    ButtonField okButton = new ButtonField("Ok", ButtonField.CONSUME_CLICK);
    I am creating BitmapField like..

    Code:
    BitmapField start = new BitmapField(startBitmap, BitmapFieid.FOCUSABLE);
    09-04-09 01:51 AM
  2. ydaraishy's Avatar
    Look at the trackwheelClick method, and with the explanation for what CONSUME_CLICK does, you should be able to craft a solution.
    09-04-09 02:28 AM
  3. anon(5342392)'s Avatar
    Trackwheelclick won't work for storms though

    Your gona have to look at overriding the navigationClick

    NavigationUnclick and/or touchEvent , when using the touchEvent method you should use the appropriate touchevent class to determine whether somebody made a click, touch or swipe gesture.

    Posted from my CrackBerry at wapforums.crackberry.com
    09-04-09 10:17 AM
  4. Shreyas's Avatar
    I have overridden touchEvent() but we can set the CONSUME_CLICK property for ButtonField while creating it. Its happening properly.

    & for BitmapFields also tochEvents are coming properly. Only I want to know how to set CONCUME_CLICK property for BitmapField as there is no such property while creating BitmapField.
    09-04-09 11:42 PM
  5. ydaraishy's Avatar
    Extend BitmapField (as you may have already done) and handle it yourself -- this isn't rocket science.
    09-05-09 02:14 AM
  6. Shreyas's Avatar
    I had created BitmapField as ...

    Code:
    public class MyCanvas extends MainScreen
    {
         BitmapField start = new BitmapField(startBitmap, BitmapFieid.FOCUSABLE);
         ButtonField okButton = new ButtonField("Ok", ButtonField.CONSUME_CLICK | ButtonField.FOCUSABLE);
    
         hfm.add(start);
         hfm.add(okButton);
    }
    But there is no property for BitmapField as

    Code:
    BitmapField.CONSUME_CLICK
    to avoid the default menu that comes when clicked on it.

    ButtonField has "CONSUME_CLICK" property so we can set for it as

    Code:
    ButtonField okButton = new ButtonField("Ok", ButtonField.CONSUME_CLICK | ButtonField.FOCUSABLE);
    The TouchEvents are happening properly by overriding touchevent().
    Only I want to set "CONSUME_CLICK" property for BitmapField to avoid the default menu that comes when clicked on it.. How to do it ?
    Last edited by Shreyas; 09-05-09 at 05:09 AM.
    09-05-09 04:39 AM
  7. ydaraishy's Avatar
    As I just said, extend BitmapField with a constructor written so if someone passes a CONSUME_CLICK value to that constructor (either ButtonField's or your own, whatever) so you can use it in your overriden navigationClick method.

    There is nothing special about ButtonField.CONSUME_CLICK, it's just a value that tells the navigationClick/trackwheelClick method to consume the event.
    09-05-09 04:44 AM
  8. anon(5342392)'s Avatar
    Sorry for the late reply but bitmapfield doesn't know what a consume click is. To successfully override the methods plus consume a click set the return to true for example

    protected boolean navigationClick() {
    //your code here
    return true;
    }

    Posted from my CrackBerry at wapforums.crackberry.com
    09-05-09 12:04 PM
  9. Shreyas's Avatar
    Hey geeneeus. Thanks a lot..It worked..
    09-07-09 12:25 AM
LINK TO POST COPIED TO CLIPBOARD