HorizontalFieldManager custom: cannot field presentation, insufficient height or width

I have two fields to label that I need for available side by side in a manager of horizontal field. When ran, the outputs of the Console: "cannot the field presentation, insufficient height or width.

When I insert a breakpoint, the values are:

  • width = 480
  • height = 1073741823

Why is the value of great height? (Oh yes, the virtual height.)

What is the right way to calculate the height - just use the height field's favorite?

LabelField lf = new LabelField("Flavor");
LabelField olf = new LabelField("Order");

HorizontalFieldManager hfm = new HorizontalFieldManager(
        Manager.NO_HORIZONTAL_SCROLL
                | Manager.NO_HORIZONTAL_SCROLLBAR) {

        protected void sublayout(int width,
            int height) {
        Field field;
        int numberOfFields = getFieldCount();
        int x = 0;
        int y = 0;

        for (int i = 0; i < numberOfFields; i++) {
            field = getField(i);
            setPositionChild(field, x, y);
            layoutChild(field, width,
                    height);
            y += 10;
        }

        int myWidth = Math.min(width,
                getPreferredWidth());
        int myHeight = height;

        super.sublayout(myWidth, myHeight);

        setExtent(myWidth, myHeight);
    }

    public int getPreferredWidth() {
        return getScreen().getWidth();
    }
};

hfm.add(olf);
hfm.add(lf);

You all that hard work the fields chickens and then try to destroy with super.sublayout () call. I'm sure that's what throws the exception. Check your myWidth and myHeight before the call to super.sublayout (). You might find that getPreferredWidth() returns to zero.

I don't know why you would want to increase the parameter y in a horizontal field in any event handler. If anything, set x and not just randomly, by 10, but by the field.getWidth (). But it's logical that if you extend the Manager and remove super.sublayout call.

More important still, you can get what you want much easier to not the substitution of all sublayouts and instead use setMargin on your domains.

Tags: BlackBerry Developers

