Help understand the HorizontalLayoutManager and width issues RichTextField

I try to have something like that on the screen (4.7 Simulator as a storm)

Spacer | RichTextField | Spacer

Spacer | RichTextField | Spacer

Spacer | RichTextField | Spacer

Spacer | RichTextField | Spacer

Here's how I'm doing it

HorizontalFieldManager hfm1 = new HorizontalFieldManager();

VerticalFieldManager vfm2 = new VerticalFieldManager();
for (int i = 1; i <= 4; i++) {
  RichTextField rtf = new RichTextField("Hello World " + i);
  vfm2.add(rtf);
}

hfm1.add(new LabelField("!"));
hfm1.add(vfm2);
hfm1.add(new LabelField("!"));

add(hfm1);

This will display

Spacer | RichTextField

and not the desired

Spacer | RichTextField | Spacer

What seems to happen is that the RichTextFields is too long and I don't know how to solve this problem. Does anyone have any suggestions on what I am doing wrong?

I tried getPreferredWidth() substitution, but this isn't all to shorten

for (int i = 1; i <= 10; i++)
{
  RichTextField rtf = new RichTextField("Hello World " + i)
  {
    public int getPreferredWidth()
    {
      return (40);
    }
  };
  vfm2.add(rtf);
}

If it helps, () Display.getWidth Returns 360 without the above substitute in portrait (top-side-to the top).

Any help is appreciated.

Which no longer works, you must force the width of the RichTextField in the sublayout.

Try the following:

    VerticalFieldManager vfm = new VerticalFieldManager();
    HorizontalFieldManager hmanger = new HorizontalFieldManager();
    hmanger.add(new LabelField("!"));
    RichTextField rtf = new RichTextField("Hello World ") {
        public int getPreferredWidth() {
            return 40;
        }
        protected void layout(int arg0, int height) {
            super.layout(getPreferredWidth(), height);
            setExtent(getPreferredWidth(), height);
        }
    };
    hmanger.add(rtf);
    hmanger.add(new LabelField("!"));
    vfm.add(hmanger);
    this.add(vfm);

Also, can I complements the original poster on which gives us a simple piece of code that worked without needing anything else and demonstrated the problem.  I wish that all code messages were similarly brief and precise.

Tags: BlackBerry Developers

