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!

Tags: BlackBerry Developers

Similar Questions

  • Provide technical support paid to the developer of applications for BlackBerry BlackBerry?

    Provide technical support paid to the developer of applications for BlackBerry BlackBerry?

    Please guide me if BB provides this support for developers.

    Thank you

    The technical forums offer almost everything you need. There are BB monitor and help people on various forums. It really takes that you had to pay someone, if support is free.

  • What developer support options are available for the development of Java for the BlackBerry Smartphone?

    What developer support options are available for the development of Java for the BlackBerry Smartphone?

    What plans are available?

    Who can I contact with to register a support plan?

    One of the evangelists 'Developer' RIM working outside South Africa, I think, so there should be someone local you can talk too.  If you message Mark Sohm (the RIM name you will see a lot on the forum - MSohm), with your e-mail address and it ask to put you in contact with the Developer Evangelist in SA, which should help.  You can tell Mark to ask me if he needs clarification.  Do not promise anything either but I hope that something will happen.

  • Confusion about the development of applications for windows surface surface Pro and Windows for windows rt...

    Hello guys... I want to launch an application... for surface... but the confusion I got... is one of main surface contain windows rt and pro version contain windows 8. for pro, I'm fine with the update, but for windows version rt... made the project 2012 VS for windows... like in the pro version... (same project will work or not)... or I do VS 2012 project for windows phone...

    Hello

    Please post your question in the MSDN forum.

    MSDN

    http://social.msdn.Microsoft.com/forums/en-us/home

    I hope this helps.

  • Disable the call to the listener of selection for certain cells of a row in the table.

    Hi all


    I have a table with 5 columns. I applied a listener of custom for this table in the bean selection. Now, what is my requirement, an action should happen in some specific cells in this table not all cells. So, how can I get that cell was clicked while the user selects a row in the table? If I can get my problem is apparently solved.

    Help, please.

    You could do this by putting a client listener on the element inside the columns instead of a listener of the selection on the table. You will then get a server event that will tell you which column was clicked.

    http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/11-client-listener-169135.PDF

  • aid is the development of components for the AS3 video player

    Hi all

    I'm looking for a video player that

    can be resized at design time with should stretch controls (play, pause

    button, volume seekbar controls full button screen etc.)

    I found the same

    kind of player in AS2.0 here. The best part is that it can be resized in the design

    should have stretch of time with its controls.

    emehmedovic.com/xmca/toobplayer/

    You may have already looked at this but, you can use a flvplayback component that has no controls and then add the controls that you are interested in individually to the scene. You can then size and position the control components you want and then use Actionscript to connect each component control for the flvplayback component.

  • I can do 2 remote calls at the same time?

    Hello

    I can do 2 remote calls at the same time? For example, if I have the following remote objects:

    "" < mx:RemoteObject id = "myRemote" destination ="zend" source = "MyData" showBusyCursor ="true"fault = "faultListener (event)"> "

    " < mx:method name ="getData"result ="getDataListener (event)"/ >

    < / mx:RemoteObject >

    "" < mx:RemoteObject id = "myRemote2" destination ="zend" source = "MyData2" showBusyCursor ="true"fault = "faultListener (event)"> "

    " < mx:method name ="getData2"result ="getDataListener (event)"/ >

    < / mx:RemoteObject >

    And I call them at the same time:

    public function myFunc (): void {}

    myRemote.getData ();

    myRemote2.getData2 ();

    }

    Will it work? Flex will be "confused" the results of a call with the results of the call on the other? Do I need an AsyncToken? If so, how to use an AsyncToken in the example above?

    Thank you

    -Laxmidi

    I do it all the time. I call the one for control combobox with a list of people, a

    and with these data on people filling a datagrid. Then use the drop-down list to filter the datagrid.

    In your sample well mak result = "getDataListener (event) another" and name it getDataListener2, so there is a separate and a dataprovider for the first to the second. "

    If your going to the same event, the other will replace the first.

    Hope this helps

  • Quick Start Guide for the development of AIR on iOS?

    Hello

    Is there as a starter guide for the development of AIR for iOS? I am looking for a sort of tutorial that tells me what to install and how to create a Hello World game on iOS (iPhone and iPad).

    Thank you

    http://active.tutsplus.com/tutorials/mobile/Flash-for-iPhone/

  • Error #1009 when sound inside game, a movie clip that is called to the scene with child add method

    What is supposed to happen

    I have a clip that is called when the user clicks a button. When moving clip appears music is expected to play. When the user clicks the close button the music stops and the clip is removed from the scene.

    But then I get an error

    When I test the movie I get the following error:

    TypeError: Error #1009: cannot access a property or method of a null object reference.

    to mc_playSong / frame2 () [mc_playSong::frame2:6]

    This is the code that calls the clip on the stage (no problem here):

    Call the video clip with the song played on stage

    stage.addEventListener (MouseEvent.MOUSE_DOWN, goButtons);

    function goButtons(event:MouseEvent):void

    {

    If (event.target is song_bnt)

    {

    SoundMixer.stopAll ();

    addChild (myPlaySong);

    myPlaySong.x = 558;

    myPlaySong.y = 384;

    Event.stopImmediatePropagation;

    }

    The following code inside the clip is called to the scene. The music is meant to play:

    Stop();

    Variables for listening to music

    var RJPlaySong:RJSong = new RJSong();

    var RJPlaySongChannel:SoundChannel;

    Music for plays

    stage.addEventListener (Event.ENTER_FRAME, startRJSong); (I think that the error in the code is in this function. When I comment on him I don't get error.)

    function startRJSong(event:Event):void

    {

    RJPlaySongChannel = RJPlaySong.play ();

    }

    Stop all sounds, sets variables to null and calls a send event that removes the clip of the scene.

    bnt_closeSong.addEventListener (MouseEvent.MOUSE_DOWN, closeCreditSongScreen);

    function closeCreditSongScreen(event:MouseEvent):void

    {

    SoundMixer.stopAll ();

    RJPlaySong = null;

    RJPlaySongChannel = null;

    dispatchEvent (new Event ("RemoveMCsong"));

    }

    Someone at - it ideas? This seems to be a pretty simple question, but I can't understand it.

    I meant that you have quoted just to be taken literally.  If it's still not clear what I say or what did your code, try the following in order to demonstrate the IT change... This code to be...

    stage.addEventListener (Event.ENTER_FRAME, startRJSong);

    function startRJSong(event:Event):void {}

    trace ("I can do this all day");

    }

    After doing this, you can see why you want to only call the function once, and you could eliminate most of it and just put...

    RJPlaySongChannel = RJPlaySong.play ();

    Instead, or as I said originally, you can change it to be...

    function startRJSong (): void

    {

    RJPlaySongChannel = RJPlaySong.play ();

    }

    startRJSong();

  • delegate method calls to the members of a class

    Hello

    I'm new to LabView and using the 2013 version.

    I am familiar with the concepts of object-oriented programming.

    situation/goal

    I have a controller that controls axes. The controller said communication happens via plain text messages.

    I want to control the two axes with orders abstract (moving, stop, speed change, etc.) of LabView.

    That's why I created a class of axis with several parameters. (although)

    The controller communication is established via an ActiveX reference.

    I created a controller class that holds said reference in addition to the two axes.

    My goal here is to create a controller object, which past its ActiveX reference for the two axis.

    To add lines to the controller I dragged the class axis from the window of the class controller twice overall project.

    I created some accessors to all members of the class of the axis, including its ActiveX reference.

    problem

    In the Set accessor method for the controller class ActiveX reference, I would like to call the setters for the return of the two axes objects that contains the ActiveX controller.

    I can separate the controller to see the two axes, but I can neither unbundle either of the axes nor can I add a method node to them.

    It is logical that the separation is not possible to ensure encapsulation, but why can't I just call a method?

    Am I still add references to objects when you drag the axis class?

    Or is what adds the class itself?

    If this adds the class, how can I add a reference to an object of a certain class as a member of another class?

    I've attached a screenshot of the controller class.

    Thank you for your help.

    Hello

    The object Oriented Design is rater hard. Encapsulation banned, as you said, the data from your classes are defined outside their class.

    In your case it means that you have to create a data member access VI inside of the class of the Axes. These access screws (methods) allows you to set the values for these axes of type two objects inside of the controller of the class. Make sure that these two classes are in the less community.

    You can refer to a class using reference data value, Yes, BUT in this data type to the reference class is included. At the time, it seemed more convenient: LabVIEW programming job: The decisions behind the Design http://www.ni.com/white-paper/3574/en/

    Self an example here:

    Examples for the new reference value of data with the Forums of Discussion LVOOP https://forums.ni.com/t5/LabVIEW/Examples-for-New-Data-Value-Reference-with-LVOOP/td-p/1317493

    If you want to use data heavily references, I would recommend the GOOP package, which has different design questions build in singleton as etc. (which are not possible by default in LabVIEW)

  • call shared the actor object function

    I run a large application using the Framework of the actor on the cRIO-9068.  LabVIEW 2013 SP1f2.

    One of my players must call a function from a .so shared object file that I created.  I also created a vi wrapper that contains the node of the library call.  The vi wrapper is not part of a library or a category.

    When I add the wrapper vi to one of the methods of the actor's and deploy the application; I get an error for the B indicating actor Core.vi actor charged with errors on the target and has been closed.  Here's where it gets interesting.

    If I remove B actor of the project, the error becomes actor C.

    If I remove the wrapper vi of the actor, the error disappears and my application runs as expected.

    If I have only the wrapper that VI on the target, the shared object function runs as expected without error.

    I'm out of ideas.  I will try to reproduce this problem on a small scale, but any help will be appreciated.

    Thanks in advance,

    Kevin

    Looks like I solved the problem by moving the .so to/usr/lib and by running chmod 0755 /usr/lib/libfoo.so

    would have been easier to repair if assigned deployment error to the actor actually using the library

  • method object never called

    Hey guys,.

    I'm having a problem with the code below:

    package mypackage;
    
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.Graphics;
    
    public class MyApp extends UiApplication
    {
        public static void main(String[] args)
        {
            MyApp theApp = new MyApp();
            theApp.enterEventDispatcher();
        }
    
        public MyApp()
        {
            pushScreen(new MyScreen());
        }
        public void paint(Graphics g) {
            g.setColor( Color.BLUE );
            g.fillRect(0, 0, 100, 100);
    
        }
    }
    

    Object the method is never called. I'm new to the BlackBerry development, but judging by my experience of Java, it should work. I don't see what the problem with this code.

    Any help would be appreciated!

    See you soon,.

    Thomas

    Your method object in the code below is simply a local method, since UiApplication does not implement object.

    I think that you wanted to substitute her object in your screen class, but is not what you're doing here.

  • extend ListField, how to get a valid result of getSelectedIndex inside the method object?

    Hi all

    I have replace the method object to extend ListField to create my own color ListField.

    I need to avoid the double drawRow between the method object

    and the drawFocus() method.

    inside the method object, I always get the 'bad' selectedIndex (previous)

    (or rectangular previous on getFocusRect()).

    my questions are:

    1. how to get current selectedIndex (or FocusRect) inside the method object when we extend ListField?

    2. is there any other method called before object, the method which returns SelectedIndex valid?

    3. how to avoid the double drawing between object and drawFocus()?

    Thank you.

    If everything you do is add your own color, and then you can do this by using a fillRect in the drawListRow method.  In there.  I have the code that did this, but only for lines not targeted, as it detects with:

    If (listField.getSelectedIndex ()! = index) {}

    //

    }

  • Error caused by the overrided method object build

    Hello world

    When I build my Active blackberry Setup, I get the error:

    I/O Error: Cannot run program "jar": CreateProcess error=2, The system cannot find the file specifiedrapc executed for the project MyApplication
    

    This happens when I have this code:

    LabelField lblTitle = new LabelField(title) {
        protected void paint(Graphics graphics) {
            graphics.setColor(0x00FFFFFF);
            graphics.clear();
            super.paint(graphics);
        }
    };
    LabelField lblSubTitle = new LabelField(releaseYear + ", " + rating) {
        protected void paint(Graphics graphics) {
            graphics.setColor(0x00FFFFFF);
            graphics.clear();
            super.paint(graphics);
        }
    };
    
    vfmHeader.add(lblTitle);
    vfmHeader.add(lblSubTitle);
    screen.add(vfmHeader);
    

    If I had to remove the method object overrided in the LabelField lblSubTitle, however, the build error does not. I tried to change a LabelField to a RichTextField lblSubTitle, and I still get the same error.

    Very strange. Anyone know why this is happening? Thank you!

    I found the solution to my problem here:

    http://www.BlackBerryForums.com/rim-software/79668-JDE-build-all-problem.html

    Basically, I removed all older versions of Java that I had and I installed this following:

    J2SDK-1_4_2_15-windows-i586 - p.exe (JDK 1.4.2 version 15)
    JDK-1_5_0_12-windows-i586 - p.exe (JDK 1.5.0 version 12)

    JDK 1.5.0 is necessary because otherwise the JDE Eclipse plug-in will not start with 1.4.2.

    Without having the JDK 1.6, however, the MDS - CS will organize not (within Eclipse). I had to manually download "BlackBerry email and MDS 4.14 Service simulators", start it and then run my application.

    I hope this can help someone down the line...

  • 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()

