Label field

Hello

I need a label field that when clicked should push a new screen. So I wrote a label custo field but am not able to understand how to perform the action.

I write the code below, please tell me where I'm wrong.

It's the customlabelField

/ public final class CustomLabelField extends LabelField {}
public m_cKeyListener KeyListener;
Private GlideApplication _app.
String strCheckInURL ="";
private int horMargin = 8; final int innerMargin = 5; / / Adding dembele January 11 for more details
private police objBigFont = Font.getDefault () .derive (Font.BOLD, 23); Are subject
private police objMediumFont = Font.getDefault () .derive (Font.BOLD, 17); Are subject
private police objSubTitleFont is Font.getDefault (.derive(Font.BOLD,16));.
private police objSmallFont = Font.getDefault () .derive (Font.BOLD, 13); Are subject
final int fieldWidth = ((Display.getWidth (-(horMargin*3))) > 1);

public interface KeyListener {}
public abstract void PerformAction (CustomLabelField pCustomLabelField);

}
Public Sub paintBackground (Graphics g)
{
XYRect xyrect = this.getExtent ();
g.setFont (objSubTitleFont);
g.setColor (0x0060AAF0);
g.fillRect (0, 0, xyrect.width + 450, xyrect.height + 450);
g.setColor (Color.DARKGRAY);
g.drawLine (0, 0, xyrect.width, 0);
g.setColor (Color.WHITE);
g.drawText ("more details", innerMargin, (xyrect.height > 1)-(objSubTitleFont.getHeight () > 1) ');
g.drawText (' > ', (xyrect.width - objSubTitleFont.getAdvance (">")-innerMargin), (xyrect.height > 1)-(objSubTitleFont.getHeight () > 1));
}
Protected Sub layout (int width, int height) {}
width = fieldWidth;
Height = objSubTitleFont.GetHeight () + 14;
Super.Layout (width, height);
super.setExtent (width, height);
}

public void SetKeyListener (KeyListener pKeyListener) {}
m_cKeyListener = pKeyListener;
}
{public boolean trackwheelClick (int status, int time)
Boolean lRetVal = false;
If (null! = m_cKeyListener) {}
TSTC objAirportInfo = new FlightInfo();
_APP.pushScreen (objAirportInfo);
m_cKeyListener.PerformAction (this);
lRetVal = true;
}
return lRetVal;
}
}

and this cusomlabel, I add in another page, the code for this is also attached below,

Please tell me if I am wrong anywhere, I'm new to the blackberry development, for help, it's urgent. Thank you in advance.

VerticalFieldManager vfmMoreDetails = new VerticalFieldManager();
CustomLabelField lfAirportInfoMoreDetails = new CustomLabelField();

HorizontalFieldManager hfmRow2 = new HorizontalFieldManager (Manager.HORIZONTAL_SCROLL);

hfmRow2.add (lfAirportInfoMoreDetails);

hfmRow2.setMargin (0,0, 0, 15);

SF SpacerField = new SpacerField (0.20);

hfmServices.setMargin ((subTitleFont.getHeight ()) + (bigRowSpace * 3), 0, 0, 0);
vfmServices.add (hfmServices);
vfmServices.setMargin (0, 0, 0, 15);
vLayout.add (vfmServices);
vLayout.add (sf);
vLayout.add (hfmRow2); tmp commented
Add (vLayout);

My requirement is clicked, the label field, more details, will take you to a new screen flight info.

Please help me

Hi, thanks friends, I could implement the listener of the field with the code below, and less when I removed sublayout and changed the layout, he began to work, here are the labour code

