Platform-specific file path delimiters

Trevor DeVore lists at mangomultimedia.com
Fri Sep 25 09:17:18 EDT 2015


On Fri, Sep 25, 2015 at 8:33 AM, Mark Waddingham <mark at livecode.com> wrote:

>
> Given that there is a direct analog between file path display and
> processing, and numeric display and processing it seems to me that an
> eventual 'nice' solution to the problem should follow similar lines.
> Perhaps field properties which cause the display / input to be in
> user-world, but the underlying values you manipulate in computer-world; or
> perhaps nice syntax which parses and displays strings:
>   put tFilePath formatted as filepath into field "Foo"
>   put tAmountInUSD formatted as currency into field "Foo"


As I was reading Rogers post I was thinking along the lines of a widget
that is a field that displays file paths in the correct way. You always
get/set the <text> property of the widget using the LiveCode path. The
widget formats the path for the OS the widget is being displayed on. The
user can enter the path in the normal format for their platform and the
widget converts it behind the scenes. (Yes, you could accomplish something
similar using custom props right now.) You would have similar widgets for
currency.

Now, if you wanted to display the path as part of a string that is
displayed in a dialog box then you need the syntax for parsing and
displaying strings. This makes me wonder though, would it be possible to
just have variables that were a file path or currency type? Would that make
sense for the LiveCode language?

put "4.55" into theVar as currency
set the display of theVar to "name"
set the symbol of theVar to "GBP"
put theVar as string -- 4.55 British pounds sterling
put theVar -- 4.55

set the symbol of theVar to "USD"
set the display of theVar to "symbol"
put theVar as string -- $4.55

put "The amount of money is:" && theVar as string & "."

The equivalent formatting syntax might look something like this:

put "The amount of money is:" && theVar formatted as currency displayed as
"symbol" using symbol "USD" & "."

Just typing out loud. Not sure which I like more.

-- 
Trevor DeVore
ScreenSteps
www.screensteps.com    -    www.clarify-it.com



More information about the use-livecode mailing list