Field bitmap button

Hello...

Yes, I looked in other posts.  And trying to disect the sample APP CustomButton.  But, the image does not change the focus for this, and really, I had a hard time to work with it.

So, after several hours, I write...

I would like to make my button below clickable so that it plays a sound image and changes on focus.  However, I have not yet found a strategy that I could implement.

Can someone provide some guidance?  The error that I get with the implementation ŒUVRE FieldChangeListener when I try to extend the UiApplication is that...

....... The SmartCord type must implement the inherited abstract method FieldChangeListener.fieldChanged (field, int)

So clearly something is wrong and I have a bad strategy, but I have no idea what.

I use absolute available to resize the image according to the size of the screen

Thanks for the tips...

package com.package;

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.*;

/**
 * This class extends the UiApplication class, providing a
 * graphical user interface.
 */

public class MyApp extends UiApplication implements FieldChangeListener
{

    public static void main(String[] args)
    {
            MyApp theApp = new MyApp();
            theApp.enterEventDispatcher();
    }

    public MyApp()
    {
        MainScreen mainScreen = new MainScreen();
        AbsoluteFieldManager MainFieldManager = new AbsoluteFieldManager(){

            //Size the Field to the Screen Size

            protected void sublayout( int maxWidth, int maxHeight)
            {
            int width = Display.getWidth();
            int height = Display.getHeight();
            super.sublayout( width, height);
            setExtent( width, height);
                 }

            //Override the paint method to draw the background image.

            public void paint(Graphics graphics)
            {
                Bitmap background = Bitmap.getBitmapResource("background.png");
                Bitmap backgroundscaled = new Bitmap(Display.getWidth(),Display.getHeight());
                backgroundscaled = new Bitmap(Display.getWidth(),Display.getHeight());
                background.scaleInto(backgroundscaled, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FILL);                                   

                //Draw the background image and then call paint.

                graphics.drawBitmap(0, 0, Display.getWidth(), Display.getHeight(), backgroundscaled, 0, 0);
                super.paint(graphics);
            }
        };                        

        //Power Button 

        Bitmap powerbutton = Bitmap.getBitmapResource("blackbutton.png");
        Bitmap whitepowerbutton = Bitmap.getBitmapResource("whitebutton.png");
        Bitmap powerscaled = new Bitmap(Display.getWidth()/2,Display.getWidth()/2);
        powerscaled = new Bitmap(Display.getWidth()/2,Display.getWidth()/2);
        Bitmap powerpressedscaled = new Bitmap(Display.getWidth()/2,Display.getWidth()/2);
        powerpressedscaled = new Bitmap(Display.getWidth()/2,Display.getWidth()/2);
        powerbutton.scaleInto(powerscaled, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FILL);
        whitepowerbutton.scaleInto(powerpressedscaled, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FILL);
        BitmapField bitmapField2 = new BitmapField(powerscaled, Field.FOCUSABLE) ;
        //Location
        int field2x=Display.getWidth()/4;
        int field2y=(Display.getHeight()/2)-(Display.getWidth()/4);   

        //Add the manager to the screen.

        mainScreen.add(MainFieldManager);

        //Add the fields to the manager.

        MainFieldManager.add(bitmapField2,field2x,field2y);            

        //Push the screen.

        pushScreen(mainScreen);
    }
}

Thanks for the reply.

Yes, I am just now simply show the domains I've created for the package which is currently running and which displays some things I'd like to that.

So my queestion is, what do you suggest to be the next?  I feel that I need to have separate classes for each button, which extends to a BitmapField?  I left it because I didn't know how to add.

Thank you

Tags: BlackBerry Developers

