GridFieldManager with label get wider

I searched the forums, but can't find the answer to my problem. so, who can help me here.

I have a GridFieldManager, with 2 containing static text and two labels with the text I want to change during execution.

GridFieldManager gfm = new GridFieldManager(2, 2, Manager.USE_ALL_WIDTH | GridFieldManager.FIXED_SIZE);
gfm.setColumnProperty(0, GridFieldManager.FIXED_SIZE, 300);
gfm.setColumnProperty(1, GridFieldManager.FIXED_SIZE, 180);
float TMeasured = 180 / 10;
float TSetpoint = 195 / 10;
lTemperatureMeasured = new LabelField(Float.toString(TMeasured) + "°c");
lTemperatureSetpoint = new LabelField(Float.toString(TSetpoint) + "°c");
gfm.add(new LabelField("Temperature measured"), FIELD_LEFT);
gfm.add(lTemperatureMeasured, FIELD_LEFT);//RIGHT);
gfm.add(new LabelField("Temperature setting"), FIELD_LEFT);
gfm.add(lTemperatureSetpoint, FIELD_LEFT);//RIGHT);
add(gfm);

the problem is that when I change the text of the label, the GridFieldManager becomes wider! simply, it grows and grows by something like 5 pixels. change the fixed width did not help.

I just can't understand why this happens. who does that?

Text editing is done with a button:

public void fieldChanged(Field field, int context)
{
    if(field == bChangeTemperature)
    {
         lTemperatureSetpoint.setText("t");
    }
}

Tags: BlackBerry Developers

