Mike,

There are a bunch of ways you can approach this some more elegant than
others.

Let me give you a few hints:

#1) There is a method of the NumberBase class called parseNumberString
which will parse apart a formatted number string and give you back
something you could work with...It is used within the
CurrencyFormatter to convert what the user enter into a number so that
it can be formatted. So, one approach, you could format on a focus out
and populate your value object by parsing the number first... This
might be the route of least resistance

#2) You could create an extension of the TextInput called, let's say
CurrencyInput. You could add a property to that class for an
unformatted version of the text property. So, on valueCommit or
focusOut you could convert the string to a number and save it in the
new property. This property could then be configured as bindable and
used instead of the text property in your databinding.

The latter is the approach I would prefer, as it makes the setup
reusable. However, your mileage will vary depending on type/size of
project.

There might be another way that I am not familiar with, however, this
should work.

Let me know if you have additional questions or need to see a code
snippet,
Mike



--- In flexcoders@yahoogroups.com, "Mike Anderson" <[EMAIL PROTECTED]> wrote:
>
> Yes, Michael - that is PRECISELY what I am asking -
> 
> In my App, I have a TextInput that is bound to a ValueObject (using the
> Curly Braces method) - and this TextInput needs to display numbers
> entered by the user, as Currency once that field loses focus.
> 
> Is it possible to have the user enter a number, and once the TextInput
> loses focus, have the number turn into a "$00.00" format (while still
> keeping the original intact, when sending back to the server)?  I am
> sure this is quite easy to do, BUT will this get hosed up, if this value
> gets sent back to the server?
> 
> This is why I mentioned, having an interim Variable hold the contents of
> the "Number".
> 
> Even know my DataType on the SQL Server is "SmallMoney", it's still a
> Number within my VO Class File.
> 
> Will this cause an error, since a String Var is required, in order to
> keep the $ format?
> 
> This is where I could use some guidance...
> 
> Thanks in advance for your help,
> 
> Mike
> 
> -----Original Message-----
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Michael Labriola
> Sent: Thursday, October 19, 2006 8:19 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: TextInput control (displaying
> CurrencyFormatted data) question
> 
> 
> Mike,
> 
> I might need some more explanation, as I think I am missing something.
> I have a lot of textInputs that format on focus out. Is your concern
> that the data in the field is now 'formatted' so it will be useless for
> sending back to some server.
> 
> Let me know and I will be glad to help more, Mike
> 
> --- In flexcoders@yahoogroups.com, "Mike Anderson" <mike@> wrote:
> >
> > Hello All,
> > 
> > In all the examples I've seen for the CurrencyFormatter when it comes 
> > to using a TextInput for displaying the data, it requires TWO 
> > TextInputs - one that contains the value to be formatted, and one that
> 
> > displays the finally formatted data.
> > 
> > Isn't there a way, where the same TextInput can be used twice?  The 
> > holder of the data, and the displayer of the formatted data?  Or is 
> > this simply not possible?
> > 
> > Or is my best bet (since 2 controls would look stupid), to declare a 
> > Variable that acts as the Value Holder (as well as the item being 
> > bound to my DataSet), and then the actual TextInput strictly for 
> > displaying to the user, the CurrencyFormatted value?
> > 
> > As far as I can tell, this is THE way to do it - but I just wanted to 
> > throw this question out there.
> > 
> > Any comments regarding this, would be greatly appreciated!
> > 
> > Thanks,
> > 
> > Mike
> >
> 
> 
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
>





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to