Similar Questions

  • view the json data in the custom list field

    Hi, I did analysis json and I created the custom list field. Now, I want to display only the data analyzed in my custom list field. I'll post my analyzed data from json and here is the code for my custom list field
    data analyzed.
    I have THREE channels of json and I want to show content tittle and date in the list filed. I'll post the screenshot of my list.

    JSONArray jsnarry = new JSONArray(responce);
                System.out.println("\n--length----- "+jsnarry.length());
                //System.out.println("....................................................=");
                for (int i = 0; i < jsnarry.length(); i++){
    
                    JSONArray inerarray = jsnarry.getJSONArray(i);
                        //System.out.println("\n-inerarray-values----- "+inerarray.getString(i1));
                        String TITTLE = inerarray.getString(1);
                        String CONTENT = inerarray.getString(2);
                        String DATE = inerarray.getString(3);
                                                           System.out.println("TITTLE= "+TITTLE);
                        System.out.println("CONTENT= "+CONTENT);
                        System.out.println("DATE= "+DATE);
    
    }
    

    output

    [0.0] --length----- 2
    [0.0]
    [0.0] -innerarray-length----- 6
    
    [0.0] TITTLE= BJP State President Sanjay Tandon's visit to Amita Shukla's Home
    [0.0] CONTENT=  BJP President Chandigarh Sanjay Tandon at Amita Shukla's Home
    [0.0] DATE= 2013-01-04
    [0.0] ................................................
    [0.0] TITTLE= Sanjay Tandon at mahasamadhi of Satya Shri Sai baba.
    [0.0] CONTENT= BJP Chandigarh President, Sanjay Tandon mahasmadhi of Sri Satya Sai Baba.(Andhra Pradesh)
    [0.0] DATE= 2013-01-13
    

    and my custom list field

           super(NO_VERTICAL_SCROLL);
    
             String TITTLE="TITTLE";
             String CONTENT = "CONTENT";
             String DATE = "DATE";
    
             v.addElement(new ListRander(listThumb, TITTLE, CONTENT,DATE, navBar));
    
             myListView = new CustomListField(v){
    
                 protected boolean navigationClick(int status, int time) {
                     //Dialog.alert(" time in milisec :" + time);
                     return true;
                 }
             };
    

    CustomListField.java

    public class CustomListField extends ListField implements ListFieldCallback {
    
        private Vector _listData;
        private int _MAX_ROW_HEIGHT = 100;
    
        public CustomListField (Vector data) {
    
            _listData = data;
            setSize(_listData.size());
            setSearchable(true);
            setCallback(this);
            setRowHeight(_MAX_ROW_HEIGHT);
    
        }
    
        public int moveFocus (int amount, int status, int time) {
    
            this.invalidate(this.getSelectedIndex());
            return super.moveFocus(amount, status, time);
    
        }
    
        public void onFocus (int direction) {
    
            super.onFocus(direction);
    
        }
    
        protected void onUnFocus () {
    
            this.invalidate(this.getSelectedIndex());
    
        }
    
        public void refresh () {
    
            this.getManager().invalidate();
    
        }
    
        public void drawListRow (ListField listField, Graphics graphics, int index, int y, int w) {
    
            ListRander listRander = (ListRander)_listData.elementAt(index);
            graphics.setGlobalAlpha(255);
            graphics.setFont(Font.getDefault().getFontFamily().getFont(Font.PLAIN, 24));
            final int margin =5;
    
            final Bitmap thumb= listRander.getListThumb();
            final String listHeading = listRander.getListTitle();
            final String listDesc= listRander.getListDesc();
            final String listDesc2= listRander.getListDesc2();
            final Bitmap nevBar = listRander.getNavBar();
    
            //list border
            graphics.setColor(Color.BLACK);
            graphics.drawRect(0, y, w, _MAX_ROW_HEIGHT);
    
            graphics.drawBitmap(margin, y+margin+10, thumb.getWidth(), thumb.getHeight(), thumb, 0, 0);
    
            graphics.drawText(listHeading, 3*margin+thumb.getWidth(), y+margin);
            graphics.setColor(Color.BLACK);
    
            graphics.drawText(listDesc, 3*margin+thumb.getWidth(), y+ margin+30);
            graphics.drawText(listDesc2, 3*margin+thumb.getWidth(), y+ margin+60);
    
        }
    
        public Object get(ListField listField, int index) {
    
            String rowString = (String) _listData.elementAt(index);
            return rowString;
    
        }
    
        public int indexOfList (ListField listField, String prefix, int start) {
    
            for (Enumeration e = _listData.elements(); e.hasMoreElements(); ) {
    
                String rowString = (String) e.nextElement();
                if (rowString.startsWith(prefix)) {
    
                    return _listData.indexOf(rowString);
    
                }
    
            }
    
            return 0;
    
        }
    
        public int getPreferredWidth(ListField listField) {
    
            return 3 * listField.getRowHeight();
    
        }
    
    }
    

    Listrander.Java

    public class ListRander {}

    private bitmap listThumb = null;
    incognito bar Bitmap = null;
    private String listTitle = null;
    private String listDesc = null;
    private String listDesc2 = null;

    public ListRander (Bitmap listThumb, String listTitle, String listDesc, String listDesc2, Bitmap navBar) {}
    this.listDesc = listDesc;
    this.listDesc2 = listDesc2;
    this.listThumb = listThumb;
    this.listTitle = listTitle;
    this.navBar = bar navigation;
    }
    public getListThumb() {Bitmap image
    Return listThumb;
    }
    {} public void setListThumb (listThumb Bitmap)
    this.listThumb = listThumb;
    }
    public getNavBar() {Bitmap image
    return the navigation bar;
    }
    {} public void setNavBar (navigation bar of the Bitmap)
    this.navBar = bar navigation;
    }
    public String getListTitle() {}
    Return listTitle;
    }
    {} public void setListTitle (String listTitle)
    this.listTitle = listTitle;
    }
    public String getListDesc() {}
    Return listDesc;
    }
    {} public void setListDesc (String listDesc)
    this.listDesc = listDesc;
    }
    public String getListDesc2() {}
    Return listDesc2;
    }
    public void setListDesc2 (String listDesc2) {}
    this.listDesc2 = listDesc2;
    }
    }

    You seem to have two problems here and are confusing them.  You must break the problem into two parts

    (1) extract the data from the entry and create the objects you want to display

    2) display in a list, a set of objects.

    Let's get the sorted first premiera.

    I will suggest what to do here, but in practice, you might actually think about this yourself as part of the design phase of your application.  You should do this, not me, because then you will have all the information available.  At the present time, I have just what you said, which is not much.  So maybe what I'm telling you is not correct for your application.  Only you can decide that.  And be blunt here, you should have decided this before you start coding.  Do you want you could lead down the wrong path.  You must think of your application as a home - as the architect must design all the rooms, and how they will be built, before you start building the House.  You do not, then we are building the rooms on the fly.  Who knows if they will be fit at home?

    In this case, I think you need to create an object that represents each of the elements in the internal array of new data.  call this object

    NewsItem

    This object will have attributes, such as its title, content, date, the linked image and so on, each of whom have will get and set methods.  While you treat each inner element fetch you the associated entry and update the object.

    When you have finished the inner loop of processing, you now have a complete

    NewsItem

    Object, so you will add it to a collection, an array of NewsItem objects, call this _newsItems.  You will create it at the beginning - you know how many entries it takes because it is the number of entries in your outdoor table.

    So before you start to deal with JSON, create your table and the 'index' value of 0.

    Once you have created your Newsitem, add this in the table to the position 'index' and increment "index".

    And once you have analyzed all the JSON, you will have a complete picture.  This is part 1 finished!

    And note in your drawListRow, you are given a clue - that is the index in your tables in _newsItems.  So you can easily find which entry to view and display it correctly.  But it is part 2 and is a separate issue.

  • custom bitmaps field not change image when click on

    I created a custom bitmap field and I change the image on the center of my field of custom bitmaps and unfocus

    but when I implement the method of navigation click to change the image when you click on this image does not change...

    my custom bitmap field filed only to focus or unfocus on the image does not change my field of custom bitmaps.

    Bitmap onfocus = Bitmap.getBitmapResource("111.png");
                    Bitmap onunfocus = Bitmap.getBitmapResource("666.png");
                    mybutton1 = new CustomBitmapField(0,"",onunfocus,onfocus,Field.FOCUSABLE){
                         protected boolean navigationClick(int status, int time) {
    
                             mybutton1.setBitmap(Bitmap.getBitmapResource("favu.png"));
    
                             return true;
    
                         }
    
                    };
    add(mybutton1);
    

    and my class of field customBitmap is

    public class CustomBitmapField extends BitmapField {
    
        Bitmap Unfocus_img, Focus_img, current_pic;
        int width;
        String text;
        Font font; 
    
        public CustomBitmapField(int width, String text, Bitmap onFocus, Bitmap onUnfocus, long style) {
            // TODO Auto-generated constructor stub
            super();
            Unfocus_img = onUnfocus;
            Focus_img = onFocus;
            current_pic = onFocus;
            this.text = text;
            this.width = width;
    
        }
        protected void layout(int width, int height)
        {
            setExtent(current_pic.getWidth(), current_pic.getHeight());
        }
        protected void paint(Graphics graphics)
        {
            /*try
            {
                    FontFamily fntFamily = FontFamily.forName("BBAlpha Sans");
                    font = fntFamily.getFont(Font.BOLD,14);
            }
            catch(Exception e)
            {
                font = Font.getDefault();
    
            }
            graphics.setFont(font);
            graphics.setColor(Color.WHITE); */
            graphics.drawBitmap(0, 0, current_pic.getWidth(), current_pic.getHeight(), current_pic, 0, 0);
    
            //graphics.drawText(text, width, 7);
        }
        protected void onFocus(int direction)
        {
            super.onFocus(direction);
            current_pic = Unfocus_img;
    
            this.invalidate();
        }
      protected void drawFocus(Graphics graphics, boolean on)
      {
    
        }
        protected void onUnfocus()
        {
            super.onUnfocus();
            current_pic = Focus_img;
            invalidate();
        }
        public boolean isFocusable() {
            return true;
        }
        protected boolean navigationClick(int status, int time) {
    
            fieldChangeNotify(0);
            return true;
        }
    
    }
    

    When you debug this code, which of your methods of navigationClick, is actually used?

    When you expect the bitmap change, the code should lead object so that to happen.  Paint running?  This is the correct Bitmap painting?

    If you answer these questions, I think that you figure to yourself what is the problem.

    While you're there, you can also watch the following Threads that you have started or contributed to.  Can you solve or continue to contribute to these?

    http://supportforums.BlackBerry.com/T5/Java-development/gif-animation-not-displaying-properlly/m-p/2...

    http://supportforums.BlackBerry.com/T5/Java-development/timepicker-issue/m-p/2387819

    http://supportforums.BlackBerry.com/T5/Java-development/ListField-focus-color-problem/m-p/2407881#m2...

  • Slider custom text field (Cap) does not appear

    All;

    I created a custom text field based on the standard text field, changes work fine (really just a custom height and width and a border).  The problem is the method of painting which seems to remove the cap of the field when it gets the focus.  To be clear the carret never shown at all.

    public class CustomText extends TextField //cutom text field width
    {
        //Custom Height and Width in Pixels
        final static int textwidth=125;
        final static int textheight=25;
    
         CustomText()
         {
         super(); // Call the default constructor    
    
         //Border for text fields
         XYEdges padding = new XYEdges(5, 5, 5, 5); //space between box and border
         Border theborder = BorderFactory.createSimpleBorder(padding, Border.STYLE_SOLID);
    
         //Assign the border to the object
         this.setBorder(theborder);
         }
    
         public void onFocus( int direction )
         {
            super.onFocus( direction ); //invoke parent procedure
            invalidate(); //mark for redraw
         }
    
         public void onUnfocus()
         {
        super.onUnfocus(); //invoke parent procedure
        invalidate(); //mark for redraw
         }
    
         //Override the layout with the custom Width and Height
         protected void layout(int width, int height)
         {
            super.layout(textwidth,textheight);
            setExtent(textwidth,textheight);
    
         }      
    
        //Override the display message such that no message is displayed when the field is full
        protected void displayFieldFullMessage()
        {
        }
    
        //Override the default paint method to call the super class constructor and then assign the border
        protected void paint(Graphics graphics)
        {
           // int prevColor = graphics.getColor(); //Save Previous Color
            graphics.setBackgroundColor(Color.LIGHTGRAY); // Set to Gray
            graphics.clear(); // Clear for redraw
            super.paint(graphics); //Force Redraw of Object
          //  graphics.setColor(prevColor); //restore for cursor paint
    
        }
    
    };
    

    In the paint in the first and last method lines that are commented out were a soloution that I tried after reading on this subject.  Something along the lines of the restoration of the default color, but unfortunately without success.   Any ideas would be more useful

    Thank you!

    Quick thoughts:

    (a) to remove the requirement to substitute paint by setting the background a Color.LIGHTGRAY using the base class

    (b) you put on the field by using this:

    Super.Layout (TextWidth, TextHeight);

    If you then do the following:

    setExtent (textwidth, textheight);

    you are likely to confuse the field.  If you still want to use the entire height and use the full width and then try to deal with it in the Style, that is, replace this:

    Super(); Call the default constructor

    with this

    Super(TextField.USE_ALL_HEIGHT |) TextField.USE_ALL_WIDTH); Call the default constructor

    (c) why you override onFocus and onUnfocus?  I would like to delete these if you do not have anything specific to these methods.

    Make these changes, and you'll have a more simple TextField.  See if these changes will solve the problem of the caret too.

  • Create focus on the custom edit field?

    There's my code to see the login screen...
    I want to create special border editfield when he onFocus? so people place now developed...

    public LoginScreen()
        {
            super( NO_VERTICAL_SCROLL | USE_ALL_HEIGHT | USE_ALL_WIDTH );
            this.getMainManager().setBackground(BackgroundFactory.createLinearGradientBackground(0x0099CCFF,
                    0x0099CCFF,0x009933FF,0x009933FF) );
    
            Bitmap logoEcc = Bitmap.getBitmapResource("ecc.png");           //call image
            BitmapField logo = new BitmapField(logoEcc,Field.FIELD_LEFT);               //make logo side left
            hfm = new HorizontalFieldManager(Field.USE_ALL_WIDTH)           //new horizontalmanager with All Width
            {
                protected void paint(Graphics graphics)
                {
                    graphics.setBackgroundColor(Color.BLACK);
                    graphics.clear();
                    super.paint(graphics);
                }
            };
            hfm.add(logo);
            add(hfm);
            add(new SeparatorField());
    
            username = new LabelField("Username", Field.FIELD_LEFT);
            add(username);
    
            usernameEdit = new EditField (Field.USE_ALL_WIDTH)
            {
                protected void paint(Graphics g)
                {
    
                XYEdges padding = new XYEdges(3, 3, 3, 3);
                int color = Color.BLACK;
                int lineStyle = Border.STYLE_SOLID;
                Border roundedBorder2 = BorderFactory.createRoundedBorder(padding, color, lineStyle);
                usernameEdit.setBorder(roundedBorder2);
            //  g.setBackgroundColor(Color.WHITESMOKE);
                g.clear();
                super.paint(g);
            }
            };
            add(usernameEdit);
    
            password = new LabelField("Password", Field.FIELD_LEFT);
            add(password);
    
            passwordEdit = new PasswordEditField ()
            {
                protected void paint(Graphics g)
                {
                    //g.setBackgroundColor(Color.WHITESMOKE);
                    g.clear();
                    super.paint(g);
                    XYEdges padding = new XYEdges(3, 3, 3, 3);
                    int color = Color.BLACK;
                    int lineStyle = Border.STYLE_SOLID;
                    Border roundedBorder2 = BorderFactory.createRoundedBorder(padding, color, lineStyle);
                    passwordEdit.setBorder(roundedBorder2);
                }
            };
            add(passwordEdit);
    
            add(new SeparatorField());
    
            login = new ButtonField("Login",Field.FIELD_HCENTER);
            login.setChangeListener(this);
            add(login);
    

    any solution? Thank you...

    Hello

    EditField ed = new EditField(){protected void drawFocus(Graphics f, boolean value)
    {              graphics.setColor(Color.BLUE);                 int width = getPreferredWidth();                 int height = getPreferredHeight();                 //Draw a border around the field.                 graphics.fillRect(0, 0, 3, height); //Left border                 graphics.fillRect(0, 0, width, 3); //Top border                 graphics.fillRect(width-3, 0, 3, height); //Right border                 graphics.fillRect(0, height-3, width, 3); //Bottom border
    
    }};
    
    
    

    Write like this...

  • Custom text field

    I want to implement a custom text field that displays its label on the leading edge of a line and its part editable on the TRAILING edge of the same way like a ChoiceField. Is there a documentation available to achieve this (maybe it's to say-sample code)? Or even if I could see the source code for ChoiceField. I develop for a Blackberry Pearl 8110 with 4.3.

    I ended up solve this using managers of horizontal inside vertical management. I have to use a label field for the edit field that accompanies it. When lines are added, I followed is the width of the new label. Then in sublayout to align the edit fields according to the maximum width more stored a Variant. Could not align all the way to the right.

    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.container.*;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.text.*;
    
    public class MyLayoutManager extends VerticalFieldManager {
        protected int maxw;
        protected Font font;
        protected int font_height;
        private int size;
    
        public MyLayoutManager() {
            super(Field.USE_ALL_WIDTH);
            this.maxw = 0;
            this.font = Font.getDefault().derive(Font.PLAIN, 12);
            this.font_height = this.font.getHeight();
            this.size = 0;
        }
    
        public void addLine(String label, int initial) {
            MyEditField mef = new MyEditField(label, initial);
            int label_width = this.font.getAdvance(label);
            this.maxw = Math.max(label_width, this.maxw);
            this.add(mef);
            this.size++;
        }
    
        public int getPreferredHeight() {
            return this.size * this.font_height;
        }
    
        public int getPreferredWidth() {
            return 240;
        }
    
        protected void sublayout(int maxwidth, int maxheight) {
            int y = 0;
            for (int i = 0; i < this.size; i++) {
                Field f = this.getField(i);
                this.setPositionChild(f, 0, y);
                this.layoutChild(f, 240, this.getPreferredHeight());
                y += this.font_height;
            }
            this.setExtent(240, this.getPreferredHeight());
        }
    
        protected class MyEditField extends HorizontalFieldManager {
            private LabelField the_label;
            private JunkField the_value;
    
            public MyEditField(String label, int initial) {
                super(Field.USE_ALL_WIDTH);
                this.the_label = new LabelField(label);
                this.the_label.setFont(font);
                this.the_value = new JunkField(initial + "");
                this.the_value.setFont(font);
                this.add(this.the_label);
                this.add(this.the_value);
            }
    
            public int getPreferredHeight() {
                return font_height;
            }
    
            public int getPreferredWidth() {
                return 240;
            }
    
            protected void sublayout(int maxwidth, int maxheight) {
                Field f = this.getField(0);
                this.setPositionChild(f, 0, 0);
                this.layoutChild(f, maxwidth, maxheight);
                f = this.getField(1);
                this.setPositionChild(f, maxw + 20, 0);
                this.layoutChild(f, maxwidth, maxheight);
                this.setExtent(maxwidth, font_height);
            }
    
            private class JunkField extends EditField {
                private boolean firstFocus;
    
                public JunkField(String deflt) {
                    super(Field.EDITABLE | Field.FOCUSABLE);
                    this.setText(deflt);
                    this.setFilter(new NumericTextFilter(TextFilter.NUMERIC));
                    this.firstFocus = false;
                }
    
                protected void onFocus(int direction) {
                    this.firstFocus = true;
                }
    
                protected boolean keyChar(char key, int status, int time) {
                    if (this.firstFocus) {
                        this.setText("");
                        this.firstFocus = false;
                    }
                    return super.keyChar(key, status, time);
                }
            }
    
        }
    }
    
  • The location of the custom metadata fields

    I'm trying to locate the custom metadata fields. Consider a custom metadata field where his dname = xPracticeWork and dCaption = practical work.

    I am trying to locate it using the old way.

    When to activate the settings regional french user and see this metadata field appears in English.When I turn on the location in the information system Audit, it is said

    unable to find string 'fr.Practice Work'

    So I tried including < @fr. The practice of work =Work practice@ >

    but he throws and error message saying unknown resource definition tag

    If I do the dCaption as PracticeWork and try to < @fr. PracticeWork =Work practice@ > it works absolutely well.

    It seems that the practical work being two letter word definition tag allows no space.

    Can someone please help me on this.


    Thank you

    Vanina

    It's very simple, you write a string that you want to display in the form of legend (I use this trick in the profiles, if I want to rename a metadata custom field exist for the type having a different meaning), or write you a string Id cannot contain spaces, which solved somewhere, usually a custom - component see what thread change location String for details how to create a resource exploitation translations.

  • Problem with custom VerticalFieldManager, custom list field Call Back

    I created a custom vertical field Manager and a custom list field. It works very well in JDE 6.0.But when I build the same code in JDE 4.5 it throws the error because the setExtent Sub protected method (int width, int jeight) that I used in my code is final in JDE 4.5.

    so I changed my sublayout custom implemented code in vertical field Manager method. Again, this works very well in JDE 6.0.When I have to generate in JDE 4.5 is not to throw any errors.but when I run my code

    the list field does not have focus.

    I added a text field and a list custom field to the Vertical Field Manager text field focus but custom list field does not receive the focus. And the confusing part is when I click on the arrow to the getSelectedIndex from the scope of the list is changing and when I print listfield is active or not is the wrong impression.

    What is bad code works fine in jde 6.0 but not in jde 4.5, please let me know what I need to do something.

    Me as the ListField focus, but is not in fact poster it seems.  Have you made a

    . getLeafFieldWithFocus()

    to see if indeed he has the focus?

    I think we will have to see the ListField code for help.

  • Custom edit field - not drawing while typing of the text

    I created a custom edit field (code below), but there is no slider or text drawn while typing.

    The text appears if you click another field on the screen, but not while typing. I guess it has something to do with my method of painting, but I don't know?

    Tips for making more effective methos painting would be a bonus!

    Thank you!

    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.FontFamily;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.component.EditField;
    
    public class CustomTextField2 extends EditField {
    
        private int fieldWidth;
        private int fieldHeight;
        private int button_colour = 0xF9F9F9;
        private int text_colour = 0x666666;
        private int border_color = 0xCCCCCC;
        private Graphics graphics = null;
        public CustomTextField2(long arg0) {
            super(arg0);
            fieldWidth = Display.getWidth()-100;
            //int off = 8;
            FontFamily fFam = null;
    
            try {
                fFam = FontFamily.forName("SomeFontHere");
            }
            catch (ClassNotFoundException e) {
                e.printStackTrace();
            }  
    
            Font font = fFam.getFont(Font.PLAIN, 20);
    
            Font defaultFont = font;
            int off = 8;
            fieldHeight = defaultFont.getHeight() + off + 10;
            this.setPadding(5, 20, 5, 20);  }
    
        protected void paint(Graphics graphics) {
    
            graphics.setColor(button_colour);
            graphics.fillRect(0, 0, fieldWidth, fieldHeight);
            graphics.setColor(border_color);
            graphics.drawRect(0, 0, fieldWidth, fieldHeight);
            graphics.setColor(text_colour);
            graphics.drawText(this.getText(),20,10/2);               super.paint(this.graphics);
        }
    
        protected void onFocus(int direction) {
    
            button_colour = 0xF9F9F9;
            text_colour = 0x666666;
            border_color = 0x3598CC;
            this.invalidate();
        }
    
        protected void onUnfocus() {
    
            button_colour = 0xF9F9F9;
            text_colour = 0x666666;
            border_color = 0xCCCCCC;
            this.invalidate();
        }
    
        protected void drawFocus(Graphics graphics, boolean on) {
    
              super.drawFocus(graphics, on);
        }
    
        protected void fieldChangeNotify(int context)
        {
            try {
    
            this.getChangeListener().fieldChanged(this, context);
    
            }
            catch (Exception e){
    
            }
        }
    
        public int getPreferredHeight() {
    
            return fieldHeight;
        }
    
        public int getPreferredWidth() {
    
            return fieldWidth;
        }
    
        protected void layout(int arg0, int arg1) {
    
            setExtent(getPreferredWidth(), getPreferredHeight());
        }
    }
    

    I just posted a code in another thread - he does most, if not all, of what you want. Take a look:

    Custom elegant EditField (textbox)

  • Custom - Date field that is this feature called?

    I need to create a custom date field. It is personalized because it shows, on the one hand, whatever it is related to the dates and then it indicates that one choice at a time.

    Kinda like this feature

    I want to create something like that, but not the dates. I want to add alist like apples, mangoes, peaches, and plums have a scrolling after another, without showing a huge drop; So basically in the above format. Help, or coding sample please.

    I think you can do this with a SpinBoxField, if you extend it to support of Bitmaps rather than the text that is, it supports at the moment.

  • How to find a custom date field?

    I'm trying to recover contacts based on the value in a custom date field, and I can't get the search function to work. It works fine for me with other custom fields, for example this query:

    / data / contacts? Search = C_Job_Role1 = * HR & depth minimum = & count = 5

    Returns all contacts whose ends the Job role in HR properly. However, if I try the same thing with a date field, for example this query:

    contacts / data /? Search = C_Contract_Expiration_Date1 = * 1 * & depth minimum = & count = 5

    I get a response with the http 500 code - it's an internal server error, so presumably that choke the server when asked to perform a search on a date field.

    Is there a way to do this?

    Hi Eli,

    I ran a few tests and it seems that endpoint to search as standard format (MM/DD/YYYY) date type, not deal with time at the time of unix. The following query (example) will work: C_Contract_Expiration_Date1 = 01/04/2012

    I'm sorry for the initial response. There are some points of endpoints that use the time unix for types date, and we will be more cautious about calling the difference in each context.

    Thank you

    Fred

  • Encrypted PDF format custom XMP fields

    I work with encrypted PDF files, and I want to be able to rely on custom, XMP fields a processing logic.

    Adobe Reader is able to display these fields without entering the password for the PDF file.

    Is it possible for me to also get the values not the XMP data?

    OK, this is just metadata PDF I want, not specifically XMP and I skim the PDF specification and it is now clear how to handle encrypted PDF files.

  • Submit data form pdf as a custom model fields

    Hello

    Is it possible to send form pdf as a custom model fields?

    When the form is submitted, I want it to be sent to me in the form of text and form field data would be autopopulated in the text template.

    Im not sure, but is this how fdf works?

    If so, how can I get my form to submit as fdf?

    Help, please.

    Thank you.

    Oh so what happens if we had a special hot spot on the form... .the admins would open the form. Click the hot spot... one could ask for a password and then display the hidden field.

    Acceptable?

    Paul

  • Custom gauge field

    Hi all

    Is it possible to add any bitmap with GaugeField to display the progress bar?

    Concerning

    Ali Said

    Hello

    It's just an example of code that will do what you need to

    class ProgressField extends GaugeField {}
    private int _progress;

    public ProgressField()
    {
    Super();

    _Progress = 10;
    UiApplication.getUiApplication () .invokeLater (new Runnable() {}
    public void run() {}
    try {}
    startProgress();
    }
    catch (final Exception e) {}
    System.out.println (try ());
    }
    }
    (}, 100, true);
    }

    Private Sub startProgress()
    {
    If (_progress > 100)
    return;
    moveProgress();
    }

    Private Sub moveProgress()
    {
    _Progress ++;
    Invalidate();
    }

    public int getPreferredHeight()
    {
    Return to 75;
    }

    protected void paint (Graphics g)
    {
    g.drawBitmap (0, 0, 100, 75, Bitmap.getBitmapResource ("image.png"), 0, 0);
    g.setBackgroundColor (Color.BLACK);
    int xPos = 0;
    for (int i = 0; i)< _progress;="" i="" +="">
    {
    g.fillRect (xPos, 45, 8, 10);
    xPos += 10;
    }
    }

    Protected Sub layout (int width, int height) {}
    Super.Layout (width, height);
    setExtent (width, 75);
    }
    }

    Note: you can change this code based on your need to make it perfect and good

  • 100% browser height or width image viewer

    Hello everyone,

    I'm new here but I have a question about the light therapy device. I am looking for a way to view an image in a lightbox that presents the image 100% browser height or width. The unit of light therapy in the muse can only display an image in native format. So if the image is too large for the height or the width of the browser, the image will be cropped.

    Is there a widget or another way to scale the image in a lightbox with the width and height of the browser?

    I hope someone could help me with this.

    You can use any other slideshow with full-width as because lightbox will show the original image centrally on the screen.

    Thank you

    Sanjit

Maybe you are looking for