Maybe you are looking for

  • Equium A100-027: could not find the drivers for Windows XP

    HelloI bought an equium A100-027 and, because of my work, I want to use a personal OS XP - Pro, I bought the retailer 2006 Microsoft.The problem is that XP installs successfully, but I can't find the drivers on the Toshiba Download Page.The laptop TY

  • Equium L350D - 11 d connecting to a network wireless after the factory restore

    Hello Recently, I've restored my Equium to factory following a virus. I am running Windows Vista Home Premium and it is out of warranty. When I try to connect to a network, it is said the computer does not have an installed and configured wireless ne

  • The user guide for the iPhone update iOS 9.2 Crash

    My iPhone iOS user guide 9 in iBooks on my Mac was an update, for iOS9.2, I have downloaded 2 days ago. Then, the book has crashed whenever I tried to open it, so I deleted it, but the failure of any attempt to re - download. It starts the download t

  • Google chrome does not get updates

    my google chrome is not updating.after some time it says error3 and I don't know how to solve this problem, as EMI does not get the updates ive tried going by default on my settings for no result .hope could someone help me with this.

  • Video poor quality DX80

    Have a p2p between 2 DX80s meeting.  The video quality is poor.  The guy is registered a 10.5 CUCM - cisco switches/routers.  circuit 20meg.  I have a solid 8mbps between each end point during a file transfer.  I don't think I'll have problems with b