How can I avoid hard coding this width?

I have something like this:
<s:SkinnableDataContainer
                              width="200"
                              itemRenderer="MyItemRenderer"
                              dataProvider="{ dp }">
If I have 4 items each 50px wide, I would set the width to 200px.
However, I want to avoid hardcoding the width.
How can I extract the width from the item renderer?

You might want to try not setting a width and setting requestedColumnCount on the layout instead.
<s:List>
    <s:layout>
        <s:HorizontalLayout requestedColumnCount="2" />
    </s:layout>
    <s:dataProvider>
        <s:ArrayList>
            <fx:String>0000</fx:String>
            <fx:String>1000</fx:String>
            <fx:String>2000</fx:String>
            <fx:String>3000</fx:String>
        </s:ArrayList>
    </s:dataProvider>
</s:List>

Similar Messages

  • How can I avoid hard-coding this where clause in the inner select?

    This is extremely fast, but I have to hard-code the inner-most where clause, and I obviously can't do that. I know how to work-around it by creating a function that takes the CUSTOMER_ID and returns the ORDER_ID from the most recent payment, and that's reasonably fast, but I thought it would be worthwhile to see if there was a way to do this in straight SQL. I also know that better design could make the problem go away.
    Very much appreciate it if you could take a look and let me know if there's any way to get this kind of performance without hard-coding.
    Thanks,
    create or replace view customer_view as
    select customer.customer_id,
              customer.customer_name,
                   select t.order_id
                        from (
                                  select payment.order_id
                                       from payment
                                       where payment.customer_id = 1 -- <-- Here's the line where I'm hard-coding the customer_id. Is there any way to reference the customer_id without hard-coding this?
                                       order by payment.payment_date desc
                             ) t
                        where rownum = 1
              ) as latest_order_id
         from customer
    select * from customer_view where customer_id = 1; <-- I want that inner-most select to use this customer_id, without having to hard-code it.

    Hi Matt,
    Something like this could be a possibility (Not tested)
    create or replace view customer_view as
      select customer.customer_id,
             customer.customer_name,
             (select min (t.order_id)
                       keep (dense_rank first order by payment.payment_date desc)
              from   payment
              where  payment.customer_id = customer.customer_id)
               as latest_order_id
      from   customer;Regards
    Peter

  • How to avoid hard coding in Programming

    Hi,
    For preparing a Sales report we need to fetch Excise, Tax and
    Education cess.
    While doing the programming condition types of excise, tax and education cess were given to technical consultants.
    It is like hard coding the programming. In future if a new condition type is created then it wont be calculated.
    What are the ways to avoid hard coding?
    regards,
    sathya

    You can create a Z-Table that you are using for referencing your data e.g. condition type. This way this is customizable.
    In a project I worked before we even had a more sophisticated way for avoiding hardcoding. We had one generic table including Program name, "Function to be exextued" (e.g. determination of condition) and the key value. And we had a function module reading these parameters from the gerneric table. Everytime you would need a specific value from this table you called this table via the function module.This way you had a customizable table and no more hardcoding was needed, the function module provided you with the values.

  • How can I convince iTunes that this is the same machine to avoid installing all my iPod Touch Apps?

    I've had to rebuild my hard drive and reinstall all the software. What a pain.Now iTunes wants to tell me that I am re-syncing from a new machine and wants to reinstall all of my Apps. It is the same machine, and all the Apps show up in iTunes that are on my iPod Touch. I do not want to have to reinstall all of the iPod Apps and try to restore all of their data. How can I convince iTunes that this is NOT a different machine?

    If you are using iTunes version 7 or later, then you can transfer purchased iTunes store music from the iPod to an authorized computer by using the "file/transfer purchases from iPod" menu. Note that the maximum of 5 authorized computers applies here.
    For all other non purchased music (your own CDs etc) try this method which works on some Windows PCs.
    Enable your iPod for disk use.
    See: iPod Disk Use.
    Open iTunes and select edit/preferences/advanced/general. Put a check mark in the box marked "copy files to iTunes music folder when adding to library" and also "keep iTunes music folder organized", then click 'ok'.
    Connect the iPod whilst holding down the shift/ctrl keys to prevent any auto sync, and if you see the dialogue window asking if you want to sync to this itunes library, click 'no'.
    Then go to file/add folder, open 'my computer', select your iPod and click 'ok'.
    The music files should transfer to your iTunes.
    If this doesn't work (and it may not because officially it's not supposed to), check out the instructions/suggestions here.
    Music from iPod to computer (using option 2). This a manual method using "hidden folders" and although it works, it can be messy.
    Much easier ways are to use one of the many 3rd party programs that copy music from the iPod to the computer.
    One of the most recommended is Yamipod. This is a free program that transfers music from iPod back to the computer. However, it does not transfer playcounts/ratings etc.
    Another free program is Pod Player.

  • When I create an email signature, the text I type is repeated twice in the actual email sent (above and below a line).  How can I avoid this?

    When I create an email signature, the text I type is repeated twice in the actual email sent (above and below a line).  How can I avoid this?

    Try validating your installed fonts and fixing any errors that show up. To do this see this article: http://reviews.cnet.com/8301-13727_7-20085570-263/safari-in-os-x-lion-replacing- text-with-block-a-characters/

  • I have some chrages on my debit card by error how can i avoid this charges

    i have some charges in my debit card by error how can i avoid this charges.... i reset my password as an email said with that resert the charges won´t be reflected in my account?

    See Recover your iTunes library from your iPod or iOS device.
    tt2

  • I am trying to make a iphoto book but every time i click on a single photo or folder it opens up a new book. How can I avoid this? This is iphoto 10.

    I am trying to make a iphoto book but every time i click on an individual photo (or folder) it opens up a new book. How can i avoid this?

    Export the slideshow out of iPhoto as a QT movie file via the Export button in the lower toolbar.  Select Size = Medium or Large.
    Open iDVD, select a theme and drag the exported QT movie file into the open iDVD window being careful to avoid any drop zones.
    Follow this workflow to help assure the best quality video DVD:
    Once you have the project as you want it save it as a disk image via the File ➙ Save as Disk Image  menu option. This will separate the encoding process from the burn process. 
    To check the encoding mount the disk image, launch DVD Player and play it.  If it plays OK with DVD Player the encoding is good.
    Then burn to disk with Disk Utility or Toast at the slowest speed available (2x-4x) to assure the best burn quality.  Always use top quality media:  Verbatim, Maxell or Taiyo Yuden DVD-R are the most recommended in these forums.
    If iDVD was not preinstalled on your Mac you'll have to obtain it by purchasing a copy of the iLife 09 disk from a 3rd party retailer like Amazon.com: ilife 09: Software or eBay.com.  Why, because iDVD (and iWeb) was discontinued by Apple over a year ago. 
    Why iLife 09 instead of 11?
    If you have to purchase an iLife disc in order to obtain the iDVD application remember that the iLife 11 disc only provides  themes from iDVD 5-7.  The Software Update no longer installs the earlier themes when starting from the iLIfe 11 disk nor do any of the iDVD 7 updaters available from the Apple Downloads website contain them. 
    Currently the only sure fire way to get all themes is to start with the iLife 09 disc:
    This shows the iDVD contents in the iLife 09 disc via Pacifist:
    You then can upgrade from iDVD 7.0.3 to iDVD 7.1.2 via the updaters at the Apple Downloads webpage.
    NOTE:  If you're running iPhoto 9.5 the export options will be different.
    OT

  • I have loaded and reloaded Reader 9.  I cannot open a pfd document.      I can save it to desk top then open it via a drop down box that has a "open with Adobe Reader 9".  How can I avoid having to do this?

    I have loaded and reloaded Reader 9.  I cannot open a pfd document.      I can save it to desk top then open it via a drop down box that has a "open with Adobe Reader 9".  How can I avoid having to do this?

    Hello Michael,
    Thank you for your response.  My operating system is XP.  When I try to open a pfd document I just get a series of letters and symbols in a dialog box.  The top of the box says "select the encoding that makes your document readable".  I can choose Windows, MS-Dos, or other (there is a long list to choose from).  None seem to make a difference.  If I save the document to my desk top I can right click on it and choose an option "Open with  AdobeReader 9" and it opens fine.
    Thank you,
    Rick 
    New Edge Technologies
    6525 Peninsula Dr.
    Traverse City, MI 49686
    231.620.2521
    231.941.1284 (fax)
    [email protected]
    Date: Wed, 8 Jul 2009 06:22:51 -0600
    From: [email protected]
    To: [email protected]
    Subject: I have loaded and reloaded Reader 9.  I cannot open a pfd document.      I can save it to desk top then open it via a drop down box that has a "open with Adobe Reader 9".  How can I avoid having to do this?
    Hello:
    What operating system does your computer use? What happens when you attempt to open a PDF document rather than saving it first? Please include any/all error messages. Also, have you tried opening documents from other locations or just one in particular?
    Thanks,
         Michael
    >

  • Some snaps show up as black screens when I try to view them as single pictures.Even when I run them in slideshows they show up as black screens.These are jpeg files.How can I avoid this happening?

    Some snaps show up as black screens when I try to view them as single pictures.Even when I run them in slideshows they show up as black screens.These are jpeg files.How can I avoid this happening?

    There are several possible causes for the Black Screen issue
    1. Permissions in the Library: Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Include the option to check and repair permissions.
    2. Minor Database corruption: Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild.
    3. A Damaged Photo: Select one of the affected photos in the iPhoto Window and right click on it. From the resulting menu select 'Show File (or 'Show Original File' if that's available). Will the file open in Preview? If not then the file is damaged. Time to restore from your back up.
    4. A corrupted iPhoto Cache: Trash the com.apple.iPhoto folder from HD/Users/Your Name/Library/ Caches...
    5. A corrupted preference file: Trash the com.apple.iPhoto.plist file from the HD/Users/ Your Name / library / preferences folder. (Remember you'll need to reset your User options afterwards. These include minor settings like the window colour and so on. Note: If you've moved your library you'll need to point iPhoto at it again.)
    If none of these help:
    As a Test:
    Hold down the option (or alt) key key and launch iPhoto. From the resulting menu select 'Create Library'
    Import a few pics into this new, blank library. Is the Problem repeated there?

  • HOW CAN I AVOID THIS ERROR MESAGE WHILE TRYING TO EXPORT AN IPHOTO SLIDESHOW:  The operation couldn't be completed. (OSStatus error -61.)

    HOW CAN I AVOID THIS ERROR MESAGE WHILE TRYING TO EXPORT AN IPHOTO SLIDESHOW:  The operation couldn’t be completed. (OSStatus error -61.)

    Hello,
    I believe the issue was the external HD I purchased was not formatted for Mac . . . once I took care of that - all went well!  The slide show transferred and the surprise 70th birthday party was a huge sucess.  Thank you everyone!

  • The customized settings on my toolbar periodically disappear, and I have to re-set them. How can I avoid this nuisance?

    The customized settings on my toolbar periodically disappear, and I have to re-set them. How can I avoid this nuisance?

    If you mean you're about to perform a restore from a backup to a new device, it depends on the app.  Some will retain their passwords, some will not.  That's my experience.

  • I am trying to make a one to one reservation at a closer Apple store in Denver but each time I put my password in it kicks me over to the retail store where I purchased the one to one service. How can I avoid this?

    I am trying to make a one to one reservation with my new MacBook Air at a retail store of my choosing but each time I put in my password it kicks me over to the Apple store where I purchased the one to one service. How can I avoid this and reserve at the store of my choice?

    I would try the 'old fashioned way, the telephone.
    Ciao.

  • I find 'plugin-container.exe' takes up 68-91% of my CPU and effectively hangs my machine; how can I avoid this, from happening?

    I find 'plugin-container.exe' takes up 68-91% of my CPU and effectively hangs my machine; how can I avoid this, from happening?

    You can disable the plug-in container for one or two plug-ins, or for all the plug-ins it works for. <br />
    http://kb.mozillazine.org/Plugin-container_and_out-of-process_plugins

  • Iphone4  when im talking to someone i always press the mute button how can i avoid this?

    While on the phone i always press the mute or hold button while talking to someone how can i avoid this its driving me crazy so i end up just using speaker phone

    If you have a case on the phone, take it off. It may be interfering with the proximity sensor.  If you have a screen protector, take it off. It may be interfering with the proximity sensor.  Make sure you actually old the phone against your ear. if you hold it away from your ear, the proximity sensor may not be able to tell that you have it up to your face.

  • Stockbroker states that "invalid session" message is due to brownser how can I avoid this?

    I tried to cover a short sale while trading online. Could not execute the trade. Got a message in red "invalid session". Broker tech support stated that it was not their software, it was cause by the browser, Firefoz 5.0 running on Windows XP. How can I avoid this?

    That is not very easy to answer, because the cause of the corruption is unknown.<br />
    In severe cases you may even need to delete the file cookies.sqlite that stores the cookies.<br />
    There is also a possibility that security software or cleanup software is causing such problems.
    If you've never seen it before then it may not happen again, but it is not that difficult to remove the cookies in such a case.
    See also:
    *https://support.mozilla.com/kb/Clear+Recent+History

Maybe you are looking for