Similar Questions

  • Height of a VBox with label and wrapped text

    Hello

    I have a VBox with label and text wrapped inside. The sentence in the text are from an external location and load in the text. I want to know the height of the VBox after that the text was being wrapped and place inside the VBox.

    I used all the properties for VBox as getHeight(), getPrefHeight(), getMinHeight() and getMaxHeight(), but these properties give me what I want.

    Is there another property I am missing or is a short coming of VBox?

    If this is a shortcoming of VBox, what other solution do I?

    Thank you

    AA

    You can register a listener with heightProperty() of the vbox and get it when it changes.

  • Hello. I'm just a beginner and I downloaded the itunes 12.3.3 update and now when I right click on a work of art albums all disappear from the track of this album. I also have problems with my get info tab. All of my info from the album crashes.

    Hello. I'm just a beginner and I downloaded the itunes 12.3.3 update and now when I right click on a work of art albums all disappear from the track of this album. I also have problems with my get info tab. All of my info from the album crashes.

    This can help (from turingtest2):

    Fix iTunes for Windows security permissions

  • for windows update make me number error msg: 0 x 80240036 and solve this problem poblem with fixit get msg w xp sp3 rendered and nework Framework 2 or lator should be installed pls can help you

    for windows update make me number error msg: 0 x 80240036 and solve this problem poblem with fixit get msg w xp sp3 rendered and nework Framework 2 or lator should be installed pls can help you

    See your other thread the same. http://answers.Microsoft.com/en-us/Windows/Forum/windows_xp-windows_update/to-make-Windows-Update-am-getting-MSG-error-number/3f579859-ecb0-408D-9db3-804044a21fb7

  • HP LaserJet P1102W long delay between pages with narrow (4 "wide) paper stock

    I use Adobe Acrobat Reader X (on Windows XP) to print a page 100 PDF on HP P1102W, with 4 "wide x 11" long paper in the main tray.  There is a delay of approximately 15 seconds between pages.  As soon as I share the narrow paper for regular 8.5 "x 11", the printer takes the job at normal speed.  The PDF itself has a page PDF 4 "x 11" size.

    I tried implementing a custom 4 "x 11" paper size in the print preferences and setting the paper type to envelope, but nothing done.

    I tested with 5.5 "wide and 7.5" wide paper stock, and they have the same 15 second delay.  As soon as I put 8.5 "wide stock in the status bar, the printer goes back to full speed.

    Note that even with the thin paper stock, the first page of the job prints immediately.  The delay occurs between page 1 and 2, 2 and 3, etc.  So it seems strange that the printer does not have the 'calibration' delay before printing the first page, it delays only on the following pages.

  • Great ButtonField with label that surrounds it.

    Hello

    I want to create a great label ButtonField who must dress to the next line.

    (1.) I overrode getPreferredWidth/height to adjust the dimensions of the button.

    2.) is it possible to get the text to wrap around to the next line.

    Is there another way to model a button with text that surrounds to the next line?

    I would really appreciate guidance in this regard.

    Thank you

    -MO.

    Well, I had little time to debug the code.  Here's the working version (I'll even integrate it into our project - after a few changes):

    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.Manager;
    import net.rim.device.api.ui.XYRect;
    import net.rim.device.api.ui.component.NullField;
    import net.rim.device.api.ui.component.TextField;
    
    public class MultiLineButtonField extends Manager {
        private final static int MAX_LABEL_PADDING = 8; // pixels
        private final static int MIN_LABEL_PADDING = 2; // pixels again
        private final static int NON_FOCUS_COLOR = Color.DARKBLUE;
        private final static int FOCUS_COLOR = Color.BLUE;
        private final static int DISABLED_COLOR = Color.GRAY;
        private final static int FONT_COLOR = Color.WHITE;
        private TextField _label;
        private NullField _focusAnchor;
        private int _width;
        private int _padding;
    
        public MultiLineButtonField(String labelText, int width, long style) {
            super(style & (FIELD_HALIGN_MASK | FIELD_VALIGN_MASK | USE_ALL_WIDTH | USE_ALL_HEIGHT));
            _label = new TextField(style & SPELLCHECKABLE_MASK | READONLY | NON_FOCUSABLE);
            _label.setText(labelText);
            add(_label);
            _focusAnchor = new NullField(style & FOCUSABLE_MASK) {
                protected void onFocus(int direction) {
                    getManager().invalidate();
                    super.onFocus(direction);
                }
    
                protected void onUnfocus() {
                    getManager().invalidate();
                    super.onUnfocus();
                }
            };
            add(_focusAnchor);
            _width = width;
            if (_width < 2 * MIN_LABEL_PADDING) {
                throw new IllegalArgumentException("Not enough width to lay out MultiLineButtonField");
            }
        }
    
        protected int nextFocus(int direction, int axis) {
            invalidate();
            return -1;
        }
    
        protected void sublayout(int width, int height) {
            XYRect childRect;
            if ((width < 2 * MIN_LABEL_PADDING) || (height < 2 * MIN_LABEL_PADDING)) {
                throw new IllegalArgumentException("Not enough room to lay out MultiLineButtonField");
            }
            layoutChild(_label, Math.min(_width, width) - 2 * MIN_LABEL_PADDING, height - 2 * MIN_LABEL_PADDING);
            childRect = _label.getExtent();
            int myWidth = width;
            int myHeight = height;
            if (!isStyle(USE_ALL_WIDTH)) {
                myWidth = Math.min(width, childRect.width + 2 * MAX_LABEL_PADDING);
            }
            if (!isStyle(USE_ALL_HEIGHT)) {
                myHeight = Math.min(height, childRect.height + 2 * MAX_LABEL_PADDING);
            }
            _padding = Math.min((myWidth - childRect.width), (myHeight - childRect.height)) / 2;
            setPositionChild(_label, _padding, _padding);
            layoutChild(_focusAnchor, 0, 0);
            setPositionChild(_focusAnchor, 0, 0);
            setExtent(myWidth, myHeight);
        }
    
        protected void paintBackground(Graphics g) {
            int prevColor = g.getColor();
            int bgColor;
            if (_focusAnchor.isFocusable()) {
                if (_focusAnchor.isFocus()) {
                    bgColor = FOCUS_COLOR;
                } else {
                    bgColor = NON_FOCUS_COLOR;
                }
            } else {
                bgColor = DISABLED_COLOR;
            }
            g.setColor(bgColor);
            g.fillRoundRect(0, 0, getWidth(), getHeight(), _padding, _padding);
            g.setColor(prevColor);
        }
    
        protected void paint(Graphics g) {
            int prevColor = g.getColor();
            g.setColor(FONT_COLOR);
            super.paint(g);
            g.setColor(prevColor);
        }
    }
    
  • Events with label, TextInput, and list

    Hello

    I'm with yet another problem.

    So, I have a list on a page with a bunch of items in there.

    On the same page is a TextInput which takes something from the user.

    According what is selected in the list, this entry (in the TextInput) is changed on label and displayed on the screen.

    I did a job, but it doesn't seem to work, the code I use is below.

    In addition, if you look at the code, I use my table as:

    var fromArray:Array = new Array({label: 'Thing1'},
                    {label: 'Thing2'});
    

    And I always use the index number in the eventListener. This seems a bit heavy. Is any way for him to seek the 'label' name... i. e Thing1 and Thing2 rather than the index = 0 and index = 1.

    Here's the rest of my code:

    package
    {   
    
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.filesystem.File;
        import flash.net.SharedObject;
        import flash.text.TextField;
        import flash.text.TextFieldType;
    
        import qnx.ui.data.*;
        import qnx.ui.display.Image;
        import qnx.ui.events.ListEvent;
        import qnx.ui.listClasses.*;
        import qnx.ui.skins.picker.*;
        import qnx.ui.text.*;
    
        public class DistanceWindow extends Sprite
        {
            private var textInput:TextInput;
            private var inputNumber:int = new int();
    
            private var outMeterLabel:Label;
            private var outMeterNumber:int = new int();
    
            public function DistanceWindow()
            {
                drawDistanceWindow();
            }
    
            public function drawDistanceWindow():void {         
    
                var fromArray:Array = new Array({label: 'Thing1'},
                    {label: 'Thing2'});
    
                var fromList:List = new List();
                fromList.setSkin(ListCellRenderer);
                fromList.width = 250;
                fromList.height = 400;
                fromList.alpha = 1.0;
                fromList.x = 100;
                fromList.y = 100;
                fromList.rowHeight = 25;
                fromList.dataProvider = new DataProvider(fromArray);
                fromList.selectionMode = ListSelectionMode.SINGLE;
                fromList.allowDeselect = false;
                fromList.selectedIndex = 0;
                fromList.addEventListener(ListEvent.ITEM_CLICKED, listItemClicked);
                addChild(fromList);
    
                textInput = new TextInput();
                textInput.setSize(250,40);
                textInput.prompt = "Input";
                textInput.setPosition(387,150);
                textInput.textField.restrict = "0-9 \.";        // Restrict to only numbers from 0 to 9 AND the period (decimal) i.e. hex 2E
                textInput.addEventListener(Event.CHANGE, inputNumberEntered);
                addChild(textInput);
    
                outMeterLabel = new Label();
                outMeterLabel.text = "outMeterLabel";
                addChild(outMeterLabel);
            }   
    
            private function inputNumberEntered(e:Event): void {
                inputNumber = e.target.toString();
    
            }
    
            private function listItemClicked(e:ListEvent): void {
                var indexClicked:int = new int()
                indexClicked = e.index;
    
                if(indexClicked == 0) {
                    outMeterNumber = inputNumber*0.01;
                    outMeterLabel.text = outMeterNumber.toString();
                }
            }
    
        }
    }
    

    Any help would be great!

    Thank you!

    G

    Hey gpatton,

    I went through the code and made a few Chang to get what I think you want. first thing I did was subject to available fromList to all functions within this application by moving outside the constructor. second thing, it is that I converted your ourmeternumber a number instead of an Int object so that we can see decimal and not only the portion of the whole number of the result. last thing that I did, assuming you want to see a change, whenever a user changes the value of the input text entry was to take the function listItemClicked function and place it in the inputNumberEntered function. so now, the entry is changed each time so the value of the label. the changes I made are in bold. Note also I removed the "new int()" portions of your code. they are not required. This also applies to digital objects and string.

    DistanceWindow.as:

    package{ 
    
      import flash.display.Sprite;  import flash.events.Event;    import flash.events.MouseEvent;   import flash.filesystem.File; import flash.net.SharedObject;    import flash.text.TextField;  import flash.text.TextFieldType;
    
      import qnx.ui.data.*; import qnx.ui.display.Image;  import qnx.ui.events.ListEvent;   import qnx.ui.listClasses.*;  import qnx.ui.skins.picker.*; import qnx.ui.text.*;
    
      public class DistanceWindow extends Sprite    {     private var textInput:TextInput;      private var inputNumber:Number;
    
          private var outMeterLabel:Label;      private var outMeterNumber:Number;
    
          private var fromList:List;       
    
          public function DistanceWindow()      {         drawDistanceWindow();                 }
    
          public function drawDistanceWindow():void {         
    
              var fromArray:Array = new Array({label: 'Thing1'},                {label: 'Thing2'});
    
              fromList = new List();            fromList.width = 250;         fromList.height = 400;            fromList.alpha = 1.0;         fromList.x = 100;         fromList.y = 100;         fromList.rowHeight = 25;          fromList.dataProvider = new DataProvider(fromArray);          fromList.selectionMode = ListSelectionMode.SINGLE;            fromList.allowDeselect = false;           fromList.selectedIndex = 0;           fromList.addEventListener(ListEvent.ITEM_CLICKED, listItemClicked);           addChild(fromList);
    
              textInput = new TextInput();          textInput.setSize(250,40);            textInput.prompt = "Input";           textInput.setPosition(387,150);           textInput.textField.restrict = "0-9 \.";        // Restrict to only numbers from 0 to 9 AND the period (decimal) i.e. hex 2E          textInput.addEventListener(Event.CHANGE, inputNumberEntered);         addChild(textInput);
    
              outMeterLabel = new Label();          outMeterLabel.text = "outMeterLabel";         addChild(outMeterLabel);              }   
    
          private function inputNumberEntered(e:Event): void {          inputNumber = e.target.text.toString();
    
              if (fromList.selectedIndex > -1)           {             if (fromList.selectedIndex == 0)              {                 outMeterNumber = inputNumber*0.01;                    outMeterLabel.text = outMeterNumber.toString();               }         }
    
          }
    
          private function listItemClicked(e:ListEvent): void {         var indexClicked:int;            indexClicked = e.index;
    
              if(indexClicked == 0) {               outMeterNumber = inputNumber*0.01;                outMeterLabel.text = outMeterNumber.toString();           }     }
    
      }}
    

    Oh yah also in the inputNumberEntered function, I've changed the first line to:

    inputNumber = e.target.text.toString();
    

    You had right idea just forgot to go a step deeper and get the text property of the TextInput.

    also its worth noting that I've seen a weird phenomenon when the TextInput value is really high. the reported numbers of return are not accurate at all. Try to go... 1.12.123 1234... and so on until what u hit 123456789. It will begin to do some weird stuff after u pass this point. Assuming that your numbers will get very high that it may not be a problem.

    hope that helps. Good luck!

  • Type of clean Flash with glow gets cut

    Type I created in Flash and given such a glow gets cut!  Not only is the cut right, glow effect but the real type itself gets chopped... last character on the right...

    Anyone know what is happening with this and what is the solution?

    Thank you!

    fkat

    If you have added space for the text, which isn't going to not do the wider TextField.  The value is AutoSize textfield?

  • Scale label gets its place

    LV2013.1, Win7

    I'm experimenting with shutters and resizable user interface features for the first time.

    So I resize the Panel and windows, a little.

    One of the windows, I have a waveform GRAPH, set scaling with the pane.

    I noticed that the LADDER LABEL y-axis, will crawl out of place, after some time:

    Worse yet, I can't find a property to set the position.  The lebel is set justify the Center, but the rectangle is it centered, lag between the actual Center.

    Even worse than THAT, it seems to be saved with the VI.

    If I REPLACE the graph, the new label is at the Center.  But start playing with the resizing of the Panel or the Panel itself, and it slips off.

    It happens on the category axis, too.  Here's a JING showing labels in the Center and crawling up / right: ">http://www.screencast.com/t/xnN1Wb8Ke >

    My guess is that there is a bias in the borough during the calculation of the Center, and whenever he comes across an odd size, it calculates the Center and throws the rest.

    Is there a property "don't be silly," I can put to solve this problem?

    Take a look at this thread, the OP offers a workaround solution.

    Ben64

  • Apparent problem with OpenG Get Data Name_ogtk.vi

    The data Name_ogtk.vi Get OpenG is a function that takes a data Structure and returns the name of this structure if the Data Structure has a name.

    I use it in my Configure.vi. Configure.VI takes several data structures and saves / loads to an INI file. The name of the section in the INI file is the same as the name of the Data Structure. When loading, Configure.vi takes the name of the data structure to load and locate the Section in the INI file with the same name and then uses the items listed in the INI section to load the Data Structure with the data values.

    In my case, I have 3 sections. Two of the sections, 1 Servo and Servo 2 derive from the same Type definition. I am trying to load 3 of the attached INI file data Structure. The Config.ini in the system file has been generated by the backup function Configure.vi. I'm passing in the routine of the load, 3 Data Structures, each with unique names. I have an explicit call to get the data for Servo 1 Name.vi and 2 Servo. But the probes on the output of the Name.vi of data values get two return to the same 'Servo 1' same string if sensors on the Structure of data entries that clearly indicate them the unique names of the "Servo 1" and "Servo 2" respectively.

    It seems that the 2nd Get data name returns the name of the Data Structure 1 by mistake. If anyone can check this?

    Does anyone know how to fix Get Data Name.vi so that it returns the appropriate data Structure names?

    Thank you.

    I was able to reproduce it and I show here as an oddity to force entry to the variant on the primitive flat string Variant.

    Basically, if you have more than one cluster with content command to match the type and order wired directly to this function, it returns the flattened string which is first to each call.  The wires must be wired without before converting to alternative, if you have points of constraint.

    This only happens if you feed directly the input varying both and get the stress points.  If you are using a variant is not the case.

    I found that this occurs if the cluster is of type defined, and it does not occur for constants.  I didn't try other controls.  I'll be honest, I'm usually used to constrain to the Variant.  I'll be more careful in the future!

    ----

    so convert to first variant will solve your problem.  In addition, if you leave the entry of the section name of the variant config openG write screw unwired, he will take the name as it is the research of the control, you did, so you need not the name of data Get there at all.

    An excerpt from 2009.  as - is equal to true.  The bunches are each a dbl and a bool, but each FP different controls.

  • Avory Labels: Problem with labels

    To easy labels Avory Peal using on my OfficeJet Pro 8600 Plus printer. Problems with them supplies does not correctly the printer. I print about 30 pages at a time and have about 6 or 8 that weakest every time. They never jamb, they just weakest and he picks up two sheets of printing half the page on one and the other half on the other. The printer is fairly new and in a clean environment. I need to clean something internal or is this a known problem with the machine or labels? I need to use these labels I have a machine they run in which pulls the labels on the sheet for easy labelling.

    Space_Cowboy

    Welcome to the Community Forum of HP.

    I've never used the labels of type "Easy Peel"; they may have different characteristics to those I know.

    In general, labels Avery tend to do with print options > tab paper / quality >

    Media > Brochure matte (or ice)

    Reference:

    Printing options

    Click on the thumbs-up Kudos to say thank you!

    And... Click on accept as Solution when my answer provides a fix or a workaround!

    I am happy to provide assistance on behalf of HP. I do not work for HP.

  • When I clicked to open an email associated with, I get this message "this action is canceled due to restrictions in effect on this computer... "See your administrator to" How do I fix ths?

    When I clicked open an associated email, I get this messge ' this action is cancelled because of the restricions in effect on this computer... check with your administrator to "How can I solve ths?

    Salvation, paradise,

    You are the owner / administrator of the computer or is it a work computer?

    Error message: this operation has been cancelled due to Restrictions in effect on this computer

    http://support.Microsoft.com/kb/278839

    What follows is to edit the Windows registry.  Remember to create a backup before making any changes.

    Back up the registry

    http://Windows.Microsoft.com/en-us/Windows-Vista/back-up-the-registry

    The operation has been cancelled...

    http://www.slipstick.com/problems/this-operation-has-been-cancelled-due-to-restrictions/

    I hope this helps.

  • problem with label pie chart!

    Hello

    I found this example of chart areas, I tried to use several pie charts, but the place of the label to move in a table. It shows the place moved down when using the vi.

    I've attached an example with 4 pie charts and sometimes it shows the 4 places and sometimes down to one. No way to adjust it?

    I would like to see some examples with the 3d pie chart. Do you know any example?

    Thanks in advance!.

    Fred

    Sorry guys! I got it.

    Change the first time call to the comparison of the loop For = 0, so always start with the value set to draw the square.

    Thank you.

  • What can I get widi on my aspire 5750g

    Hello

    I just bought but not yet unpacked (so I can get my money back if she's not going to work) A Netgear Push 2 TV ptv3000 it says on the packageing, it requires a laptop computer to be capleable of tm Intel WiDi or miracast.

    as far as I can tell my Aspire 5750 g wit intel core i5 - 2450 m has no WiDi? t it? or can be added?

    Thanks in advance for any help / advice

    concerning

    Mike

    I would be surprised if the software simply verified Intel WiFi drivers. He'll almost certainly check physical hardware.
    If this is the case then "Adator WiFi not supported" is explicit. As I've mentioned in my previous post, the requirement is for the pilots and not "ready" software or specific hardware.

    To check a second time, try to run the hardware detection program Acre on the download site. In addition to this, you may also be able to get more information about the actual WiFi card of your device manager. Check your results against the Intel compatibility list.

    Unfortunately I have no technical info for your model, so I'm unable to confirm what motherboard chipset you have.

  • Travel with laptop get IP address conflict notice I'm a learner

    Help I get IP address view conflict on my laptop.

    I'm a learner and travel through the Australia

    IP address conflict occurs when the same IP is used by another computer on the network.
    To avoid this, you must configure your IP address manually.

    • who are going to start-> run-> type "ncpa.cpl" (with quotes)
    • Then you will see a window with all network adapters.
    • Select the adapter (local area wireless, or whatever it is), open it.
    • in the Properties window, double-click Internet version 4 Protocol
    • then in the new pop - up window, either give the IP address manually, or select "obtain an IP automatically" and "Obtain DNS server automatically.

    If you are not sure what IP address you have to give, then contact your internet service provider.

    Thank you!!

Maybe you are looking for