EditField slider - Vertical centering

Hello

I need a TextBox with rounded corners and in height and width on measure.  Am able to do this by extending the field to change. But the cursor is always at the top of the field. I want it to be centered, vertically... can someone please suggest me a solution?

Please find the code below for reference

public class TextBoxBorder extends EditField {
 String mDefaultText;
 int BorderColor, FillColor = Color.WHITE, FontColor = Color.BLACK, Width, Height, W = 0, H = 0;
 boolean _inFocus = false;

 public TextBoxBorder(int BorderColor,int FontColor, int Width, int Height,int W,int H,long _st) {
  super(EditField.NO_NEWLINE|EditField.FOCUSABLE|EditField.FIELD_VCENTER|_st);
  this.BorderColor = BorderColor;
  this.FontColor = FontColor;
  this.Width = Width;
  this.Height = Height;
  this.W = W;
  this.H = H;
 }

 public void setDefaultText(String DefaultText) {
        mDefaultText = DefaultText;
 }
 public int getPreferredWidth() {
        return this.Width;
 }
 public int getPreferredHeight() {
        return this.Height;
 }
 public void paint(Graphics g) {
    g.setColor(BorderColor);
    g.drawRoundRect(0, 0, getPreferredWidth() , getPreferredHeight(),10,10);
    g.setColor(FontColor);
    Font font= g.getFont();
    g.drawText(getText(), 2, (getPreferredHeight()-font.getHeight())/2);
    if ( _inFocus ){
            _inFocus = false;
    }
 }
 public String getDefaultText() {
    return mDefaultText;
 }
 protected boolean keyChar(char key, int status, int time) {
  if (null != mDefaultText)
   if (getText().equalsIgnoreCase(mDefaultText)) {
    setText(String.valueOf(key));
    return true;
   }
  return super.keyChar(key, status, time);
 }
 public void layout(int width, int height) {
    width = Math.min( width, getPreferredWidth() );
    height = Math.min(height,getPreferredHeight());
    super.layout(width, height);
    setExtent(width, height);
 }
 protected void onFocus(int direction){
    _inFocus = true;
 }
 protected void onUnfocus(){
        _inFocus = false;
 }
 protected boolean navigationClick(int status, int time) {
    fieldChangeNotify(1);
    return true;
 }
}

Welcome on the support forums.

I suggest to use a handler for your decoration and add the editfield in the center of such manager.

Tags: BlackBerry Developers

