How to get BitMapField painted on screen invalidate()

Mark and. Al to the RIM:

If you have one interface:

public interface Placeable {

    public abstract int X();
    public abstract int Y();

}

which is used to create a BitMapfield that implements this interface and is contained in a screen with a delegated manager:

import net.berrysoft.dib.interfaces.Placeable;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Manager;

public class GameManager extends Manager {

    public GameManager() {
        super(Manager.NO_HORIZONTAL_SCROLL | Manager.NO_VERTICAL_SCROLL);
    }

    protected void sublayout(int width, int height) {
        Placeable field;

        // Loop through all the fields contained with the layout manager
        for(int i = 0; i < getFieldCount(); i++) {
            field = (Placeable)getField(i);     // Get a field (the board)

            // Set the position of the field based on field's coordinates
            setPositionChild((Field) field, field.X(), field.Y());
            layoutChild((Field) field, width, height);      // Layout the field
        }

        setExtent(width, height);       // Set the manager's dimensions
    }

}

Why not invalidating the display, layout of the screen or even the two leads the BitMapField repainted to a new position (if its coordinates were in facted modified by another code)?

Here is the corresponding code of the base class abstract of an extended BitMapField:

public abstract class Block extends BitmapField implements Placeable {

    public  boolean isSelected( ) { return selected; }
    public  void    setSelected( boolean selected ) { this.selected = selected; }

    public  String Name()   { return name; }

    Block(String name, int x, int y, int left, int top, int width, int height) {
        this.name = name;

        // Extract the bitmap for this block
        bitmap = new Bitmap(width, height);
        Graphics g = new Graphics(bitmap);
        g.drawBitmap(0, 0, width, height, Bitmap.getBitmapResource("blocks.png"), left, top);
        setBitmap(bitmap);

        this.x = (x * Game.BLOCKSIZE) + Game.getBoard( ).X( ) + Game.BOARDER_SIZE;
        this.y = (y * Game.BLOCKSIZE) + Game.getBoard( ).Y( ) + Game.BOARDER_SIZE;

        x1 = x;     // Save starting location for new game reset
        y1 = y;
    }

    public  void click( ) {
        selected = !selected;
    }

    public void move(int d) {
        if( !isSelected( ) )
            return;

        // Move the block
        switch(d) {
            case Move.LEFT:
                this.x = x - Game.BLOCKSIZE;
                break;
            case Move.RIGHT:
                this.x = x + Game.BLOCKSIZE;
                break;
            case Move.UP:
                this.y = y - Game.BLOCKSIZE;
                break;
            case Move.DOWN:
                this.y = y + Game.BLOCKSIZE;
                break;
        }
    }

    public void reset( ) {
        x = x1;
        y = y1;
    }

    public boolean  isFocusable() {
        return true;
    }

    // Placeable Interface
    public      int X()     { return x; }
    public      int Y()     { return y; }

    // PRIVATE IMPLEMENTATION

    private     static  int     dotSize = 8;

    private     String  name;                   // Family member
    private     int     x, y;
    private     int     x1, y1;                 // Initial coordinates
    private     Bitmap  bitmap;

    protected   boolean selected;               // True if selected for movement

    protected void drawFocus(Graphics g, boolean on) {
        if( selected ) {
            // Draw selection marker
            g.setColor(Color.GREEN);
            g.fillArc(getWidth()/2 - dotSize/2, getHeight()/2 - dotSize/2, dotSize, dotSize, 0, 360);
        } else {
            // Draw focus marker
            g.setColor(Color.YELLOW);
            g.fillArc(getWidth()/2 - dotSize/2, getHeight()/2 - dotSize/2, dotSize, dotSize, 0, 360);
        }
        invalidate( );
    }

}

It seems we should be able to invalidate everything simply screen when a block is placed, and that this would then re - introduce the screen through Manager representative, who would in turn ask each block layout, then the painting, but instead, regardless of the coordinates of blocks, it appears at the same place and does NOT move.

Is this a bug in the API?  How do I invalidate the screen and the repainted?  (That is using the API, as it was designed to be used)

When an object is invalidated, the framework calls it the layout() and then object?  What is the sequence of events in the frame please.

Patrick

When the position of a field is changed, you must call updateLayout().

updateLayout() call layout page/sublayout on the fields, then invalidate().

Invalidate() simply calls the object.

Tags: BlackBerry Developers

Similar Questions

  • How to get the orientation angle screen with 40 Hz stably without delay to sync?

    Goal: Get orientation angle screen at 40 Hz stably without delay for synchronization.

    Problem with two situations:

    1. When you use the bbutil_swap and navigator_event_get_orientation_angle (event) to get the orientation angle screen with other data such as acceleration sensors and gyroscope data, the sampling frequency will be low grade at 10 Hz randomly. The difference of synchronization will increase from 25 ms to 100 ms.

    2. when the screen orientation angle is collected in the following code to get the angle only, the difference in timing of sampling will be 1, 2 or 5 seconds at random.

    Question: How do I get the orientation angle screen with 40 Hz stably without delay to sync?

    or something wrong in my code?

    Mini code:

    public static void handleNavigatorEvent(bps_event_t *event) {}
    switch (bps_event_get_code (event)) {}
    case NAVIGATOR_ORIENTATION_CHECK:
    navigator_orientation_check_response (event, true); If not the line, no updates on the screen rotation.
    angle = navigator_event_get_orientation_angle (event);
    break;
    case NAVIGATOR_EXIT:
    stop = true;
    break;
    }
    }

    public static void handle_events() {}
    for(; ) {
    bps_event_t * event = NULL;
    If (BPS_SUCCESS! = bps_get_event (& event, 0)) {}
    fprintf (stderr, "bps_get_event failed\n");
    break;
    }
    If {(event)
    If (bps_event_get_domain (event) is {navigator_get_domain()})
    handleNavigatorEvent (event);
    }
    } else {}
    break;
    }
    pthread_create (& t1, NULL, (void *) & rawacceleration, NULL);
    }
    }

    int main (int argc, char * argv []) {}
    screen_create_context (& screen_cxt, 0);
    bps_initialize();

    {If (EXIT_SUCCESS! = {bbutil_init_egl (screen_cxt))}
    fprintf (stderr, "bbutil_init_egl failed\n");
    bbutil_terminate();
    screen_destroy_context (screen_cxt);
    return 0;
    }

    If (BPS_SUCCESS! = screen_request_events (screen_cxt)) {}
    fprintf (stderr, "screen_request_events failed\n");
    bbutil_terminate();
    screen_destroy_context (screen_cxt);
    return 0;
    }

    If (BPS_SUCCESS! = navigator_request_events (0)) {}
    fprintf (stderr, "navigator_request_events failed\n");
    bbutil_terminate();
    screen_destroy_context (screen_cxt);
    return 0;
    }

    Rawlog = fopen (rawfilename, "w"); Save the file in a specific path.
    fprintf (rawlog, "Absorption system, Angle\n");

    navigator_request_events (0);

    While (! shutdown) {}
    handle_events();
    bbutil_swap();
    }

    closeshutdown();

    return 0;
    }

    Thank you for your attention,

    Using SENSOR_TYPE_ORIENTATION of sensor_type_t , you should be able to get > 10 Hz.  Use sensor_set_rate() to get the slower delay to call sensor_info().  Make sure not to enable sensor_set_skip_duplicates().

    However get the orientation at the 40 Hz streaming will not make your application any repsonsive more.  The only way to make your app more would be to manage the orientation change in a short period of time.  This is the time when orientation changes (at the hardware level), to receive you and to deal with it.  It is usually a constraint system and there is not that you can do about it.  What you see using the code above is the same information repeated over and over; FACE_UP, FACE_UP, FACE_UP, which is not really useful.

  • How to get other themes start screen and backgrounds for Windows 8?

    Former title: how to change windows 8 start wallpaper?

    Hello

    How can I change background menu stars and their in windows 8? I know that there are some model in customize / splash screen. but I want other do and background

    Hey Amir,

    Welcome to the Microsoft Community Forums and thanks for your post about it.

    Want to know where you can get the other start screen themes and background for Windows 8 outside the themes and background images already present images in Windows 8 by default.

    Let me inform you that we will not be able to add additional themes and backgrounds for the splash screen in Windows 8. However, it is possible for the desktop interface. If you want to add backgrounds and additional desktop themes, you can visit these links and then download your favorite themes and background images.

    For desktop themes:

    http://Windows.Microsoft.com/en-us/Windows/themes

    For wallpapers

    http://Windows.Microsoft.com/en-us/Windows/wallpaper

    For more information, you can also take a look at this link:

    Customize your PC

     

    http://Windows.Microsoft.com/en-us/Windows/personalization-Gallery

    Hope this information is useful. Please get back to us, if you still have questions about the present. You can publish all your queries related to Windows on Microsoft Community Forum and we will be happy to help you.

  • How to get the Western Digital screen to appear without having seen the image of office as well.

    Original title: WD1TB MY book was installed with Windows XP and the deskyop "bleeds" through parts of the WD Menu. How can I get the WD screen appears without the office showing?

    WD1TB MY Book was installed with Windows XP and office "bleeds" through parts of the WD Menu. How can I get the WD screen appears without the office showing?  I can't read the instructions when this screen appears partially gray with the news of WD and the desktop showing through the other box of WD.

    Hello

    You can try to connect the WD 1 TB My Book on another computer running Windows XP and see if the problem still occurs.

    You can also get in touch with support from WD for assistance on the issue.

    Contact us Support WD

    http://support.wdc.com/contact/index.asp?wdc_lang=en#us

    WD community

    http://community.wdc.com/T5/my-book-for-PC/BD-p/BoardExample

  • How to get rid of white screen?

    Hi guys,.

    I am creating a project in my college.

    I have a problem

    I have a lot of flv files I have loaded externally.

    the problem is, among all the movies that I have a white screen, which is really disturbing.

    How can I get rid of him?

    Thank you

    import poster images of your FLV files and make the appropriate image when a flv ends, and while the other is buffering.

  • Satellite L40-17 t - how to get the mode full screen of low resolution?

    Nice day!

    What should I do to get a resolution 800 x 600 mode full screen for Satellite L40-17 t?

    You must remove the graphics driver and should only use a common Microsoft Windows driver that supports only the resolution 600 x 800 and 768 x 1024.

    But I really don't understand why you want to use 600 x 800? Is the resolution 768 x 1024 high?

  • How to get rid of white screen in PS

    I'm sure it's something basic, but whenever I close a PS file, I find myself with an empty block. Tools and menu bars are there. Very annoying. When I close the file, I want to see my office, not an empty window of PS. How can I get rid of this blank frame? THX.

    If Mac, try turning off the window > Application frame.

  • For Windows XP, how to get rid of "this screen saver has no option that you can set!

    I want to change the screen saver, but whenever I click the setting button, I received the message: «this screen saver has no options that you can set»

    Although several screensavers just do one thing, some of them can be customized.  For example, '3D text' screen saver allows you to choose the text, the text color, size, etc.

    For most screen savers, just choose one from the drop-down list and then click 'OK' - not the button "settings".

  • How to get back to this screen again?

    I don't know what I did, but initially, I had this form of brushes with a number of customizable brushes (circled in red) placed below a few lines of the normal, round, basic brushes. These brushes (without tweaking settings) produced quite good results, so I would like to reproduce this form again. Problem is that I can't find this screen now, I went through all types of brushes (from assorted to wet media brushes), but I can't find this screen.

    http://i50.tinypic.com/so1wxx.png

    Hoping someone can guide me to this screen. Thank you

    Those are the brushes with bristles and you will find some in many of the predefined provided with Photoshop, but if you want 10 original at the time go to the preset Panel and select Reset brushes in its Panel menu.

  • How to get the height and width of the screen of the blackberry device?

    Can someone tellme how to get details of the screen of the blackberry device?

    Display.getWidth () and Display.getHeight ().  If this isn't what you want, let us know.

  • How to restore the XP Welcome screen

    My X 200 is a machine of a user, so I decided to disable the fast user switching. In the process I inadvertently stops the welcome scree also. When I went to turn it on again, I got a dialog box with a message indicating that a - atginahook.dll - program has disabled the Welcome screen and fast switching. In my view, that this file is part of the fingerprint software. Does anyone have an idea how to get around this time screen weclome and quick-change checkboxes are now greyed out so I can't further at this point... How to restore functionality to the option "change the average user log or disable"?

    Thanks for your comments

    xwray wrote:

    My X 200 is a machine of a user, so I decided to disable the fast user switching. In the process I also inadvertently has disabled the Welcome screen. [snip] Does anyone have an idea how to get around this time screen weclome and quick-change checkboxes are now greyed out so I can't further at this point... How to restore functionality to the option "change the average user log or disable"?

    I did the same thing and had the same problem on my T500 (which includes a fingerprint reader...).

    I fixed it to Client Security Solution (a ThinkVantage program); there I clicked on 'Footprint', then 'manage '. After authentication, I clicked on 'Settings' at the top of the window, then unchecked "Disable Fast User Switching Support. After a reboot, everything was back to normal.

    Hope this helps

  • How to get the phone in ongoing call screen

    It is a follow-up on the menu of the phone not shown thread.

    I checked with the KB and found an interesting topic: How - to upgrade a screen on the main event Thread

    My original question (as can be seen in the thread has already been mentioned) was to know how to draw something on the screen of the phone.

    Example:

    (1) a user accepts a call.

    (2) my application implements PhoneListener and in callConnected() just draws a picture on the top of the phone application

    (3) all the features of the phone (menu of the phone for example) are preserved.

    The article mentioned shows that it is possible to draw something on a screen.

    How can I get an instance of the phone screen?

    Here is my proposal (but it does not work):

    public void callConnected(int arg0){ UiApplication.getUiApplication().invokeLater(new Runnable()        {
    
                public void run()            {                Screen screenName = UiApplication.getUiApplication().getActiveScreen();                //Perform screen changes here.                Graphics g = screenName.getGraphics();                g.setColor(0xFF8080);                g.fillRect(10, 10, 100, 100);                //Calling invalidate() on your screen forces the paint                 //method to be called.                 screenName.invalidate();            }        }); }
    

    How to make the getUiApplication() to pick up the phone?

    Do you ever feel like you're talking to yourself ?

    That's what I had:

    //Calling invalidate() on your screen forces the paint                 //method to be called.                 screenName.updateDisplay();                //screenName.doPaint();                //screenName.invalidate();
    

    Why the work of updateDisplay doPaint (as well as his brothers and sisters invalidate()) does not work?

    But, alas, my efforts have been in vain.

    The 'red square' disappears when something is painted on them -ruins it a bit.

    So, I guess, my quest continues.

    Someone has an idea how draw a persistent image on the VoiceApp and always to enable all the features of VoiceApp (menu, for example)?

  • How to get the box remove on the lock screen?

    So I know how to respond to a text on the lock screen, but what I want to know is how to get that red box delete instead of the response box.

    In the picture you can see that there's a reply box. How can I get the box remove red over there?

    Press the "x" to remove the message from the lock screen. There is no way to 'delete' a message from the lock screen. Deleting messages can be done in the Messages application.

  • How to get the video intro off my google home screen I already saw it, where is the firefox logo used to be.

    How to get the video intro off my google home screen I already saw it, where is the firefox logo used to be. I started with the last update that I rebooted.

    Hello
    to change the homepage when opening firefox-press 'Alt' and click on tools-> Options.

    Main menu, you can change the URL.

    If the problem persists, you can follow these simple steps:

    Enter about: config in the address bar and press ENTER. Accept the message of 'dragons' to see the Advanced preferences screen. Use the above search box to enter the below pref.

    You can assign an empty string to stop your Firefox to retrieve "extracts" and brandLogo changes the browser.aboutHomeSnippets.updateUrl pref. Right-click this pref and select Edit then clear the value as pref in the box that appears, and then click OK. Who will also disable "snippets" that appear under the container of the research on the default home page.

    Then you must open the folder of your profile, via help > Troubleshooting Information > profile folder > > button view folder. Then close Firefox. Your profile file open with Firefox closed (Firefox '3-bar' menu key > exit/Quit), wait or two minutes, then remove the storage\moz-safe-about + home folder in the Firefox profile folder to remove the brandLogo and stored in IndexedDB code snippets to make Firefox use the default brandLogo and a defined default code snippet.

    If you later change your mind about these changes, you can reset the pref browser.aboutHomeSnippets.updateUrl via the context menu and Reset allows to retrieve the default value using the storage\moz-chest-fort-about + home folder again.

  • Absent voice memo to the homescreen on IPhone SE there is no 'utility' or 'extras' anywhere; folder Siri is voice memo, but can not get to the home screen? How to apply for voice memo on the homescreen?

    Absent voice memo to the homescreen on IPhone SE there is no 'utility' or 'extras' anywhere; folder Siri is voice memo, but can not get to the home screen? How to apply for voice memo on the homescreen?

    Try going into settings > general > reset > reset home screen presentation.

Maybe you are looking for

  • Firefox search result? They are based on a history previous users

    I use Firefox for a while. I am a digital marketing consultant and I was checking the SERPs for my classification of customers. Firefox showed them to Page 1 in google today. Woohoo I thought. I generated reports to show my clients their new ranking,

  • Pavilion s5213w: HP Recovery s5213w

    Tried to do a system F11 recovery, got the following error message: Windows could not start.  A recent hardware of software change might be the problem.  To solve the problem: 1. Insert your Windows installation disc and restart your computer. 2. cho

  • 15 - n204tx: Minimum requirement problem during installing the drivers

    Hello I am trying to intall the graphics card intel HD, those that were available in the section "downloading software and the driver", there are 2 configurations different IE sp64572 and sp65212, two of them are generating an error when I try to ins

  • Compaq presario-hdmi

    I have a compaq presario cq5814. What should I do if I wanted to install a blue ray burner?

  • playing videos - 64 bit OS - OS 2 to u once

    I respond to certain information by previous, and then realized something that probably won't work.  I have a HP Pavilion dv7-1232nr portable entertainment.  It came with a 64 bit OS and I can not play videos of news on the internet.  I downloaded th