Similar Questions

  • change field bitmap on the focus of radio button

    Hello

    I have 4 radio buttons in a group of radio buttons. Each of the radio buttons has a picture that is linked to. I want to change the image of a bitmap field whenever a radio button got the update.

    How can I do?

    Thanks in advance.

    Call super.onFocus and super.onUnfocus, as well as the change of the bitmap of treatment.

  • String following line - Style field list button

    Hi all

    Below I have attached two images of liststylebuttonfield,

    1. in the first picture

    True line-'connected to 3 organization... ". ', display line-'connected to 3 organization... ". »

    the remaining letters are present in the background of the image.

    I give the width = totalwidth - lefticon.getwidth ();

    2. in the second picture

    True line-'connected to 3 organization... ". ', display line-"Connected to eveniment 3.

    the remaining letters are hiding.

    I give the width = totalwidth - lefticon.getwidth () - balloonIcon.getwidth () - actionIcon.getwidth ();

    How to give to the next line of width/auto for this problem.

    Below I attach my code for your reference...

    package com.samples.toolkit.ui.component;
    
    import java.util.Calendar;
    
    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.system.Characters;
    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.DrawStyle;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FieldChangeListener;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.TouchEvent;
    import net.rim.device.api.ui.Touchscreen;
    import net.rim.device.api.ui.Ui;
    import net.rim.device.api.ui.component.Dialog;
    import net.rim.device.api.ui.component.LabelField;
    
    public class TestFeedListStyleField extends Field {
        Font myFont = Font.getDefault().derive(Font.SERIF_STYLE,5, Ui.UNITS_pt);
        Font myFont1 = Font.getDefault().derive(Font.BOLD,5, Ui.UNITS_pt);
        public static int DRAWPOSITION_TOP = 0;
        public static int DRAWPOSITION_BOTTOM = 1;
        public static int DRAWPOSITION_MIDDLE = 2;
        public static int DRAWPOSITION_SINGLE = 3;
        private static final int CORNER_RADIUS = 18;
        private static final int HPADDING = Display.getWidth() <= 320 ? 6 : 8;
        private static final int VPADDING = 4;
    
        private static final int COLOR_BACKGROUND = 0xFFFFFF;
        private static final int COLOR_BORDER = 0xBBBBBB;
        private static final int COLOR_BACKGROUND_FOCUS = 0x186DEF;
         public MyLabelField _labelField,_labelField1, _labelField2,_labelField3;
    
         private Bitmap _caret;
         private int _rightOffset;
            private int _leftOffset;
            private int _labelHeight,_labelHeight1,_labelHeight2,_labelHeight3;
            private Bitmap _leftIcon;
            private Bitmap _actionIcon;
            private Bitmap _ballon;
            private int _drawPosition = -1;
            private String _labelField1test;
    
        public TestFeedListStyleField(Bitmap icon,String label, String label1, String lable2,String lable3, Bitmap balloon,Bitmap caret,
                long style) {
             super( USE_ALL_WIDTH | Field.FOCUSABLE );
            _leftIcon = icon;
             _labelField = new MyLabelField(label, style );
             _labelField1 = new MyLabelField(label1, style );
             _labelField2=new  MyLabelField(lable2,style);
            _labelField3=new  MyLabelField(lable3,style);
            _ballon=balloon;
            _actionIcon=caret;
            _labelField1test=label1;
            _labelField.setFont(myFont);
            _labelField1.setFont(myFont);
            _labelField2.setFont(myFont1);
            _labelField3.setFont(myFont);
    //      Imagelistner imglistner = new Imagelistner();
    //      _actionIcon.
        }
    
        public TestFeedListStyleField(String label, String label1, String lable2,Bitmap caret,
                long style) {
             super( USE_ALL_WIDTH | Field.FOCUSABLE );
             _labelField = new MyLabelField(label, style );
             _labelField1 = new MyLabelField(label1, style );
             _labelField2=new  MyLabelField(lable2,style);
            _actionIcon=caret;
            _labelField1test=label1;
            _labelField1.setFont(myFont);
            _labelField2.setFont(myFont);
    //      Imagelistner imglistner = new Imagelistner();
    //      _actionIcon.
        }
    
        public void setDrawPosition( int drawPosition )
        {
            _drawPosition = drawPosition;
        }
         public String toString()
            {
                return _labelField.toString();
            }
    
        protected void layout(int width, int height) {
            if( Touchscreen.isSupported() ) {
            }
    
            _leftOffset = HPADDING;
            if( _leftIcon != null ) {
                _leftOffset += _leftIcon.getWidth() + HPADDING;
            }
    
            _rightOffset = HPADDING;
            if( _caret != null ) {
                _rightOffset += _caret.getWidth() + HPADDING;
            }
            _labelField.layout( width - _leftOffset - _rightOffset, height );
            _labelHeight = _labelField.getHeight();
            int labelWidth = _labelField.getWidth();
    
            _labelField1.layout( width - _leftOffset - _rightOffset, height );
            _labelHeight1 = _labelField1.getHeight();
            int labelWidth1 = _labelField1.getWidth();
    
            _labelField2.layout( width - _leftOffset - _rightOffset, height );
            _labelHeight2 = _labelField2.getHeight();
            int labelWidth2 = _labelField2.getWidth();
    
            _labelField3.layout( width - _leftOffset - labelWidth1 - _rightOffset, height );
            _labelHeight3 = _labelField3.getHeight();
            int labelWidth3 = _labelField3.getWidth();
    
            if( _labelField.isStyle( DrawStyle.HCENTER ) ) {
                _leftOffset = ( width - labelWidth ) / 2;
            } else if ( _labelField.isStyle( DrawStyle.RIGHT ) ) {
                _leftOffset = width - labelWidth - HPADDING - _rightOffset;
            }
    
            if( _labelField1.isStyle( DrawStyle.HCENTER ) ) {
                _leftOffset = ( width - labelWidth1 ) / 2;
            } else if ( _labelField.isStyle( DrawStyle.RIGHT ) ) {
                _leftOffset = width - labelWidth1 - HPADDING - _rightOffset;
            }
            if( _labelField2.isStyle( DrawStyle.HCENTER ) ) {
                _leftOffset = ( width - labelWidth2 ) / 2;
            } else if ( _labelField.isStyle( DrawStyle.RIGHT ) ) {
                _leftOffset = width - labelWidth2 - HPADDING - _rightOffset;
            }
    
            int extraVPaddingNeeded = 0;
    //      if( _labelHeight < _targetHeight ) {
    //          // Make sure that they are at least 1.5 times font height
    //          extraVPaddingNeeded =  ( _targetHeight - _labelHeight ) / 2;//( _targetHeight - _labelHeight ) / 2;
    //      }
            if( _leftIcon != null ) {
                  if( _labelHeight+_labelHeight1 < _leftIcon.getHeight() ) {
                      // Make sure that they are at least 1.5 times font height
                      extraVPaddingNeeded =  _leftIcon.getHeight();//( _targetHeight - _labelHeight ) / 2;
                  }
                  else if( _labelHeight+_labelHeight1 > _leftIcon.getHeight() ){
                    extraVPaddingNeeded =  _labelHeight+_labelHeight1;
                  }
            }
            else{
                if( _labelHeight+_labelHeight1 < _actionIcon.getHeight() ) {
                      // Make sure that they are at least 1.5 times font height
                      extraVPaddingNeeded =  _leftIcon.getHeight();//( _targetHeight - _labelHeight ) / 2;
                  }
                  else if( _labelHeight+_labelHeight1 > _actionIcon.getHeight() ){
                    extraVPaddingNeeded =  _labelHeight+_labelHeight1;
                  }
            }
    
          setExtent( width,  (int) (extraVPaddingNeeded*1.1) );
    
        }
          public void setText( String text )
            {
                _labelField.setText( text );
                updateLayout();
            }
    
        protected void paint(Graphics g) {
    
            // Left Bitmap
            if( _leftIcon != null ) {
                g.drawBitmap( HPADDING, VPADDING, (int) (_leftIcon.getWidth()*2), (int) (_leftIcon.getHeight()*3), _leftIcon, 0, 0 );
            }
    
    //        // Text  ( getHeight() - _labelHeight ) / 2, ( getHeight() - _actionIcon.getHeight() ) / 2,  //(int) (VPADDING*.5)
            try {
                g.pushRegion( _leftOffset, (int) (VPADDING*.5), getWidth() - _leftOffset - _rightOffset, _labelHeight, 0, 0 ); //getWidth() - _leftOffset - _rightOffset
                _labelField.paint( g );
            } finally {
                g.popContext();
            }
    
            try {
                g.pushRegion(  (int) (getWidth() - _leftIcon.getWidth()*.6 ), (int) (VPADDING*.5), getWidth() - _leftOffset - _labelField1.getWidth()- _rightOffset, _labelHeight3, 0, 0 ); //getWidth() - _leftOffset - _rightOffset
                _labelField3.paint( g );
            } finally {
                g.popContext();
            }
    
            try {
                g.pushRegion(_leftOffset, _labelHeight, getWidth() - _leftOffset - _rightOffset, _labelHeight1, 0, 0 ); //getWidth() - _leftOffset - _rightOffset
    //            String test6=_labelField1test.charAt(0)+" ".toString();
    //
    //            if(test6.trim().equals("0")){
    ////                 Dialog.alert("Success....");
    //             }
    //             else{
    //               Dialog.alert("Failure....");
                    _labelField1.paint( g );
    //             }
            } finally {
                g.popContext();
            }
    
            if( _leftIcon != null ) {
                try {
                    g.pushRegion((int) (HPADDING+_leftIcon.getWidth()), (int) (_labelHeight*1.5+_labelHeight1), getWidth() - (_leftIcon.getWidth()*2 ), (int) ((_leftIcon.getHeight()-_labelHeight-_labelHeight1)*.9),5, 5 ); //getWidth() - _leftOffset - _rightOffset
    //              g.pushRegion((int) (HPADDING+_leftIcon.getWidth()*1.1), (int) (_labelHeight*1.5+_labelHeight1), (int) (getWidth() - _leftIcon.getWidth()- _ballon.getWidth()- _actionIcon.getWidth()), (int) ((_leftIcon.getHeight()-_labelHeight-_labelHeight1)*.9), 0, 0 ); //getWidth() - _leftOffset - _rightOffset
                    _labelField2.paint( g );
                } finally {
                    g.popContext();
                }
            }
            // Right (Action) Bitmap
            if( _actionIcon != null ) {
                g.drawBitmap(  (int) (getWidth() - _leftIcon.getWidth()*.6 ), (int) (VPADDING*7.8), _ballon.getWidth(), _ballon.getHeight(), _ballon, 0, 0 );
                g.drawBitmap( getWidth() - HPADDING - _actionIcon.getWidth(), (int) (VPADDING*7), _actionIcon.getWidth(), _actionIcon.getHeight(), _actionIcon, 0, 0 );
            }
    
            // BootomGrid
    //        g.drawBitmap( (int) (HPADDING+_leftIcon.getWidth()*1.3), _labelHeight+_labelHeight1, 0, 0, _actionIcon, _drawPosition, _drawPosition );
    //        g.drawBitmap( (int) (HPADDING+_leftIcon.getWidth()*1.3), _labelHeight+_labelHeight1,  0, 0, _actionIcon, _drawPosition, _drawPosition );
    //        g.drawBitmap( (int) (HPADDING+_leftIcon.getWidth()*1.3), _labelHeight+_labelHeight1,  0, 0, _actionIcon, _drawPosition, _drawPosition );
    //        g.drawBitmap( (int) (HPADDING+_leftIcon.getWidth()*1.3), _labelHeight+_labelHeight1,  0, 0, _actionIcon, _drawPosition, _drawPosition );
    //        g.drawBitmap( (int) (HPADDING+_leftIcon.getWidth()*1.3), _labelHeight+_labelHeight1,  0, 0, _actionIcon, _drawPosition, _drawPosition );
    //
        }
    
        protected void paintBackground( Graphics g )
        {
            if( _drawPosition < 0 ) {
                // it's like a list field, let the default background be drawn
                super.paintBackground( g );
                return;
            }
    
            int oldColour = g.getColor();
    
            int background = g.isDrawingStyleSet( Graphics.DRAWSTYLE_FOCUS ) ? COLOR_BACKGROUND_FOCUS : COLOR_BACKGROUND; //COLOR_BACKGROUND_FOCUS
            try {
                if( _drawPosition == 0 ) {
                    // Top
                    g.setColor( background );
                    g.fillRoundRect( 0, 0, getWidth(), getHeight() + CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS );
                    g.setColor( COLOR_BORDER );
                    g.drawRoundRect( 0, 0, getWidth(), getHeight() + CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS );
                    g.drawLine( 0, getHeight() - 1, getWidth(), getHeight() - 1 );
                } else if( _drawPosition == 1 ) {
                    // Bottom
                    g.setColor( background );
                    g.fillRoundRect( 0, -CORNER_RADIUS, getWidth(), getHeight() + CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS );
                    g.setColor( COLOR_BORDER );
                    g.drawRoundRect( 0, -CORNER_RADIUS, getWidth(), getHeight() + CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS );
                } else if( _drawPosition == 2 ) {
                    // Middle
                    g.setColor( background );
                    g.fillRoundRect( 0, -CORNER_RADIUS, getWidth(), getHeight() + 2 * CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS );
                    g.setColor( COLOR_BORDER );
                    g.drawRoundRect( 0, -CORNER_RADIUS, getWidth(), getHeight() + 2 * CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS );
                    g.drawLine( 0, getHeight() - 1, getWidth(), getHeight() - 1 );
                } else {
                    // Single
                    g.setColor( background );
                    g.fillRoundRect( 0, 0, getWidth(), getHeight(), CORNER_RADIUS, CORNER_RADIUS );
                    g.setColor( COLOR_BORDER );
                    g.drawRoundRect( 0, 0, getWidth(), getHeight(), CORNER_RADIUS, CORNER_RADIUS );
                }
            } finally {
                g.setColor( oldColour );
            }
        }
    
        protected void drawFocus( Graphics g, boolean on )
        {
            if( _drawPosition < 0 ) {
                super.drawFocus( g, on );
            } else {
                boolean oldDrawStyleFocus = g.isDrawingStyleSet( Graphics.DRAWSTYLE_FOCUS );
                try {
                    if( on ) {
                        g.setDrawingStyle( Graphics.DRAWSTYLE_FOCUS, true );
                    }
                    paintBackground( g );
                    paint( g );
                } finally {
                    g.setDrawingStyle( Graphics.DRAWSTYLE_FOCUS, oldDrawStyleFocus );
                }
            }
        }
    
        protected boolean keyChar( char character, int status, int time )
        {
            if( character == Characters.ENTER ) {
                clickButton();
                return true;
            }
            return super.keyChar( character, status, time );
        }
    
        protected boolean navigationClick( int status, int time )
        {
            if (status != 0) clickButton();
            return true;
        }
    
        protected boolean trackwheelClick( int status, int time )
        {
            if (status != 0)
            clickButton();
            return true;
        }
    
        //#ifndef VER_4.1.0 | 4.0.0
            protected boolean invokeAction( int action )
            {
                switch( action ) {
                    case ACTION_INVOKE: {
                        clickButton();
                        return true;
                    }
                }
                return super.invokeAction( action );
            }
        //#endif        
    
        /**
         * A public way to click this button
         */
        public void clickButton()
        {
            fieldChangeNotify( 0 );
        }
    
    //#ifndef VER_4.6.1 | VER_4.6.0 | VER_4.5.0 | VER_4.2.1 | VER_4.2.0
        protected boolean touchEvent( TouchEvent message )
        {
            int x = message.getX( 1 );
            int y = message.getY( 1 );
            if( x < 0 || y < 0 || x > getExtent().width || y > getExtent().height ) {
                // Outside the field
                return false;
            }
            switch( message.getEvent() ) {
    
                case TouchEvent.UNCLICK:
                    clickButton();
                    return true;
            }
            return super.touchEvent( message );
        }
    //#endif 
    
        public void setDirty( boolean dirty ) {}
        public void setMuddy( boolean muddy ) {}
    
         private static class MyLabelField extends LabelField
            {
    
                public MyLabelField( String text, long style )
                {
                    super( text, style );
                }
    
                public void layout( int width, int height )
                {
                    super.layout( width, height );
                }   
    
                public void paint( Graphics g )
                {
                    super.paint( g );
                }
            }
         class Imagelistner implements FieldChangeListener {
                public void fieldChanged(Field field, int context) {
    
                }
    
                }
    

    Thank you...

    Hi all
    I solved this problem... Thank you for watching my problem...
    And I create the component 'Image + String + box' with search (like the single selection) If you need it please send mail...
    Kind regards
    NGO

  • editable text field and button is not editable when added to the Manager of the Horizontal

    I find layout, when I added the button and EditField horizontally, Manager, I'm not able to write something in the EditField and not able to click on the button

    public class MyStorySearch extends MainScreen
    {
    
        private VerticalFieldManager mainManager;
        private VerticalFieldManager subManager;
        private Bitmap _backgroundBitmap = Bitmap.getBitmapResource("a.png");
        private int deviceWidth = Display.getWidth();
        private int deviceHeight = Display.getHeight();
        LabelField lbl;
        ButtonField gobtn= new ButtonField("Go");
        HorizontalFieldManager hfm = new HorizontalFieldManager(Manager.FOCUSABLE|Manager.EDITABLE);
        private Field editfild;
        Bitmap bitmapImage = Bitmap.getBitmapResource("storysearch.png");
        BitmapField fieldDemo;
    
        public MyStorySearch()
        {
            super(NO_VERTICAL_SCROLL);
            //this manager is used for the static background image
            mainManager = new VerticalFieldManager(
                              Manager.NO_VERTICAL_SCROLL |
                              Manager.NO_VERTICAL_SCROLLBAR )
            {
                public void paint(Graphics graphics)
                {
                    graphics.clear();
                    graphics.drawBitmap(0, 0, deviceWidth,
                             deviceHeight, _backgroundBitmap, 0, 0);
                    super.paint(graphics);
                }
            };
    
            //this manger is used for adding the componentes
            subManager = new VerticalFieldManager(
                             Manager.VERTICAL_SCROLL |
                             Manager.VERTICAL_SCROLLBAR )
            {
                protected void sublayout(int maxWidth, int maxHeight)
                {
                    int displayWidth = deviceWidth;
                    int displayHeight = deviceHeight;
    
                    super.sublayout( displayWidth, displayHeight);
                    setExtent( displayWidth, displayHeight);
                }
            };
    
            //add your component to this subManager
            lbl = new LabelField("SUNRAYS SEARCH", LabelField.USE_ALL_WIDTH | DrawStyle.HCENTER);
            Font myFont = Font.getDefault().derive(Font.PLAIN, 10, Ui.UNITS_pt);
            lbl.setFont(myFont);
            subManager.add(lbl);
            subManager.add(new SeparatorField());
    
            editfild = new EditField(){
                protected void layout(int width, int height) {
                    setExtent(width*85/100, 30);
    
                };
            };
            editfild.setBorder( BorderFactory.createSimpleBorder( new XYEdges(2, 2, 2, 2),
                    new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK), Border.STYLE_SOLID));
            editfild.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
    
            hfm.add(editfild);
            hfm.add(gobtn);
    
            subManager.add(hfm);
    
            //add subManager over the mainManager
            mainManager.add(subManager);
    
            //finally add the mainManager over the screen
            this.add(mainManager);
        }
    }
    

    The following code shows an EditField and a button, and I can type in the EditField and click the button.  It is not perfect, but at least it works.

    I don't know what the problem is with your code.  I suggest review you my code, review your code and investigate things that are different.

    Two areas I would focus on your layout and the sublayout.  As stated in a previous post, if you must code a setExtent in a layout, then you should really think about creating your own Manager - I gave you links to do this several times.  And if you plan to use a standard field and to make it work properly, you must use the sublayout.  Here is a link to help you create custom fields:

    http://supportforums.BlackBerry.com/T5/Java-development/create-custom-fields/Ta-p/444962

    Edit:

    Thanks for the update of these discussions.

    And I'm sorry.   I forgot to paste the code...  Here, it is now...

            EditField editfild = new EditField(){
                protected void layout(int width, int height) {
                    super.layout(width*85/100, height);
                };
            };
            editfild.setBorder( BorderFactory.createSimpleBorder( new XYEdges(2, 2, 2, 2),
                    new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK), Border.STYLE_SOLID));
            editfild.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
            ButtonField gobtn= new ButtonField("Go") {
                protected boolean navigationClick(int status, int time){
                    Status.show("button clicked");
                    return true;
                }
            };
            HorizontalFieldManager hfm = new HorizontalFieldManager();
            hfm.add(editfild);
            hfm.add(gobtn);
            this.add(hfm);
    
  • Development/unfocus field custom button problem

    Hi all

    I have something weird happens.  I have a custom button field that swaps the images based on a focused state or blur.  I have been using this field custom for awhile now, and I have never had any problems.  Imagine the following provision:

    ______________    ________________________

    | Custom button |    | BasicEditField |

    ------------------------    ------------------------------------------

    When my screen is launched, the focus is on the custom button.  If I move the trackball in a downward movement, the focus is taken the custom button, and its background image changes adequately to what has been defined in the untargeted State.  The BasicEditField then has the focus.  This is the correct behavior.

    If, however, I move the trackball in a movement to the right to the BasicEditField, then the BasicEditField will indeed get the focus, however the custom button field always displays its "highlight" picture  Using print statements, I was able to determine that when I move in a movement to the right with the trackball, the custom field button loses the focus and then gets the focus back to back, that's why it shows the highlighted image.

    Additional info:  This isn't an issue on touch devices, and custom button Manager is a TableLayoutManager.

    Any ideas why this might be happening?  Here's the code to my custom button field:

    public class BitmapButtonField extends Field {
        private String text = "";
        private Bitmap bitmap;
        private Bitmap bitmapHighlight;
        private Bitmap b;
        private boolean highlighted;
    
        public BitmapButtonField(String image, String imageHighlight, long style) {
    
            super(style | Field.FOCUSABLE);
    
            this.bitmap = Bitmap.getBitmapResource(image);
            this.bitmapHighlight = Bitmap.getBitmapResource(imageHighlight);
    
            b = bitmap;
    
        }
    
        public BitmapButtonField(String text, String image, String imageHighlight,
                long style) {
    
            super(style | Field.FOCUSABLE);
    
            this.text = text;
            this.bitmap = Bitmap.getBitmapResource(image);
            this.bitmapHighlight = Bitmap.getBitmapResource(imageHighlight);
    
            b = bitmap;
    
        }
    
        protected void drawFocus(Graphics graphics, boolean on) {
            // Do nothing
        }
    
        public int getPreferredHeight() {
            return bitmap.getHeight();
        }
    
        public int getPreferredWidth() {
            return bitmap.getWidth();
        }
    
        protected void layout(int width, int height) {
            setExtent(getPreferredWidth(), getPreferredHeight());
        }
    
        protected boolean navigationClick(int status, int time) {
            fieldChangeNotify(1);
            return true;
        }
    
        protected void onFocus(int direction) {
            b = bitmapHighlight;
            invalidate();
            System.out.println("FOCUSED");
    
        }
    
        protected void onUnfocus() {
            b = bitmap;
            invalidate();
            System.out.println("UNFOCUSED");
        }
    
        protected void paint(Graphics graphics) {
    
            int topTextPadding = (b.getHeight() - getFont().getHeight()) / 2;
            int sideTextPadding = (b.getWidth() - getFont().getAdvance(text)) / 2;
    
            graphics.drawBitmap(0, 0, getWidth(), getHeight(), b, 0, 0);
            graphics.setColor(Color.WHITE);
            if (text.length() > 0) {
                graphics.drawText(text, sideTextPadding, topTextPadding,
                        Graphics.ELLIPSIS, b.getWidth());
            }
        }
    }
    

    Have you looked at navigationMovement in the TableLayoutManager?  I confess that I rewrote it because it handles no left and right as I wanted.  Perhaps, you might be able to do the same thing.

  • change the bitmap button

    Hello everyone

    I have a button called cbutton customfield.
    I want to show him different text whenever I click on it. (For example a - z). But when I try
    CButton = new custombutton (alpha);
    It doesn't seem to work.
    Help, please

    you could substitute navigationclick and navigationunclick, set a Boolean condition in there and the call was canceled.
    in the paint method you find isClicked (your custom status) and paint something else, like the second bitmap, for example.

  • How a bitmap button can recognize key strokes?

    Hello

    I created an image button and it recognizes the click of the mouse in touch Simulotor. But when the focus is on the button, when I press ENTER, it does not recognize. I need to create the button for non touch phones. Is there a solution? My code is like this

    Bitmap bitmap1 = Bitmap.getBitmapResource("Add.png");
    btField1 = new BitmapField(bitmap1, BitmapField.FOCUSABLE | DrawStyle.HCENTER)
    {
      protected boolean navigationClick(int status, int click)
      {
          fieldChangeNotify(1);
          return true;
      }
    };
    

    Any help will be much appreciated

    I met this issue before, but I do not use bitmapField to perform the functions of the handle.

    (I put on the screen, using a variable "status" to save the State of the user).

    So I don't know if this is possible in your bitmapField.

    Due to the use of the ball from his wheel blackberry push push "enter", so I add this function manage the ball pushing wheel:

    protected boolean trackwheelClick (int status, int time) {}

    Enter code to push

    Returns true;

    }

    And I think that someone may press 'Enter' (at least I support on entering the Simulator), so I add this function to handle the key "enter":

  • Radio - text field - radio button

    How associate you two radio buttons to work together when you need to have the text in the middle of the radio buttons? (below the first radio button there are two text fields)

    It's a fluid subform and everytime I try to "Pack in the new group of radio buttons", it moves the text fields below two boxes.

    • radio button

    text field for the text field

    • radio button

    Hello

    use a subform set, where you can also your radio buttons and textfields manually and put this subform in you flowed subform.

  • Calculation of the numeric fields radio button and checkbox-based response

    I am to change a form that was created by someone else.  I added checkboxes and radio buttons based on the need to form. I would like for the amount of check calculate automatically based on the selection of a radio button.  I've implemented some numeric fields to play with adding the amounts and placed them in the field 'Amount to check', but I can't seem to calculate.  Once I have to calculate correctly, I need to know how to automatically enter a number in the appropriate digital field based on the option button or check box selected.  Here is a picture of what I've put up.  Help, please!  I read all the forums, watched the videos and tried everything.  I'm so frustrated.

    MemberStatusHelp.jpg

    Don't know if I have the layout if correct me if Im wrong. I assume you have a radio button group on the top line for the first 3 check boxes and boxes (when the user selects one) for the following 2 lines (where the user can select independently of the other 3 above) with a final calculation at the end to check the amount field.

    You can either place the code on each change of each checkbox/radio button event to recalculate or just do it on the final checksum field. I tried putting a calculate on the last field to check the quantity, and it seems to do what it takes.

    Try this in the case of calculating the amount of check field

    var membershipAmount = 0;
    if ( (RadioButtonList.rawValue == "2") || (RadioButtonList.rawValue == "3") )
    {
        membershipAmount = 35;
    }
    
    if (CheckBox1.rawValue == "1" )
    {
        membershipAmount += 15;
    }
    
    if (CheckBox2.rawValue == "1" )
    {
        var txtAmount = TextField3.rawValue;
        var amt = 0;
        if ( (txtAmount != null ) && (! isNaN(txtAmount) ) )
        {
            amt = parseFloat(txtAmount);
        }
    
        membershipAmount += amt;
    }
    
    this.rawValue = membershipAmount;
    
  • CS5 SDK: fields exporter &amp; buttons

    Hello

    I implement an exporter for CS5 with the new SDK. I had a question about custom presets. I have a Workbench where only one exporter will support multiple file formats and several presets each. It will use external resources for compression, so I need as a simple user interface for the exporter I can get. Currently, there is only a single prest - "Custom". I've attached the debugger for the plugin, but when I select the drop-down menu preset in the window of the exporter, first don't even go in exporting plugin. So, I can't know how to load my values in the preset field (for example, I can start with simple strings for the predefined names - "Preset 1", "Preset 2", etc. ") Also, I have a few questions exporter interface. So:

    1. How can I load multiple presets in 'Preset' field, so it will not always say "Custom" in the window of the exporter?

    2. is it possible to add a custom with custom name field and load custom in the exporter window values?

    3. is it possible to not draw (I disabled them) 'Export video', 'Audio export' and 'Open in Device Central' check boxes? I disabled, but would prefer them not visible in the window.

    4 can I control the toggling of the 'metadata' and the 'Tail' button button in the window of the exporter?

    5. is it possible to not draw (I disabled them) boxes 'Quality to make Maximum usage', "Use realized" and "use interpolation?

    Thank you!

    Hey Petro,

    You can create a custom drop-down list, but it should be in one of the tabs at the bottom right, as video, Audio, or a new tab.  You cannot create a custom control next to the Format and Preset drop-down lists at the top right.  So if it is feasible, it would be ideal that you can use the existing preset menu drop down at the top right, next to the Format drop-down list.

    But if your exporter has a special need, you can create a custom drop-down list.  Looks like you do already, basically.  As the exporter of made during the exSelGenerateDefaultParams SDK sample, you can call AddParamGroup() with a name like 'Preset' and then create the dropdown param similar to how the exporter SDK calls AddParam() to create the type of field parameter, which is a drop-down list to multiple selections.

    Zac

  • Pop the text field scrolling buttons on the stage

    Hello all;

    I am very new to Flash so please bare with me. If anyone can point me to some examples I would really appreciate it. I have 5 buttons on my stage (in fact they are just text that I made in buttons); I would like the user to be able to click on each of them, and it appears a text field scrolling where they can read and scroll the information in the text field and then they can go back and click Next and so on. On the left side of the stage is the buttons and on the side right would be the scrolling text field. Now I realize that I could accomplish this using frameworks separated for each button and just pointing to these images, but I feel that there is an easier way... There must be there is something I'm definitely missing...

    Thank you d ' attribute
    T

    A warning first. I have not tested this code, but it covers most of what is needed to do this with AS3.

    var source: String = "myTxtFile.txt";
    var dataFormat:String = pouvez;

    var loader: URLLoader = new URLLoader();
    loader.dataFormat = dataFormat;

    loader.addEventListener (Event.COMPLETE, completeHandler);

    var request: URLRequest = new URLRequest (source);
    try {}
    Loader.Load (request);
    } catch (error) {}
    trace ("there was an error loading the text file");
    }

    function completeHandler(evt:Event):void {}
    var variables: URLVariables = new URLVariables ((evt.target comme URLLoader) .data);

    for (var i: uint = 1; i<= variables.numvars="" ;="">

    var n: String = "button" + i;
    myTexts [n] variable = [n];

    }
    }

  • Type of field Bitmap attribute

    The documentation for Bitmap says

    public Bitmap(int type,
                  int width,
                  int height)
    

    Built an empty bitmap object of a specific type. Suppose I need to create an image .png or .bmp, what should be the value of the type attribute? Him been worth constant for the type attribute can be specified in the documentation for easier use.

    they gave one for example. like this, try to type Bitmap. then you will be the list of all the available constants

    monochromeBitmap = new Bitmap(Bitmap.ROWWISE_MONOCHROME, 12, 12, sourceData);
    
  • As category fields and buttons such as Edit on Desktop Calendar are suddenly empty.

    not sure what the problem is.  Preview calendar at the top right shows a point, but not the dates!

    Sorry, it has updated this problem report - seems I was running low memory on my desk and this is why fields stopped in Palm Desktop.

    Thanks anyway for your aid application.

  • Field increment button

    I've been out because of surgery for three weeks and don't have no idea how I got it working before you go... somehow it doesn't work anymore... Thanks in advance for your help...

    It is the form on a Table with report cataloguing our internal documents.
    1. I'm passing PK ID of the form/table in a view only item called: P51_DOCNO (i.e., 2656) which will be used as the file name of the document being cataloged.
    2 If the user never refreshes the shape, then a revision of this document (e.g., 2656 A) number. I created an item called: P51_REVISION which will contain the revision number. I tested this code before the surgery, and it worked then. It works for most now, but the way I put it in place I could not go beyond "A."
    SELECT CASE  
    when ASCII(SUBSTR(:P51_DOCNO,LENGTH(:P51_DOCNO),1)) >= 65 
    then
    SUBSTR(:P51_DOCNO, 1, LENGTH(:P51_DOCNO)) || CHR(ASCII(SUBSTR(:P51_DOCNO,LENGTH(:P51_DOCNO),1)) + 1)
    else substr(:P51_DOCNO, 1,LENGTH(:P51_DOCNO)) || 'A'
    END
    FROM DOC_INFO
    WHERE DOC_INFO_ID = :P51_DOC_INFO_ID;
    3. to start this process, I had a button at the top of the form of REVIEW that, when you click,: P51_REVISION would update.
    4. somehow, I used more than two points (: P51_NEW_REV_DISPLAY and: P51_NEW_DOCNO) I used to hold the current revision and the next in the sequence.
    5. I remember using request = 1 Expression and Expression 1 being REV (request button) and I remember using the javascript in the html page header. Sorry - I don't know javascript well enough to write my own, but that will take a class of early next year.

    While I was away our improved 3.1.x.x.x network administrator in 4.0. I don't know if that had something to do with some quirks, or if I can just blame persistent anesthesia... but your help will be IMMENSELY appreciated.
    Thank you!

    Yuck! For me, "soy" anything is a sauce you have in a Chinese restaurant - not sure I would have on my breakfast! I thought that my diet was bad enough :D

    If VERNUMBER needs to change each time the user saves a record, then it should be unconditional (although, perhaps triggered by a button somewhere?)

    I'd do it:

    :P3_VERNUMBER := NVL(:P3_VERNUMBER, 0) + 1;
    

    P3_VERNUMBER being the element that you want to set (assuming that the process is running before the "process of line of...") "(or equivalent) and I added NVL() where it is NULL (However, it should be, I'm sure that contain '1' at the very least!). What zeros?

    PS - no, can not see the moon - it's always sunny here (it is 15:20 and don't start to get dark for another hour, give or take)

    Published by: ATD on January 21, 2011 15:20

  • Subtracting two fields and button

    I'm trying to subtract text Text11 11.1 and there total, Text11.2, I tried different from Java and FromCals. Help, please!

    Also is it possible to add a button that is bound to the pencil tool on a form?

    Hmmm. try to remove value formatting in the Time2Num function option.

    var Interval = Time2Num (StopTask) - Time2Num (StartTask)

    Steve

Maybe you are looking for

  • Pavilion 550-150qe: graphics and power for 550-150qe

    Hello My nephew wants to upgrade the graphics card in his 5501150qe and will probably need to upgrade to the power supply, too.   It's a small suitcase and the first card he bought was too big (it did not before).  It has now become a Msi GeForce gt

  • Simple file sharing

    How to disable simple file sharing and what are the results may occur?

  • I can't download important updates - error code 0x800705b4 unknown

    I can and discovered that several important updates have not been installed in my computer - I discovered that the package version of Microsoft 4.02.20110411 (problem of determination that prevent you from updating the windows updates) should take ca

  • Screenshot BBM not updated; the status is!

    I am writing because the cause three times through BBM surveys problem return gave no response. So, I bought a Priv (phoneawesome , BTW!) and migrated everything, including my BBM, it.  The app has some trouble (don't get started me on the stickers),

  • Access VPN CLeint to specified IP addresses

    Hello community. I wish to restrict VPN access to our ASA only an Adresss IP specified. The problem is the customer can install the VPN client on each machine, but I want that restrict it to a single machine (an IP address). Any ideas. A Patrick soon