Similar Questions

  • Help understand the ERPi and planning

    Hi all

    Planning/Essbase. Version is 11.1.2.

    Can you please help me understand the role of the adapter of the ERPi. I have a hyperion planning that is on an essbase cube. We load the data and metadata for E-Business Suite 11. Forms and reports, I want to break through to the data of the EBS. I have installed and configured the adapter ERPi and ODI scenarios


    Question 1)

    Do I have to load data and metadata extraction for.

    Question 2)
    I put my source and target - systems where can I configure the "Drill Through".

    Thanks in advance for any help offered.

    Let me clarify, you must run the rule metadata ERPi in but you don't need to load the metadata for the application of the EMP. I think that much confusion exists around this point.

  • Need HELP! -The installer and excutable issues

    Hello

    I created a Labview installation program to install an executable file (.exe) on a clean machine, who has no any product of Labveiw, so the executable can run by itself without the evoriment of development. Given that the program needs to use sub - VI DAQmx so I include the engine runtime and DAQmx and everything that makes setup > 1.2 GB. At first everything went well.

    Now, we have to make some minor changes in the source code. My question is, what do I have to redo the installer every time for minor changes? I've seen the system creates several files when I build an executable:

    An .exe file

    A single file .aliases

    A configuration file

    A "Data" folder

    Can I just copy these files to a place so new version of the executable file can run without HAVING to build a new installer which exceeds 1 GB?

    Any help or suggestion is greatly appreciated!

    This is the same process as the regular creation of an installer.

    Way the easiest is probably to copy your existing full installer and then removed the additional installers of the copy and rename your copy as a hotfix.

    (i.e. make sure you just deselect the additional installers of the page indicated on the attached screenshot)

  • help understand the digital and graphical waveforms

    Can someone explain to me how digital waveform working with NOR?

    I did a channel physical and wired to a DAQMx create channel then I have it connected to a NSamp of 1Chan ereading Wfm DAQMx and then wired it to a graph of digital waveforms.

    I put digital and graphical digital waveform playback in a loop.

    When I run it, it seems to me only to get 1 sample on the graph per loop iteration.

    The desired output is to add each digital sample as a function of delay which can connected and or scrolls in time to examine what is happening with the signals.

    Where is my mistake?

    My VI is attached.

    Any help would be greatly appreciated!

    Also another quick question, is there a 'comment' as a command / / c or ' in VB?  Thank you.

    Hi Henry,.

    Thanks for the post! It seems that you are having problems with the acquisition and the graphic representation of digital data using DAQmx and LabVIEW. You are right that the type of program you have returned a single sample every loop iteration, because you make an acquisition without buffer, timed by the software. This means that the program reads a sample for each channel, whenever the DAQmx reading VI is called, which will depend on the speed of the software will run. In addition, when you view this data, the chart will only display data acquired for this iteration of the loop (that is, in this case, a single sample).

    To accomplish what you want will take some extra work and overhead costs in the software, but you can essentially use a shift register and accumulate samples that your program runs. There is a practice done just VI to do this kind of thing with digital signals and is called DWDT Append Digital Signals.vi (this can be found in the palette of functions in respect of programming"Wfm Digital Waveform"). I created a small example which you should be able to run that does this. What actually happens is that the waveform is rewritten each time with new data added in addition to the data passed in. To be able to scroll back and view this data, I turned off automatic scale on the x axis (if it is enabled, it will constantly increase and tries to show all the data at the same time) and selected just a data window to display. In addition, I added a horizontal scroll bar to scroll through the review data.

    And to answer your question about the code comments in LabVIEW, this can be done with a clear Structure of the diagram. You will find this structure in your palette of functions in respect of programming' Structures. Using this structure, you can select a part of your block diagram to disable and switch to the active state of wire through the or add different features that will run. Hope this helps and good luck!

  • Getting help on the camera and nDVD issues

    Have been should I go to get help on nDVD and camera problems.

    Seems that all positions with DVD or camera problems problems get a response.

    Are we in the wrong place?

    If so please direct us to the right place so that we can our problems solved.

    Thanks for your help
    chevywes

    I got something good for you.
    Go to http://community.compuserve.com/n/pfx/forum.aspx?webtag=ws-laptop&redirCnt=1 and I hope to help you.

    Sorry to hear that no one here can help you but I'm afraid that you have misunderstood something.
    This is the forum of users and if you want to have the official statements of Toshiba you're definitely on the wrong place.

    One last thing, if you have the model of cell US will we support page and look for solutions here - http://www.csd.toshiba.com/cgi-bin/tais/su/su_sc_modSel.jsp
    For each known issue, you should find a technical document with explanation and solution.

    Good luck!

  • Help understand the Double billing for the same product on the same account

    Recently, I realized that I make double charge on my account from creative cloud for the same exact items charged to the exact same credit card. In addition, I must say that I had two accounts still somehow. It is because I have lost access to the associated e-mail account and do could not connect. When I talked to Adobe at this time there they notify that I have create a new account with a new email, I did. That being said, every month for almost a year I was charged $31,79 and the new account as well. (I admit I'm not very good about checking all my automatic subscriptions online monthly but supposed to Adobe as a company highly and popular, could do things). I called and the first representative I spoke with today understands the problem and transferred to me for a refund, however once transferred, the representative was not only do not understand but rude and gave me a refund for 6 months. As of today, they canceled the account I have not used and me be charged twice a month for but only paid 6 months more than 12 months of double billing. The representative tried to tell me he was doing me a favor because I wasn't in charge of normal early termination fees. It has become so confusing and so I did at that moment that I said I would get more help here in the forums...

    1. I'm trying to understand why in the world they would even charge me a cancellation fee when I was clearly NOT cancellation of an account, just to make a change, which was made according to the way which they charged me and, of course, who they do not now recognize?

    2. How can I reload the same exact account for exactly the same product with activation of the said product as a single computer, and no other user (not to mention that I just used the product)?

    Any help or advice would be appreciated!

    All first of all my apologies for the not so pleasant experience.

    The Adobe ID here in the forum has a CC bought in March 2016 with no cases registered.

    I understand that this is for another subscription CC, could you please me message in private closed, the file number or the number of order which you have been invoiced in duplicate.

    I can probably follow that.

    Concerning

    Stéphane

  • The height and width settings no longer work.

    Adobe Photoshop CS5 settings went crazy in the canvas size box.  Everything appears as 0, whether inches, pixels, etc.  I tried to enter numbers instead of the zeros in the height and Width boxes, and then it creates huge margins around the image.  If I cut the number in half to try to mislead the it, it still gives big margins instead of cropping the image.  Help!

    Looks like you have Relative checked in the canvas size dialog box.

  • Get the height and width of an image

    I have therefore some images in my program that I'm loading. These images are much longer than the size of the screen. So I put in a ScrollView. My question is how can I get the height and width of an image. The image.width and image.height doesn't return the correct values.

    //add the image
    private function addImage():Container {
        var sp1:Container = new Container();
        sp1.sizeUnit = SizeUnit.PIXELS;
        sp1.debugColor = 0xFFFFFF;
        sp1.margins = Vector.([1,0,0,0]);
        sp1.align =ContainerAlign.NEAR;
        //sp1.setSize(650, 800);
    
        var myPattern:RegExp = / /g;
        var fileName:String = "./com/swiz/img1.png";
        var icon:Image = new Image();
        icon.setImage(File.applicationDirectory.resolvePath(fileName).url);
        //icon.setPosition(0,0);
        //icon.setSize(320,800);
        sp1.addChild(icon);
        sp1.setSize(650, icon.height);
    
        return sp1;
    }
    

    and my code scrollview is

    //add to the scrollView
    var scroller:ScrollPane = new ScrollPane();
    scroller.width = 650;
    scroller.height = 505;
    scroller.y = 0;
    scroller.addScrollContent(addImage());
    addChild(scroller);
    

    Thanks in advance!

    Hey shethab,

    in order to retrieve the height and width of your image, you must use use the an event listener on your image and check for the Event.COMPLETE event. What is happening because the image you upload is not built, it takes time to load into your application using the setImage() method. and when you check the width height after the setImage method, the image was not loaded and has no height and width to this second. If you use the event listener, you can retrieve the height and width as it was finally loaded.

    Try the following code:

    import flash.events.Event;
    
    //add the image
    private function addImage():Container {
        var sp1:Container = new Container();
        sp1.sizeUnit = SizeUnit.PIXELS;
        sp1.debugColor = 0xFFFFFF;
        sp1.margins = Vector.([1,0,0,0]);
        sp1.align =ContainerAlign.NEAR;
        //sp1.setSize(650, 800);
    
        var myPattern:RegExp = / /g;
        var fileName:String = "./com/swiz/img1.png";
        var icon:Image = new Image();
        icon.setImage(File.applicationDirectory.resolvePath(fileName).url);
        icon.addEventListener(Event.COMPLETE, onImageLoaded);
        //icon.setPosition(0,0);
        //icon.setSize(320,800);
        sp1.addChild(icon);
        sp1.setSize(650, icon.height);
    
        return sp1;
    }
    
    private function onImageLoaded(e:Event):void
    {
        trace("image height: " + e.target.height + " image width: " + e.target.width);
    }
    

    hope that somethings brightened. Good luck!

  • Get the height and width of the jpg or png of bitmap without loading the file

    Is there a way to get the height and width of a bitmap, such as jpg or png file, without loading the complete file of the image first.

    Thank you!

    Hi JamesColeman,

    While you can't get the width and height of the jpg or png without access to the file, you can get this information without access to the entire file. A PNG for example (in raw hex) indicates the width and height of the image it contains. The first 21 bytes contain the file-specific information such as name, etc, but just after the IHDR header 4 bytes indicate the width and the other 4 bytes indicate height. If enough for you to read the first 29 bytes of the PNG to be able to get its dimensions, which, while it still requires access to the file is much easier.

    I have the code to read this information here and if you want to learn more about the specifications you can find information on this site.

    Best wishes

    André

  • get the height and width of the screen in QML?

    How to get the height and width of the screen in QML?

    Please search the forums before you make a new post. This post is still on the first page... http://supportforums.BlackBerry.com/T5/Cascades-development/correct-way-to-get-display-width-height-...

  • show the height and width of the screen

    Is it possible to display the height and width of the screen in a labelfield?

    Yes. To do this, ask yourself two questions:

    (1) is it possible to display a string that I want in a LabelField? (The answer is Yes)

    (2) is it possible to set the height and width of the screen in a string? (The answer is Yes)

    (3) is it possible to find the height and width of the screen? (The answer is Yes)

    Now, just try to find how to do it ask these three questions. #1 is right there in the documentation for class, LabelField . #2 is trivial if all goes well. # 3, take a look in the view class.

  • How to set the height and width of dvt:piechart?

    Hello

    After upgrading to 10.1.3 jdev the new PIE is < dvt:pieChart >.

    I need to set the width and height or if not possible set the height and width of the container and let the repeating table using the container.

    Thanks in advance

    Emile BITAR

    Change this by using the attribute "inlineStyle". Set inlineStyle = "width: 200px;" height: 300px; »

  • I have customized a widget and want to reuse on another page. How save, copy or reproduce them? With the help of the iMac and Muse 2015

    I have customized a widget and want to reuse on another page. How save, copy or reproduce them? With the help of the iMac and Muse 2015

    You can just copy/paste the enchilada itself on another page, pretty easy!

    If you want to reuse more often, you can open the library or libraries CC , to store and later hanging out once again. Note: for the creation of an article in the 'old' library, you must select the element on the page and click on the new icon in the " library " window To create an element of CC libraries , you can simply drag something in and out of the window libraries CC .

  • What is the best way to resize an image, but keep the height and width of the same original size or format?

    What is the best way to resize an image, but keep the height and width of the same original size or format?

    I tried to use the function of the size of the Image, but when I changed the size of the image, the width has not changed with it.

    Thanks for the tips!

    Hi Landon.Luu,

    You want to keep the relationship between the width and height to be the same?

    Click the constraint between width and height to keep the ratio intact.

    Kind regards

    Claes

  • Does anyone know the height and width that a dreamweaver layout grid can go?

    Does anyone know the height and width that a dreamweaver layout grid can go? (in pixels)

    To try:

    {body

    height: 36000px;

    Width: 40000px;

    }

    Nancy O.

Maybe you are looking for

  • NSImage as NSData TIFFRepresentation

    This line: imageData the current value of the application the NSData alloc (target TIFFRepresentation) initWithData_ .. .causes a mistake to me. target is an NSImage. What should I change? The error I get is: 2016-07-12 10:28:10.713 ImageOverwriteTes

  • M30-404 freezing after 60 sec

    Hello I bought a second hand M30 which is defective.If I start the windows machine does not start normally and after the desktop appears the system freezes and blocks (no response). If I go back now, it will freeze again - but now on windows startup

  • MY PC FREEZE FOLLOWING A MESSAGE RECEIPT FROM MICROSOFT VISUAL C++ RUNTIME LIBRARY THE PROBLEM IS THE FOLLOWING / C: /

    Why my pc no longer works as before, following a message received from MICROSOFT VISUAL ++ message is the following: "we are changed, an error etc..." of it is without doubt that they believed I was a business while I'm just an old lady of 68 years w

  • Where and how to get the downgraded version iSCSI initiator?

    Is there a place for older versions of the microsoft iSCSI initiator? We are trying to install a piece of legacy equipment and the last confirmed the version that has been tested is V1.05a Kind regards Drew

  • Note to retrieve deleted from the sidebar

    I used the sidebar notes to record the special circumstances of my billing.  I inadvertently deleted one of my notes.  How can I cancel this delete operation?  Would this note have been saved by Carbonite?