How trim?
Bob Warren
robertum at brturbo.com
Mon Oct 24 03:04:38 EDT 2005
Thanks very much indeed Jim! I'll certainly follow that up.
I'm sure your example of back scripts will also be useful to other
less-experienced users. They may also learn from my own cries for help
(pending)......
Best regards,
Bob
----------------------------------
On 23 Oct 2005, Jim Ault <JimAultWins at yahoo.com> wrote:
Hi, Bob,
>> put the LTrim(32,202,160) of myVar1 into myVar2
>> put the Trim(32) of myVar1 into field "Label1"
>>
>> Of course, such built-in functions would take into consideration the
>> interesting points (related to speeed, accuracy, etc.) that you have all
>> so enthusiastically raised.
-- coming is a long explanation and a working example of back scripts
Rev is really designed to be a tool box for developers to refine their own
solutions and the community shares these results. On one hand, the task
might be the occasional string to trim, or on the other, a massive list from
a network log file. In your case, you would rather have the flexible
version that allowed you to pass the ASII number(s), so you could roll your
own with the help of the list.
After building what you want, decide if it is to be available every time you
run Rev, or only for your intended audience with your app. If only for your
app, copy and paste the functions from a place you store them, into the main
stack script. Now LTrim(ascii, ascii, ascii) will work every time the way
you wish.
Read about back scripts, which are available after messages pass the stack
level. Below is an example of adding a 'mouseup' script to the Rev back
scripts and removing it again. Paste this code into a new button on a new
main stack and watch how it will auto-toggle.
ANY open stack in Rev will trigger the 'mouseup' back script, unless you
trap it.
Test == make second new main stack, click on the card and you will get an
error.
Close and remove from memory > the stack that created the script, and Rev
will delete the back script from the list.
Hope this helps you understand a bit more about a development environment
Jim Ault
Las Vegas
Building a car with a wrench, and a hammer, and a good idea.
Making it fly with imagination and lots of time.
------------------- copy start here (careful of word wrap)
--button script, no need to name the button
--notice -- inserts into Back Script as FIRST in the list
on mouseUp
if the long id of me is in the backscripts then
remove the script of me from back
answer the backscripts
answer "BACK SCRIPT INactive "& RETURN & \
"now ONLY the button will respond to the mouseUp and run this handler"
answer "clicking the button again will reACTIVATE the card mouseup"
else
insert the script of me into back
answer the backscripts
answer "BACK SCRIPT ACTIVE "& RETURN & \
"now the card will respond to the mouseUp and run this handler"
answer "clicking the card and running this script will remove this
behaviour"
end if
end mouseUp
----------------- end copy
On 10/23/05 4:11 PM, "Bob Warren" <robertum at brturbo.com> wrote:
>> On 23 Oct 2005, Dave Cragg (<dcragg at lacscentre.co.uk>) wrote:
>>
>
>>>> Is there a requirement for the solutions to be one liners?
>
>>
>> --------------
>> No, but it would be nice. Originally, I looked in the Help for
>> equivalents to the simple Basic functions e.g. LTrim$(MyString$),
>> RTrim$(MyString$), and Trim$(MyString$) and was surprised not to be able
>> to find them.
>>
>> In VB, I use these functions all the time, so I am a bit mystified at
>> the apparent lack of desperate need for simple-syntax built-in functions
>> on the part of experienced RR programmers. I certainly need this very
>> much in the RR stack I am writing at the moment.
>>
>> Who knows, we might see statements like the following in future versions
>> of RR:
>>
>> put the LTrim(32,202,160) of myVar1 into myVar2
>> put the Trim(32) of myVar1 into field "Label1"
>>
>> In the scheme above, ANY characters could be trimmed, not just the
>> whitespace.
>>
>> Of course, such built-in functions would take into consideration the
>> interesting points (related to speeed, accuracy, etc.) that you have all
>> so enthusiastically raised.
>>
>> Bob
>> _______________________________________________
More information about the use-livecode
mailing list