LabelField lfMoreDetails = new LabelField "(more Details", Field.FOCUSABLE)
{
protected void paintBackground (Graphics g)
{
XYRect xyrect = this.getExtent ();

g.setColor (0x0060AAF0);
g.fillRect (0, 0, subTitleFont.getHeight () + 350, subTitleFont.getHeight ());
g.setColor (0xffffff);
g.setColor (0xffffff);
g.setFont (subTitleFont);
int y = bigRowSpace;
g.drawText ("more details", 10, y, Graphics.ELLIPSIS, xyrect.width-(10 + 10) ');
g.drawText (' > ', (xyrect.width - objSubTitleFont.getAdvance (">")-innerMargin), (xyrect.height > 1)-(objSubTitleFont.getHeight () > 1));
y += (subTitleFont.getHeight ()) + (bigRowSpace * 2);
}
protected void layout (int width, int height)
{
width = Display.getWidth ()-(10 + 10);
height = serviceSectionHeight;
setExtent (width, height);
}

protected boolean navigationClick (int final status, time final int) {}
net.rim.device.api.ui.UiApplication.getUiApplication () .pushScreen (new FlightInfo());

fieldChangeNotify (0); / / See the difference here.
Returns true;
}

};
lfMoreDetails.setChangeListener (this);

Tags: BlackBerry Developers

