So I have a small LC standalone built for Windows on a Mac, used as a utility
at work on a dumb PC terminal at my office that is networked to a server. I DL
the the utility to my (networked) Windows desktop and it helps me by storing
boilerplate text that I can use to paste into the new electronic medical record
when I write notes. It has mostly been working fine, but one feature works on
the desktop/development environment but suddenly has stopped working on in the
standalone in Windows. It's a function that truncates lines of a stored list of
short phrases ("snippets") to put into a popup button. The shorten() function
runs through a cr-delimited list of phrases and truncates the lines if they are
longer than 75 chars, inserting a "…" in the middle of the string. The popup
button then displays the truncated lines rather than the whole lines (which may
in some cases be long enough that the popup menu would be annoyingly wide).
When the user selects the string from the popup, the corresponding snippet from
the list of unaltered snippets is put on the clipboard.
That whole process works great as designed using the pre-loaded snippets, but
the shorten() function throws an error when it's called by a handler that adds
a new snippet entered by the user. That is what is broken. I finally pinned
this down by wrapping the function call in a "try" structure and putting the
"catch tErr" result into a text field, and it identifies the culprit as
residing in the shorten()handler -- "error in function handler." Can anyone see
why the following works on a Mac in the IDE and works on the Mac with
development tools suspended, but doesn't work in the standalone on a Windows
platform? I'm stuck.
The development cycle is made quite cumbersome by the fact that I don't have a
Windows machine to develop this on.
function shorten tList
repeat with n = 1 to the number of lines of tList
put line n of tList into lineText
if length(lineText) < 75 then next repeat
put empty into tBefore
put empty into tAfter
if char 43 of line n of tList = space then
put space into tBefore
end if
if char -25 of line n of tList = space then
put space into tAfter
end if
put tBefore & "..." & tAfter into char 43 to -25 of of line n of tList
-- 3 periods, not a numtochar(201)
end repeat
return tList
end shorten
-- Peter
Peter M. Brigham
[email protected]
http://home.comcast.net/~pmbrig
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode