Several call to the method of painting

Ask for help on one of the most common problems in the development of BB UiApp. My method of painting is called more that I can think of logicall. Ask for help to understand why its happening

Looks like my request

CFL extends ListField implements {ListFieldCallback}

}

   public int moveFocus(int amount, int status, int time){        invalidate();     return super.moveFocus(amount, status, time);    }    //Invoked when this field receives the focus.    public void onFocus(int direction){        _HASFOCUS = true;        super.onFocus(direction);    }    //Invoked when a field loses the focus.    public void onUnfocus(){        _HASFOCUS = false;        super.onUnfocus();        invalidate();    }    //Handles trackball movement on all directions    public boolean navigationMovement(int dx, int dy, int status, int time){               if (dy == 0 && dx <= -1){                /*do something*/           this.invalidate();        }else if (dy == 0 && dx >= 1){                /*do something*/           this.invalidate();        }        super.navigationMovement(dx, dy, status, time);        return false;    }    public void drawFocus(){

    }public void paint(){  /*paint the list row and the highlight manually*/} public void drawListRow(ListField listField, Graphics graphics, int index, int y, int width) {        // TODO Auto-generated method stub    } //Not yet implemented public Object get(ListField listField, int index) {       // TODO Auto-generated method stub        return null;  } //Returns the preferred width for the control public int getPreferredWidth(ListField listField) {       // TODO Auto-generated method stub        return this.getWidth();   } //What is this one? Looks like search public int indexOfList(ListField listField, String prefix, int start) {       // TODO Auto-generated method stub        return 0; }

I created the ParentScreen stretching from the main screen with a verticalfieldmanager and custom list field inserted into it with 2 other controls.

Now when I run the app and I move the focus to the top or to the bottom of the painting, the method is called 4 times. I expect the paint method to get called time or max 2 times. , but the paint method is called 4times.

Here is the stack trace. I am trying to understand why this is happening from the stack trace, but can not understand. Can someone explain to me. Here is the stacktrace for all 4 calls to the methods of painting. Can someone explain?

Stack trace for 1st call to paint method-----------------------------------------CFL:paintCFL(Field):paintSelfParentScreen:doRemoveFocusParentScreen:doFocusMoveParentScreen:navigationMovementParentScreen:dispatchNavigationEventUiEnginerImpl:processMessage

Stack trace for 2nd call to paint method-----------------------------------------CFL:paintCFL(Field):drawHighlightRegionCFL(Field):drawFocusCFL(LisField):drawFocusParentScreen(Screen):doAddFocusParentScreen(Screen):doFocusMoveParentScreen(Screen):navigationMovementParentScreen(Screen):dispatchNavigationEventUiEnginerImpl:processMessage

Stack trace for 3rd call to paint method-----------------------------------------CFL:paintCFL(Field):paintSelfVerticalFieldManager(Manager):paintChildVerticalFieldManager:subpaintVerticalFieldManager(Manager):paintVerticalFieldManager(Field):paintSelfVerticalFieldManager(Manager):paintSelfVerticalFieldManager(Manager):paintChild

Stack trace for 4th call to paint method-----------------------------------------CFL:paintCFL(Field):drawHighlightRegionCFL(Field):drawFocusCFL(ListField):drawFocusCFL(Field)paintSelfVerticalFieldManager(manager):paintChild

As far as I know, invalidate will get infrastructure to call paint twice, once to paint blurred and new areas to paint the update.  Why don't you try disconnected from the moveFocus() to see what changes this causes?

About drawFocus, you have not overridden the drawFocus at all routine, because his signature looks like this:

protected void drawFocus (graphics graphics, boolean on)

You have substituted him:

Public Sub drawFocus()

Tags: BlackBerry Developers

Similar Questions

  • Windows email will not be printed and give this message "email error unexpected call to the method"

    Windows email will not be printed and give this message "email error unexpected call to the method"

    is there a solution for this?

    Yes, I uninstalled the upgrade to IE9 and rebooted and unfortunately I can print my email again! No more unexpected call to the method.  Check my IE and it's IE8.

    Problem solved!

    Thanks for the replies.
    Neal

  • g.clear () call to the method object refuses the development of drawing for checkbox

    Hello

    I have this custom field extend the CheckboxField, with him object method is overloaded as follows:

    protected void paint (Graphics g)
    {
    int bgColor = _fontStyle.getBackgroundColor ();
    If (bgColor! = - 1).
    {
    g.setBackgroundColor (_fontStyle.getBackgroundColor ());
    g.Clear ();
    }
    g.setColor (_fontStyle.getForegroundColor ());
    Super.Paint (g);
    }

    the _fontSytle is defined by the user and transmitted as a reference of custom style, everything works fine in a first time without g.clear (), but I soon found out when the background color is black, while the foreground is white, paint reverse color. So I added this g.clear () and the problem was solved.

    However, the compensation seems to graphics here refuses the development of drawing and I was not able to trace which is cleaned and what is the indicator for the development of design. BTW, the "g.isDrawingStyleSet (Graphics.DRAWSTYLE_FOCUS)" returns true.

    So I was wondering if anyone here can provide a diagnosis on what could be the cause and how to fix it. Thanks in advance.

    Christian

    Nope, the g.clear () must be called to display the colors correctly. As I said, it can work in some cases, but just mess up from time to time.

    So what I do now is take a workaround to override the drawFocus() as default

    protected void drawFocus(Graphics g, boolean on)
        {
            refreshFooter(on ? getLabel() : "");
            // customize draw focus logic here as the default one conflicts with the paint method
            XYRect rec = new XYRect();
            getFocusRect(rec);
            g.invert(rec);
        }
    

    Thus the development of drawing must rely on paint and so don't mess the color.

    In any case, thanks much for the reply!

  • "The call to the method"setTextFormat"can be defined" in Air application (need help)

    Hello

    I followed a tutorial for getting started with ActionScript 3 and Adobe Flash. I'm ready to create an Air application, but I ran into a problem. The tutorial is for Flash Player, so I wonder if it also works for Air applications (sorry, I don't get quite the differences yet).

    So, here's a screenshot of the problem:

    flash_erreur.png

    The error reads: 'setTextFormat' method cannot be set via the fl.controls:TextArea static type reference

    (Sorry if it's badly translated :/)

    What I have below is a TextArea (taken from the User Interface components) and a button (same). I noticed their name of the instance that you can find in the block of the ACE.

    So since it's the same code as in the tutorial (where he works), why make this mistake? I tried many things to get rid of it, but I'm out of options now, so I ask you for help.

    Kind regards.

    Chances are the tutorial you're folowing uses a TExtField, not a text box.  The TextArea component is not supported by the setTextFormat method.  You will need to use the setStyle method to set the characteristics of the text.  Alternatively, you can use a TExtField and then the setTextFormat method could be applied

  • To access the bean viewScope in the method call

    Hello

    I use Jdev 11.1.1.6.0

    I have a tf1 taskflow with a fragment of page say test.jsff and test.jsff has 2 regions TF2 and TF3.

    TF2 has test1.jsff and then calling the method
    TF3 has test2.jsff and then calling the method

    My idea is to define a bean viewScope in tf1 and access since the call to the method of TF2 and TF3 to store specific data TF2 and TF3 beans viewScope...

    My problem is when I do the following code inside the method of TF2... I get null for the viewScope bean. I'm doing something wrong here... The regBean is coming with the null value

    FacesContext fctx = FacesContext.getCurrentInstance ();
    ELContext elctx = fctx.getELContext ();
    ExpressionFactory expFactory = fctx.getApplication () .getExpressionFactory ();
    String tfName = (String) RequestContext.getCurrentInstance () .getPageFlowScope () .get ("name");
    ValueExpression ve = expFactory.createValueExpression (elctx, "#{viewScope.registerbean}", Object.class);
    RegisterBean regBean = (elctx) ve.getValue (RegisterBean);


    Thank you
    Rambeau

    Each page has its own scope of view, which will disappear when viewId changes (when the user page)
    You can use session scope (but then you should take care of cleaning), or you can use another parameter to the method.
    Maybe this can help: http://andrejusb.blogspot.com/2011/02/adf-region-communication-data-exchange.html

    You can see time scope of beans on the following diagram:
    http://docs.Oracle.com/CD/E15051_01/Web.1111/b31974/adf_lifecycle.htm#CHDGGGBI

    Dario

    Published by: kdario on November 2, 2012 14:34

  • How to draw and the positioning of images in FieldManager using the method object?

    How can I add and the positioning of my images in the position desired in FieldManagers?

    I need to add more than 2 fields (HorizontalFieldManager/VerticleFieldManager) in my application and I draw an image using the method of painting ovverided.

    NOTE: The image will be established if I do not use mainScreen.add (SeparatorField ()) or mainScreen.add (hori2), see below.

    If I use mainScreen.add (mainScreen.add (hori2) SeparatorField ())... n then the horizontalFieldManger won't be empty, drawn in the output screen.

    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.*;
    import net.rim.device.api.system.*;
    
    public class BackgroundImage extends UiApplication
    {
        private Bitmap backgroundBitmap;
        private Bitmap fieldBitmap;
    
        int width, height;
    
        public static void main(String[] args)
        {
                BackgroundImage theApp = new BackgroundImage();
                theApp.enterEventDispatcher();
        }
    
        HorizontalFieldManager hori2;
    
        public BackgroundImage()
        {
            //The background image.
            backgroundBitmap = Bitmap.getBitmapResource("jalan_logo.png");
    
            MainScreen mainScreen = new MainScreen();
    
            hori2 = new HorizontalFieldManager();
    
            HorizontalFieldManager horizontalFieldManager = new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH | HorizontalFieldManager.USE_ALL_HEIGHT){
    
                //Override the paint method to draw the background image.
                public void paint(Graphics graphics)
                {
                    System.out.println("come to here..!!");
                    width = graphics.getScreenWidth();
                    height = graphics.getScreenHeight();
                    //Draw the background image and then call paint.
                    graphics.drawBitmap(width/2, height/2, 150, 40, backgroundBitmap, 0, 0);
                    super.paint(graphics);
                }            
    
            };
    
            //The LabelField will show up through the transparent image.
            LabelField labelField = new LabelField("This is a label");
    
            //Add the manager to the screen.
            mainScreen.add(horizontalFieldManager);
    
           mainScreen.add(new SeparatorField());
           mainScreen.add(hori2);
           hori2.add(labelField);
    
            //Push the screen.
            pushScreen(mainScreen);
        }
    }
    

    Help, please.

    I have already pointed out the problem with USE_ALL_HEIGHT in first Manager add you to the form. Drop this style bit, otherwise sublayout your screen will generate an exception, and nothing appears!

    If you want HorizontalFieldManager to be of a particular size, regardless of the height of managed fields, replace its sublayout:

    HorizontalFieldManager fieldManagerTopBanner = new
             HorizontalFieldManager()
    {
         protected void sublayout(int maxWidth, int maxHeight) {
            super.sublayout(maxWidth, maxHeight);
            int myDesiredHeight = ;
            setExtent(getWidth(), Math.min(myDesiredHeight, maxHeight));
         }
    
         protected void paint(Graphics g)
         {
              // g.setBackgroundColor(0x000000);//blue
                 g.drawBitmap(100, 150, 100, 200, jlnLogoImg, 0, 0);
    
              //g.clear();
                super.paint(g);
         }
    };
    
  • Performance issue with the method extract in 11g

    I am new to Oracle XML DB. I'm having a problem with an example simple Java application designed to test the response time. I can't find an answer to this question.

    It takes about 1/2 second, whenever my Java client makes a call to the method "extract" of XMLType. Extract is called 3 times for each row returned in a result set. It takes 1 1/2 seconds to process 1 line. With a result set of 55 lines, it takes about 1 1/2 minutes to process the entire result set.

    It seems to me that an appeal must be get done to retrieve the data from the server to each snippet of time is called. This performance is unacceptable and will not evolve. This seems to be a lazy loading problem that could be treated with the configuration; but I still need to find something specific documented.

    Is there something that can be done to solve this problem or is it typical performance?

    I use a binary XML storage. I created a XMLIndex; but it made no difference. Does not seem like an indication that much of a difference, since the problem occurs when you access XML different values in the same line...

    The extract method is implemented in the classes of the JAVA API provided by the Oracle client installation.

    Just to clarify things, this forum is related to a feature in the Oracle database. The API you mentioned and you use are provided by another group within Oracle (I think). In addition, the used API .extract does its job fully without communicating with the DB. You can check this to hard code in an XML response and disconnect your computer from the network before you run the logic of analysis and it would continue to operate.

    The fact that this method is removed must have something to do with its inefficiency

    The disapproval that I mentioned is only in what regards the SQL in the Oracle DB. As noted above, the used API lives under a different set of rules, so I can't speak to that. There is probably a forum for the API, but I haven't been looking.

    Back on topic, a possible rewrite for your SQL statement is (untested)

    select aex.APPLICATION_NAME, aex.VERSION, aex.EVENT_TYPE, xt.sendingSite, xt.receivingSite, xt.eventID
      from AUDITED_EVENT_XML aex,
           XMLTable('/*/MSH'
                    PASSING aex.xml_event_content
                    COLUMNS
                    sendingSite   VARCHAR2(20)  PATH 'MSH.4/HD.2',
                    receivingSite VARCHAR2(20)  PATH 'MSH.6/HD.2',
                    eventID       VARCHAR2(20)  PATH 'MSH.10'
     where EVENT_TYPE = ?
    

    If you have problems with this, just after a small sample XML and someone can twist where I was wrong.

  • Why the method in the several times called session bean

    Hello
    I work with Jdev 11 g.
    I created an example Web J2ee Application.
    In the model project, I created:
    1 - entity Bean
    2 - stateless session bean (which contains a method that get the list of username == > em.createNamedQuery("OsaUser.findAll").getResultList ();)

    In the view controller project I created:
    1 - managed bean, session scope, a getter that calls the session bean and retrieve the result of the query.
    2 - a JSF page with af:table element with the value bound to the list in the managed bean.

    When I run the application, the data is displayed, but since I put system.out message I get this message several times.
    When I try to debug the application the breakpoints on the managed bean and session bean are available several times.

    Can you please advice why this happens.
    Concerning
    Emile BITAR

    Hello

    partially, it's the cycle of life and partially a known bug. The method is called during ApplyRequest and RenderResponse. If you check this in your output, so you see that make answer calls at least three times, which is the bug that we set. As a temporary work around, set a flag within the scope of the request (since your bean's scope of session that you use a requestScope attribute). The first time you run, you set the attribute flag. So every time its called again, you check to see if the indicator exists and if ignore the request. Because the flag is set to request scope, you needn't clean it explicitly

    Frank

  • Several months ago the button, if that's what it's called, the task bar that displays hidden icons has stopped working.

    Original title: the task bar icons

    Several months ago the button, if that's what it's called, the task bar that displays hidden icons has stopped working. Can I get a virtual device driver format in the registry is incorrect when you use a disk with the drivers on this subject. I found information on how to correct this problem and now the botton of task bar work again although it works until the computer is used for a while. How is the hidden icon button suppose to work or it should be visible all the time? Also the virtual device driver registry entry has something to do with it? I think that the problem of the DMV has installed a Norton program antivirus software that was on a disc that came with the computer.

    Hello

    1 have had any changes made to your computer before this problem?

    I suggest you try the methods mentioned below and check if it helps:

     

    Method 1:

    You can also scan your computer the Microsoft Security Scanner, which would help us to get rid of viruses, spyware and other malicious software.

    The Microsoft Security Scanner is a downloadable security tool for free which allows analysis at the application and helps remove viruses, spyware and other malware. It works with your current antivirus software.

    http://www.Microsoft.com/security/scanner/en-us/default.aspx

    Note: The Microsoft Safety Scanner ends 10 days after being downloaded. To restart a scan with the latest definitions of anti-malware, download and run the Microsoft Safety Scanner again.

    Note: The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

    Hope this information is useful.

     

  • Method of painting for the field list

    While developing a small application using a custom list field, I am facing the problem of the paint method, called in a loop. being new BB development such as Java, looking for help here.

    When I tried the debugging scenario, I am not able to understand much, with the exception of the fact that the list field calls the method painself again and again in a loop. Has anyone else faced this problem.

    Is there a way I can debug to find what is causing the paint to get method called unnecessarily?

    You place a breakpoint in the method object and inspect the call stack during the break.

    Most likely, this problem is caused by something in the method object that actually precipitates another call to object. This will put your program in a recursive loop so that the breath of the battery.

    If you post the code object, maybe we can identify the problem.

  • How to add several lines to the CreateWithParameters method

    Hello
    can someone tell me how to insert several rows in a table by using the CreateWithParameters method, which I use in a taskflow.

    That's why you get a null pointer...
    Add the iterator in this page or call the method in the second page... both should work... :)

  • How to pass attribute values after ExecuteWithParam to the method call

    Hello

    I use Jdev 11.1.1.6.

    My use case, is that I have mainPage BTF which has ExecuteWithParam as the default activity. It filters the VO using params. I have a requirement to store some of the attributes of current line to pageFlowScope which must be sent to several taskflows child.
    I present a method call after the ExecuteWithParam event and before the page is rendered but do not know how should I pass the current line (or something) in this method call to store values on pageFlowScope.

    What should I switch to this bean managed to store values on pageFlowScope? Is there an alternative?

    Thank you
    JAI

    I see two possible ways to get to the attributes. First of all, you can get the iterator current rank and get attributes here. Secondly, add you links attribute in the file pageDef methods for all attributes that you are interested in. Then you access it by using the attribute binding. I never tested the 2nd method, but I guess that the framework will fill the attribute links, as it does in a normal page.

    Sorry, can't give you enjoy this code adds that I'm not in front of a PC.

    Timo

  • The binding of the method to the &lt; af:table value = "" was run several times "

    I have create a new jsf page in a Web of Fusion project.

    Defined a table as follows:
    < af:table value = "#{pageFlowScope.taskListBean.tasks}" var = 'row' "
    rowBandingInterval = "0" id = "t2" width = "689".
    rowSelection = "single" summary = "show the task list.
    partialTriggers =": cmi1: cmi2: cmi3: cmi4: soc2: soc1" > "
    < af:column sortable = "false" headerText = 'Number' align = 'end' id = "c1" rowHeader = "true" >
    < af:outputText value = "#{row.number}" id = "ot5" / > "
    < / af:column >
    < af:column sortable = "false" headerText = "Id" align = "DΘmarrer" id = 'c3' >
    < af:outputText value = "#{row.id}" id = "ot2" / > "
    < / af:column >
    < af:column sortable = "false" headerText = "Title" align = "DΘmarrer" id = "c2" >
    < af:outputText value = "#{row.title}" id = "ot4" / > "
    < / af:column >
    < af:column sortable = "false" headerText = "State" align = "DΘmarrer" id = "c5" >
    < af:outputText value = "#{row.state}" id = "ot3" / > "
    < / af:column >
    < af:column sortable = "false" headerText = 'Result' align = 'start '.
    ID = 'c4' >
    < af:outputText value = "#{row.outcome}" id = "ot1" / > "
    < / af:column >
    < af:column sortable = "false" headerText = "PrioritΘ" align = 'end' id = 'c6' >
    < af:outputText value = "#{row.priority}" id = "ot6" / > "
    < / af:column >
    < / af:table >

    When I look in the log, I found that the method getTasks() in the taskListBean has been performed several times? There is a performance problem. Can someone tell me why? How to fix?

    http://StackOverflow.com/questions/2090033/why-JSF-calls-getters-multiple-times

  • Need for a method to be called when the pop-up screen

    Hello

    I have a requirement in my application. I have a screen from which I'm moving to screen B. When I Pop the screen B, I need a method that must be called in the screen has. Looks same as onActivityResult() in Android.

    I am currently using onExpose(). But this method is called for all in the screen has. In the menu click or button also. Is there another way to do this?

    Help, please...

    You have two options I can think immediately, which do not have to change anything in screen B.

    (1) use pushModal when you call B screen.  The statement immediately after the pushModal will be executed as soon as B screen is popped.  In general, I try to avoid the modal screens, but in this case, it's probably what I would do.

    (2) set an indicator immediately before you tap screen B.  Test the flag in onExposed().  If the flag is not set, then the onExposed was called for another reason and you can ignore it.  If the flag is set, then turn him off and process you want, knowing that the screen that has been exposed as screen B jumped.

    Either should work for you.

  • which method is called when the screen has lost focus but stays on blackberry?

    Hello

    I want to know in which method is called when the screen has lost focus, but always visible BlackBerry?

    For example, a screen is in the foreground and we disply dialog box so that the screen is visible but not to focus, therefore, at this time that methos called when we close this dialog box?

    Please, help me please please

    Override the following methods in your class to screen according to your needs

    1. when the screen button to the stack

    Call

    onDisplay() or

    onUiEngineAttached(boolean attached) - so attached is true then your screen is at the top of the screen

    2. When you are in a backlight and the lcd screen turns off to your state of rest and turns on again when you actively use this form

    call

    onVisibilityChange(boolean visible) - if visible is set to true, then you get the focus when the lcd display turns

    3. when your application moves to the background by clicking the red end button (i.e. without quiting the app, yet yours is active in the background)

    call

    onExposed() - when your application comes to the foreground of the background or during any type of screen that is in the top get popped

    & call

    onObscured() - when your application moves to the background, or when a screen pushed above your current screen more

Maybe you are looking for

  • Satellite C650, media recovery fails after replacing HARD drive

    I have a 3 years C650, and the HARD drive has failed. I got a replacement drive and sorts to recover from the recovery media disks that I created and although he claimed to have re - partition the drive and reinstalled windows, windows startup fails

  • New card 3D Satellite P20 and new application of keyboard

    Hey there,I had two questions today. I wanted to get a new card for my Toshiba Satellite P20 3DI don't want a new laptop since it is my baby.My current 3d card is a nVidia Go 5200 32 MB.I'm hoping to get 128 MB, although I'll just 64. I am also looki

  • Yoga power 900?

    Someone could get no additional power supply for the 900 Yoga? I ordered 2 when I bought my Lenovo PC 21/10. At the time he said he was available and embarquerions in a few days. Now, the status is delayed until March 2016! A have more luck elsewhere

  • HO FOR LAPTOP 15 AC 122TU: MY LAPTOP DOES NOT RECOGNIZE MY PHONE USING THE USB CABLE.

    I bought laptop 3 months ago. Her works are properly that day there at far but these last days, it can't recognize my phone using data cable which works properly before this question. How can I solve this problem.

  • How to automate resource studio using visual studio 2010?

    Hi friends, I use the software studio Microsoft Resource for the localization process, now I want to automate my work for studio of resources by using Visual studio. If anyone can guide me how to do this?