Similar Questions

  • Label field do not align right

    Hello

    The label field is not aligining to the right. Here is my code

    Container {
                            id:database_search_top_container
                            leftPadding: 20.0
                            rightPadding: 20.0
                            preferredHeight: 110.0
                            preferredWidth: 720//displayInfo.pixelSize.width
                            background: recent_container_bg.imagePaint
                            verticalAlignment: VerticalAlignment.Fill
                            horizontalAlignment: HorizontalAlignment.Fill
    
                            layout: StackLayout {
                                orientation : LayoutOrientation.LeftToRight
                            }
                            Label {
                                verticalAlignment: VerticalAlignment.Center
                                horizontalAlignment: HorizontalAlignment.Right
                                id:recent_label_name
                                objectName:"recent_label_name"
                                preferredWidth: 720//displayInfo.pixelSize.width
                                preferredHeight: 110.0
                                text:"Dummy Data"
                                textStyle.color: Color.White
                                textStyle.fontSize: FontSize.Large
                            }
    
                        }
    

    There is a bug in the API. But you can align it to the right this way.

    Container {
        id:database_search_top_container
        leftPadding: 20.0
        rightPadding: 20.0
        preferredHeight: 110.0
        preferredWidth: 720//displayInfo.pixelSize.width
        background: recent_container_bg.imagePaint
        verticalAlignment: VerticalAlignment.Fill
        horizontalAlignment: HorizontalAlignment.Fill
    
        layout: StackLayout {
            orientation : LayoutOrientation.LeftToRight
        }
        Label {
            verticalAlignment: VerticalAlignment.Center
            horizontalAlignment: HorizontalAlignment.Right
            id:recent_label_name
            objectName:"recent_label_name"
            preferredWidth: 720//displayInfo.pixelSize.width
            preferredHeight: 110.0
            text:"Dummy Data"
            textStyle.color: Color.White
            textStyle.fontSize: FontSize.Large
    
            layoutProperties: StackLayoutProperties {
                spaceQuota: 1.0
            }
            textStyle.textAlign: TextAlign.Right
        }
    }
    
  • Highlight a text of label field

    Hello

    I have a label field that is added inside the VerticalFieldManager I have set the length and height of the label field in which area I want to display the text.

    now, I want my text to scroll inside the labelfield.

    Here is my code please help...

    VerticalFieldManager vf = new VerticalFieldManager (Manager.VERTICAL_SCROLL);

    LabelField history = new LabelField (story_data.elementAt (0) m:System.NET.SocketAddress.ToString (), FIELD_HCENTER |) FOCUSABLE) {}
    {} public void paint (graphics net.rim.device.api.ui.Graphics)
    graphics.setColor (Color.BLACK);
    graphics.setFont (net.rim.device.api.ui.Font.getDefault () .derive (net.rim.device.api.ui.Font.BOLD, 10));
    Super.Paint (Graphics);
    }
    Protected Sub layout (int width, int height) {}
    Super.Layout (width, height);
    this.setExtent ((MyApp.width) - 30, 300);
    }
    };
    story.setBackground (BackgroundFactory.createSolidBackground (Color.WHITE));
    story.setMargin (10, 15, 15, 15);
    story.setPadding (5, 5, 5, 5);
    story.setFont (Resize.getFirstFont ());
    VF. Add (Story);
    VerticalFieldManager temp = new VerticalFieldManager();
    Temp.Add (VF);
    Add (temp);

    Thanx

    Thanks peter... my problem is solved... Here's my code for update... VerticalFieldManager vf = VerticalFieldManager(Manager.VERTICAL_SCROLL | nouveau Manager.VERTICAL_SCROLLBAR |) Manager.VERTICAL_SCROLL_MASK | Manager.VERTICAL_SCROLLBAR_MASK) {' protected void sublayout (int width, int height) {super.sublayout (width, height); this.setExtent ((MyApp.width)-20, (MyApp.height)-(MyApp.height)/4) ;}};}} LabelField history = new LabelField (story_data.elementAt (0) m:System.NET.SocketAddress.ToString (), FIELD_HCENTER) {public void paint (graphics net.rim.device.api.ui.Graphics) {graphics.setColor (Color.BLACK); super.paint (graphics) ;}};} story.setBackground (BackgroundFactory.createSolidBackground (Color.WHITE)); story.setMargin (10, 15, 15, 15); story.setPadding (5, 5, 5, 5); story.setFont (Resize.getSecondFont ()); VF. Add (Story); Add (VF);

  • Highlight a label field.

    I have a label field on a screen that can hold a large amount of text which will disappear from the screen, how can I make cela scrollable?

    I tried to put the label in a VerticalFieldManager, but without success.

    Thank you

    First of all, please learn how to use the search box on the top of the screen.  If you are looking for 'LabelField' returned this thread as the first among others:

    LabelField Scrollable

    The thread gives a solution similar to swati srivastava's.  morpheusghost gives a slightly different resulting in almost the same visual appearance.

    However, none of these solutions is perfect.

    If the text in the field is greater than 2 screens (or the field Heights), jumping from the beginning to the end (that's what happens when divert you attention from the NullField first to the last NullField) never allow see her in the middle of your LabelField.  Consider using a TextField for longer texts.  Make it FOCUSABLE and READONLY and add it to a VerticalFieldManager with VERTICAL_SCROLL (and possibly VERTICAL_SCROLLBAR).  TextField and his descendants may have the focus within the field (the cursor).  That's how you let the user scroll.

    Otherwise, you can have no field focusable and manage the movements of navigation, using setVerticalScroll of the VerticalFieldManager containing your LabelField.  But that would require more code and is less intuitive.

  • Custom label field - extended definition

    Hello

    I have a problem defining the scope for a custom field. I replaced the method of layout and setting, the width of the text in a horizontal field Manager.

    Custom fields are twice the width of how wide I give in the setExtent methods and layout. Kindly help me to fix it on.

    Thanks in advance.

    Hi SenthilKumar,

    Actuall problem not in the setExtend method. It's in the paint method. For highlighting and displaying the text, you used getLeft() for x position. For your information getLeft() will give the left most pixel of this field. It will not be 0.

    In your case:

    1st label displayed correctly because the method getLeft returns 0 because it was the first field in the Manager.

    2nd label was the real problem. When you call the getLeft method, it returns 65 (since the getLeft method generally returns the fields left in the (parent) Manager position), which you took as position x ie., you try to start the drawing of the 65th pixel not from 0th field of pixel (pixel 65th Manager (parent)). So overall, it seems that the 1st field of list took 130 pixels but it is false. Your painting is not correct, still you have 65 black pixels.

    Please use the following code

    protected void paint (Graphics graphics) {}
    Draw the background
    graphics.setColor (isFocus ()? _bgcolorFocus: _bgcolor);
    graphics.fillRect (0, 0, getWidth(), getHeight());

    Draw text
    graphics.setColor (isFocus ()? _fgcolorFocus: _fgcolor);
    graphics.drawText (_text, 0, 0);
    }
    It works perfectly

  • Label - field - Board labels

    Hi all

    JDev 11.1.1.5.0 & 11.1.1.6.0

    We want to build a set in page where we once again a label, the field, and then on a label.
    Ex: Max duration < field > years
    Must see this in formatting, where we have different areas. Some of them have this second label, others not.
    The farm I can uses a panellabelandmessage tag to include the second label.
              <af:panelLabelAndMessage label="Max Duration" id="plam1" showRequired="true">
                <af:inputText id="it5" required="true" showRequired="false"/>
                <f:facet name="end">
                  <af:outputLabel value="years" id="ol1"/>
                </f:facet>
              </af:panelLabelAndMessage>
            </af:panelFormLayout>
    The problem arises with the required fields. We can define the attribute showRequired of the panellabelandmessage to true, and that of the inputText to false.
    But whenever the required of the inputText property is set to true, the required icon is always shown, even if the showRequired is set to false.
    This makes the required icon is displayed twice.
    How can hide us the required icon of the inputText field?

    What are the possible solutions for this situation?

    Thank you in advance.

    Filip Huysmans.

    Filip,

    the following custom skin entry removes the icon required all input text labels so that they are defined on the component panelLabelMessage only

    AF | inputText::label. AFRequiredIconStyle {display: none}

    If you need to have more control, you can add a property styleClass as shown below

     
                
                
                  
                
              
    

    In this case, the following skin only removes this

    .noRequiredIcon af | inputText::label. AFRequiredIconStyle {display: none}

    If you need more dynamic event, use EL to set the styleClass value.

    Frank

    PS. : Is the question you may ask: why should I add the af | inputText::label to the skin if the style class determines the instance? The advantage you get from this is that it is the longets match, which means that if there are other components (no text input) that have similar requirements, you can manage them individually

  • How to remove the option of manufacturer brand label in the owner of the label field in the Specs trade?

    I am trying to remove this label of brand manufacturer of the label options.

    PLM for process 6.1.1.5

    I know it is a default option in the version, but I can add the code for that?

    It is impossible to change the status of the Label Owen in ADMN, but you can run the following against your DB to set the status "Brand manufacturer label" to archive. Then, it will not appear in the options for labels.

    update the status for all language IDS

    Update gsmLabelOwner

    set status = 4

    where pkid = "21590A066F8F-6978-4363-B1AC-58C7F52B597C.

    Important notice: Please backup your DB before that you were trying above solution.

    And there may be some potential risks (I am clearly not currently). So please save this change. In the future, you encounter some problems on Label owner maybe we could talk.

  • Pop-up menu is coming to press the long of the label field

    I have a screen where I have a clickable labelfield. For this I am the touchEvent() substitution. Now on the screen, I add two menus. So when I touch the labelfield for a long time, it shows the pop-up menu with these two menu that I don't want. How to hide this pop-up menu?

    This happens as I'm back super.touchEvent () for (overridden) method of key event.

    Help, please.

    I changed the code from menu addition like that and it works:

    public void makeMenu( Menu menu, int instance )
        {
            super.makeMenu( menu, instance);
    
            if(instance == Menu.INSTANCE_DEFAULT)
            {
                 menu.add(new MenuItem("xxx", 1, 1) {
                    public void run() {
    
                    }
                }); 
    
                 menu.add(new MenuItem("yyy", 2, 2) {
                    public void run() {
    
                    }
                });
            }
    
        }
    

    This line makes the difference here:

    if(instance == Menu.INSTANCE_DEFAULT)
    
  • Dial a number in a label field

    Hello

    I am currently developing an app for my blackberry. I have a labelfield:

    myLabelField6 = new LabelField("01226 211 211", LabelField.FOCUSABLE);
    

    which displays a phone number. Could you help me please by allowing this phone number be clicked on and then call the number?

    Any help on that would be great

    Thank you

    Ash

    as the method is part of the labelfield class, you can use its methods, simply call getText to retrieve the text.

  • Publish in the title bar and scroll field label

    Hi all

    I have a title bar and just below that I have a label field, I am facing a problem like as and as I scroll the lable field 'timezoneTitle' is not visible. His only visible when I scroll to the top. I want to keep it fixed even if the user scrolss up and down, how to handle this?

    LabelField title = new LabelField ("Welcome", LabelField.FIELD_RIGHT);

    HFM. Add (title);

    zone title
    LabelField timezoneTitle = new LabelField ("", LabelField.ELLIPSIS)
    | LabelField.USE_ALL_WIDTH | LabelField.FIELD_HCENTER) {}
    {} public void paint (Graphics graphics)
    graphics.setColor (Color.WHITE);
    graphics.setBackgroundColor (Color.BLUE);
    Graphics.Clear;
    Super.Paint (Graphics);
    }
    };

    setTitle (vm);

    Add (timezoneTitle);

    I'm not sure that I understand the question, or that the code you provided is complete, but if my interpretation is correct, then try this

    VFM VertticalFieldManager = new VerticalFieldManager();

    LabelField title = new LabelField ("Welcome", LabelField.FIELD_RIGHT);

    VFM. Add (title);

    zone title
    LabelField timezoneTitle = new LabelField ("", LabelField.ELLIPSIS)
    | LabelField.USE_ALL_WIDTH | LabelField.FIELD_HCENTER) {}
    {} public void paint (Graphics graphics)
    graphics.setColor (Color.WHITE);
    graphics.setBackgroundColor (Color.BLUE);
    Graphics.Clear;
    Super.Paint (Graphics);
    }
    };

    VFM. Add (timeZoneTitle)

    setTitle (vm);

    If this does not solve you problem, and in fact even if it is the case, I recommend that consult you this:

    http://supportforums.BlackBerry.com/T5/Java-development/MainScreen-explained/Ta-p/606644

  • How to remove the focus from the field of the custom label

    Hello

    I have a question on the subject to focus on fields. I did a registration form and added a label + image and text box on a vertical field Manager. but when I scroll through image and text box get the focus and disappear from my label.
    I took the custom label field and the custom text box.
    Help, please...

    protected void drawFocus(Graphics graphics, boolean on){paint(graphics);}
    
  • Label, change the field and the button on the problem of a line

    Hi all

    I was pulling my hair out on this and could really do with some tips. I'm putting a label, a text field and a button of bitmapfield on the same line, but for the life of me I can't work that way round. If I put the front button to the text box field, it works.

            // TEST 3 CONTROLS ON A ROW
    
            final Bitmap imgCalc = Bitmap.getBitmapResource("bgCalc.png");
    
            LabelField lb = new LabelField("0.00");
            EditField ef = new EditField();
            BitmapField  bf = new BitmapField(imgCalc, BitmapField.FOCUSABLE){
                protected void paint(Graphics g) {
                    // Draw text on button image
                    super.paint(g);
                    g.setColor(Color.WHITE);
                    int x = (40 - Font.getDefault().getAdvance("Go"))/2;
                    int y = (imgCalc.getHeight() - Font.getDefault().getHeight())/2;
                    g.drawText("Go", x, y);
                }
    
                public int getPreferredWidth(){
                    return 40;
                }
            };
    
            HorizontalFieldManager row0 = new HorizontalFieldManager();
    
            row0.add(lb);
            row0.add(ef);
            row0.add(bf);
    

    Excuse the code, but it's test code to make it work. As mentioned above, if I add that Label, Edit, Bitmap controls it only shows the label field and edit. If I swap the text field and the field bitmap around so that the text field is the last one, it works.

    What I am doing wrong?

    Thanks for looking

    Paul

    EditField always takes all of the width available to it.

    You must override its layout (width, height) and pass below the width values to leave space for the BitmapField. Something like

    protected void layout(int width, int height)
        {
            super.layout(width * 60 / 100, height);
            // sets width of this field to 60% of the total available width
        }
    

    would do.

  • Different thread field label update

    Hello

    I need to update the label on a buttonfield.  It's pretty simple to do when it is selected.  The problem is this: I want to trigger a web update, which runs on its own thread.  When the update is complete, I need to change the label field once again, this time by the new thread (which makes the update).

    I could be missing something really simple here. Any help would be appreciated.

    In General, you get eventlock of the application when you perform the update of the screen.

    for example:

    Thread t = new Thread (new Runnable()

    {

    public void run()

    {

    updateLabel();

    }

    });

    Private Sub updateLabel()

    {

    {Synchronized (application.getEventLock)}

    mybutton.setText ("new Text");

    }

    }

    Cheers.

  • Listeners of change of the field on the label

    Hello

    I get a list of objects from json url and display as a list by adding a label field and a separator. Now I want each clickable label so that each label makes a redirect to a separate url. By clicking on the label a separate screen should open with the corresponding url json data. So, can anyone tell me how to get there. I wil be really grateful if I get sample code showing how do... An example of code here that I did...

    public VerticalFieldManager showShoppingList(){
            try {
                jsArrShpList=new JSONArray(strShopping);
                totalList= jsArrShpList.length();
                for(int i=0;i			 
    LabelField shops  = new LabelField(shoppingList);
    shops.setFieldChangeListener(this);
    

    What should you index? The index of the field in the vfmShopList?

    Because you must implement fieldChanged in your class for the FieldChangeListener interface, you will always have a reference to the field when it is called.

    You can check if the field is not type labelField and then cast and check the text and do any action on this basis.

    In addition, could keep track of all LabelFields secondary data structure as has been pointed out by Simon.  This can be useful if you also another LabelFields on the screen so that you do not act on a LabelField which should not have any action associated with it.

  • Hide a field label

    Hi, anyway is to hide a field label.

    I have a combo with a variety of types of numbers (license, health and security # etc.) I have an empty field next to the drop-down list.

    Type of number no matter what you choose, a label appears next to the empty field, indicating the choices you make.

    So in the box to the far right, the text authorization number should appear.

    Untitled-2.gif

    Ok. You can use a validation script custom in the 2nd drop-down list that looks like the following:

    Script to Validate drop-down list

    (function () {}

    Get a reference to the label field

    var f = getField ("LABEL1");

    Show/hide the label based on the drop-down list selection

    f.Display = event.value = "click to see the options"? Display.Hidden: display.visible;

    })();

    but replace "Label1" with the actual name of the field that you are using for the text of the label.

    This last line is equivalent to the following:

    If (event.value = 'Click to see the options') {}

    f.Display = display.hidden;

    } else {}

    f.Display = display.visible;

    }

    All this could be simplified to the following single statement:

    getField("LABEL1").display = event.value = "click to see the options"? Display.Hidden: display.visible;

    It is better if you select the 'Value selected to validate immediately' option to the drop down list. For the field, it set read-only and set the default value for the text of the label.

Maybe you are looking for

  • My Satellite L30-10 s does not work

    My 10V L30-lappy PSL33E worked very well - off and unplugged for two weeks - in setting in motion the lappy that all the lights work but I get nothing on the screen - any help or idea would be appreciated.

  • How to backup iPad 4th generation to iCloud

    How to make a backup of music on my iPad 4 to iCloud to make more room on my iPad

  • Clip plays radio but not MP3

    Help! The radio works fine, when I try to play a MP3 song, the song appears in the display, pause/play button works, but when I hit the round central key I pass the diagonal lines low thte. (I downloaded the fileware this morning). avds, please... Th

  • sfc scannow, returns with corrupted files.

    I've posted this before, but I'm having a problem yet. I found where I can put my laptop a (Asus K54C) back to the factory settings. Type just F9 at reboot, and it takes two clicks to reinstall a cliché of the BINGO OOTB (out of the box). It's just t

  • Windows 7 Ultimate 64 bit version won't complete installation

    This one is makes me crazy, everything first, here are the specs of the system on which I'm trying to install Windows 7 Ultimate 64 bit version: Core 2 Extreme QX9650 Gigabyte GA-X48T-DQ6 Patriot Viper 4GB DDR3 1800 Dual Channel Kit Gigabyte GV - R48