Datagrid Decimal Alignment

zryip theSlug zryip.theslug at gmail.com
Sat Jul 24 16:36:40 EDT 2010


On Sat, Jul 24, 2010 at 4:49 PM, Glen Bojsza <gbojsza at gmail.com> wrote:
> Hello,
>
> I have tried implementing Decimal Alignment from the sample given with
> Datagrid.
>
> Problem is that the negative sign doesn't show?
>
> If you double click and add a negative sign in from of the number it doesn't
> show.
>
> Also if you double click and enter a new number with a negative sign then it
> changes the value to 0.0?
>
> Any advice?

Hi Glen,

Assuming that this sample is linked to the 'How Do I Align Decimals in
a Column?' lesson
http://lessons.runrev.com/spaces/lessons/manuals/datagrid/lessons/7331-How-Do-I-Align-Decimals-in-a-Column-

The problem should reside in the FillinData handler:

set the itemDel to "."
set the text of fld "leftvalue" of me to max(0,item 1 of pData) & "."
set the text of fld "rightvalue" of me to max(0,item 2 of pData)

Negative numbers are ignored due to the use of the max function.

Replace the content of the handler by:

set the itemDel to "."
set the text of fld "leftvalue" of me to item 1 of pData & "."
set the text of fld "rightvalue" of me to max(0,item 2 of pData)

You have now to take care that the user has not started the number by a dot.


Regards,
-- 
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc



More information about the use-livecode mailing list