Similar Questions

  • Horizontal and vertical centering

    I'm trying to center the content of a webpage both vertical than horizontal to be in the middle of the page.

    For horizontal, I have:

    Width: 350px;

    margin: 0 auto - 142px;

    that works but vertically, I tried:

    top of the margin: auto;

    low-margin: auto;

    body and #container but no go... Can someone please tell me what I'm doing wrong?

    Horizontal centering is easy.  You are just 3 things:

    (1) a document valid type

    (2) width in pixels or percentags container

    (3) set of margin-left and margin-right to the car.

    CSS:

    {#wrapper}

    Width: 900px;

    margin: 0 auto; / * is centered on the screen * /.

    text-align: center / * for older browsers * /.

    }

    The true vertical centering is a bit of a problem and not often found on HTML pages.  It limits what you can do with the page, so I do not recommend this for an entire web site. See the link below.

    http://ALT-Web.com/templates/vertical-center.html

    Nancy O.
    ALT-Web Design & Publishing
    Web | Graphics | Print | Media specialists
    www.Alt-Web.com/
    www.Twitter.com/ALTWEB
    www.Alt-Web.blogspot.com

  • How horizontally and vertically centered Center horizontally aligned 3 buttons?

    Can't wrap my brain matter of centering... I guess because it's Friday!

    Lets say that I need to position 3 buttons side by side in the container to variable width, and I want that they always centered in the container vertically and horizontally. How to acheiwe with container?

    And we talk about QNX components bunnons only and 3 medium [2:n] buttons bumber

    Cup of coffee cleared my mind, so here is the solution and I'm sorry guys I don't think not hard enough at the beginning and you asked to think, but I think it could be useful to many others:

    Important here is SPACER, people never forget spacers... Laughing out loud

               var container:Container = new Container();
    
              var bb1:LabelButton = new LabelButton();          bb1.label = "Knopka1"         bb1.width = 120;
    
              var bb2:LabelButton = new LabelButton();          bb2.label = "Knopka2"         bb2.width = 120;
    
              var bb3:LabelButton = new LabelButton();          bb3.label = "Knopka3"         bb3.width = 120;
    
              container.margins = Vector.([10,10,10,10]);         container.width = 500;            container.height = 200;           container.debugColor = 0x0033FF;          container.flow = ContainerFlow.HORIZONTAL;            container.align = ContainerAlign.MID;         container.padding = 10;
    
              var sp1:Spacer = new Spacer();            var sp2:Spacer = new Spacer();
    
              container.addChild(sp1);          container.addChild(bb1);          container.addChild(bb2);          container.addChild(bb3);          container.addChild(sp2);          container.layout();
    
             addChild(container);
    

  • Wait for the rotation - problem with vertical centering

    What is the event to listen to determine the screen shot? I swore I saw someone talking before but search brings nothing relevant.

    I use x are coordinates for my layout and I have my coord y the value 10, which is excellent in landscape mode. When I turn to portrait, everything is centered vertically, which isn't what I want. I guess I need to listen to the rotation and change my details, but even when I start mode portrait and deply then the app, everything is still smack in the middle (vertically speaking) of the Simulator. I can't understand why this is.

    Hey miss breeder,.

    I was not completely successful with my orientation, but this is what I tried and got some sort of results. the only thing that is a problem, is that the fonts are appearing (possible incorporation question). but the listener is in the code and so here's the function:

    package
    {
        import flash.display.Sprite;
        import flash.display.StageAlign;
        import flash.display.StageOrientation;
        import flash.display.StageScaleMode;
        import flash.events.StageOrientationEvent;
    
        [SWF(width="1024", height="600", backgroundColor="#999999", frameRate="30")]
        public class SampleTest extends Sprite
        {
            public function SampleTest()
            {
                super();
    
                // support autoOrients
                stage.align = StageAlign.TOP_LEFT;
                stage.scaleMode = StageScaleMode.NO_SCALE;
    
                stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, onOrientationChange);
    
            }
    
            protected function onOrientationChange(e:StageOrientationEvent):void
            {
    
                if (e.afterOrientation == StageOrientation.ROTATED_LEFT)
                {
    
                    this.rotation = -90;
    
                    this.x = 0;
                    this.y = 1024;
    
                }
                else if (e.afterOrientation == StageOrientation.DEFAULT)
                {
                    this.rotation = 0;
    
                    this.x = 0;
                    this.y = 0;
                }
            }
        }
    }
    

    hope that helps some. Good luck!

  • Is there a way to make a VERTICAL CENTERING?

    I'm doing my first site on MUSE, actually my first website. I'm a little late, I know... ¬_¬

    And I wanted to have the home page centered vertically and horizontally. It's a very static page with just the buttons to the other part of the site, nothing more.

    Is there a way?

    Hello

    Please see the link below:

    How to center you objects and or a vertically and horizontally in Muse Web site?

    It will be useful,

    Sonam

  • Vertical centering...

    I tried to figure out if the Muse can focus vertically without workarounds.

    The most simple: no content except image. I'll also focus horizontally and vertically.

    Muse can do this?

    Thank you

    Andrew

    Hi Jim -.

    Thanks for the note...

    I guess I should be more specific; While this will center the image vertically within the canvas, it won't Center the canvas vertically!

    So imagine go you to a website - there is a single image, and it is centered vertically in your browser. That's what I'm trying to do.

    In the end, I really want to create anything I want (i.e. a bunch of different content), but make sure that it remains centered vertically in a browser window.

    See you soon!

    Andrew

  • Help with DW & amp; Post nav FW8 vertical centered layout

    I have a navigation bar FW8 CSS that is contained within a div wrapper for a page centered horizontally and vertically (tabular presentation). Works well in Firefox and looks ok in IE, but when the IE browser is resized the navigation bar is not staying put. I have changed the elements of the position, but can not get the right combination. Can anyone help please?

    He solved.

  • A website of vertical centering?

    I have a problem with Muse and I hope that you can explain it to me! This is my site of brochure work, http://www.web-enhanced.com as you can see I couldn't figure how to vertically Center the site! Is there a way to do?

    Hi Bahar,

    Please take a look at this post for a similar description: Re: how to center you objects and or a vertically and horizontally in Muse Web site?

    Kind regards

    Aish

  • Tag div with text and image vertically centered

    I'm having a problem with vertically align an image with a line of text in a div tag using an external CSS file.
    Any help would be appreciated

    You can simply do:

    ProdDimensions img {vertical-align: middle ;}}

    Or you can use an unordered list that has your arrow incorporated as a background image, something like this:

    . ProductList ul {list-style-image: url (Arrow.gif); list-style-position:outside;list-style-type:none;text-align:left ;}}
    . ProductList li {margin: 0 ;}}

    Wrap your unordered list around a div with the ProductList class (or whatever you want to call it) and it will display with the arrows in the middle of the text.

    Another way to do it would be to put a background image on the ProdDimensions class as follows:
    background: url (Arrow.gif) left Center no-repeat; padding-left: 21px;

    This will simply put a background image in the left middle of your div, the padding will ensure that the text is not on top of the arrow.

  • Layout and HGroup vertical centering

    I'm running a Flex 4 application with a Skinnable container with an applied appearance. The container uses a VerticalLayout (for expand/collapse with loaded text). When I try to focus a button down using a HGroup with a HorizontalCenter property, it does not and the button is aligned with the left...

    Code below...


    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:fx s:SkinnableContainer ' http://ns.Adobe.com/MXML/2009 "
    xmlns:s = "library://ns.adobe.com/flex/spark".
    xmlns:MX = "library://ns.adobe.com/flex/mx".
    creationComplete = "fireEvent () '"
    skinClass = "com.cairngorm.personalization.skins.Bac kgroundRectDynamic"
    >

    < fx:Style source = "assets/Main.css" / > "


    < s:layout >
    < s:VerticalLayout / >
    < / s:layout >


    < s:Label id = "header".
    Text = "add photos".
    width = "250" height = "100%".
    styleName = "h2left" / >


    < mx:Spacer height = "15" / >

    < s:RichEditableText id = "msgbody".
    width = "250" height = "110%".
    Text = "your card cover must have a photo. Drag and drop your photo into your card. »
    styleName = "h4".
    verticalAlign = "top".
    Editable = "false" / >

    < mx:Spacer height = "10" / >


    < s:HGroup horizontalCenter = "0" >
    < s:Button skinClass = "com.cairngorm.personalization.skins.Btn PrimarySkin" label = "OK" click ="popOkClick (); "buttonMode ="true"mouseChildren ="false"id ="okBtn"/ >
    < / s:HGroup >

    < / s:SkinnableContainer >

    Hello

    HorizontalCenter won't work in VerticalLayout.

    Change this line

    
    

    TO

    
    
  • I have a slide show full frame, which works great, but is there a way to keep "next" arrows "prev" aligned vertically when the browser size changes? Also is there is way to add a border to a slide show full frame as well?

    I have a slide show full frame, which works great, but is there a way to keep "next" arrows "prev" aligned vertically when the browser size changes?

    Or a way to pin things generally vertically centered?

    Also is there is way to add a border to a slide show full frame as well?

    Thank you

    Hello.  For the problem of alignment, of the research this window https://helpx.adobe.com/muse/using/objects.html#Pinning%20objects%20to%20the%20browser%20w

    For once, click once on the slide show, and then click New. In this way you access the first image. Determine the race it and view it in the browser. It should work.

  • object centered vertically

    Hello, STI, it is possible to focus an object vertically centered, e.g. arrows in slide show full page, see

    http://www.Holzrausch.de/de/Project/98/12

    Try to pin the object you wish to fix the location on the page, in addition, you can try these:

    http://musewidgets.com/products/Center-page

    http://musewidgets.com/products/Center-page

    Thank you

    Sanjit

  • Horizontal AND vertical gliding between the articles and pages?

    Hello

    I was invited by my Creative Director to amend a portfolio of work. Currently I have a doc about InDesign several page that allows to drag horizontal, but with most of the thumbnails on the respective pages linking to the images full screen (using the buttons / navto: / /) etc. However, he wants to scroll horizontally between different clients and then vertically within the client to see the case studies of full screen. He wants to also (once in these case studies of fullscreen) power do rotate the iPad vertically and have written a summary on this relevant case study (ovbiously just in the direction of V)

    My questions are: A) is it possible to slide vertically and horizontally and B) how would I created pages? Obviously if I was in the case study customer 1 4 I would viwer swipe horizontally to go to the case study 2 customer 1 and so on. I guess

    If possible someone at - it pointers to tutorials online?

    Thank you man

    Steve

    This means that you have left this article on page 3 the last time you were

    read.

    You can reset the folio in a triple type the title of the folio in the

    title bar.

    Bob

  • Vertical alignment

    Hello

    HTML code was sent to me by my client, but now they ask a few changes.  I'm fighting with editting their CSS and html.  They would like the logo "on game day, give game grow" angling upward vertically centered with the logo of the "Milwaukee Rescue Mission."  How can I do on all clients?

    Thank you

    Mel

    You will need to re - optimize the images to have the same height and width. Currently,.

    Logo of the day is 322px × 100px.

    Logo MRM is 1, 265px × 653px (scaling 1, 555px x 075px)

    Nancy O.

  • How can I text perfectly vertical center with different font sizes

    Hello

    I have a frame:

    http://www.Flickr.com/photos/82397830@n03/7960870684/

    I tried a vertical centering by defining block of text Options > vertical Justification > Align: Center, but my text is not always get centered vertically. When I put in English words instead of Hebrew ones Gets the text vertical centered.

    There is a sort of invisible box around characters in a font. The measures of the frame of the lower part of the characters below the baseline (such as p or j) to as high as high as the tops of the Capitol letters for diacritical marks such as umlauts and accents. Given that most of the characters are not completely going toward the highest handle or down to the lowest decender, it may seem that the text is not centered between the two vertical points.

    If you need the text to be centered exactly, you can cheat it by applying the vertical offset, but keep in mind that if you change the text, you may need to adjust the amount of vertical offset again. You can use the vertical offset for the text itself, or change text frame options and change the Baseline Options. Also, in your screenshot, I see you have rounded edges on your block of text. The vertical justification works on rectangular text blocks, it's why that doesn't work.

