Ruediger zu Dohna a écrit / wrote:

> getProp formattedNumber
>   get me
>   -- do your formatting
>   return it
> end formattedNumber
>
> Now you can call it from the button like this:
>
>   get the formattedNumber of fld 1
>
> Nice, isn't it?

Ahem!

I am too familiar with the Hypercardian way of making functions...

In the (Hyper)card script I have:
-----
function cnf Fx

  set the numberformat to (cd fld "format")

  repeat with i = 1 to the number of words in Fx
    get word i of fx
    if it is a number then put value(it) into word i of Fx
  end repeat

  return Fx

end cnf

-- by HTH List HC US
----
and the button script:
-----
  put cnf(cd fld "nombre") into cd fld "nombre"
-----

Hence: what are the Metacardian equivalents of those commands?

I must confess that the similarities of HC and MC are somewhat confusing...

==============

A moment later ;-)
"numberformat" behaves as in HC: it requires a calculation in order to
format the result of that calculation; hence I replace:

 if it is a number then put value(it) into word i of Fx

with:

 if it is a number then put value(it+0) into word i of Fx

and it works!
It seems that HC *evaluates* the result of a command, whereas MC doesn't,
unless you told it....


(-8           dd
mailto:[EMAIL PROTECTED]
Photos de LAON (CP950) sur <http://dd11.free.fr/>



This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm

Reply via email to