Maybe you are looking for

  • Toshiba T2000SXE - drive HARD work not correctly

    Hello Me, it's once again and needs help mine I only before the court it is however more also not drive HARD problems got can help me there is oneSkype: benny24534MSN: benny_elfischnuffi@liveEast of Germany (Germany) has also no BACK or as Thanks to

  • Satellite C855 - 29 M - slow keyboard and mouse

    Hello I got this phone today and I noticed that as soon as I press a key on the keyboard (excluding shift, ctrl, etc) it takes on average 2 seconds before I can use the built in mouse pad, it means that I can not press and hold a button and move the

  • HP Envy 700-406: wireless drivers for HP envy 700-406

    I will be grateful to anyone who can give me a link for the drivers for my HP envy 700-406 which are compatible with linux wireless.

  • Wert EditBox Variable sofort aktualisieren

    ICH habe mir einen little dialogue is zur Achsendefinition. Den Wert, den ich in ubergebe 'EditBox4' Einträge - also z.B. die ich '20' - an eine Uservariable, deren Namen ich in dem Reiter 'Einstellungen' unter 'Variable' registered habe. DAS works b

  • Where is Microsoft Paint?

    They told me that I have Microsoft Paint... but where is it?  I do a poem of picture for a friend? OT: Microsoft Paint