I'm trying to set up a global text only library that includes text handlers for 
formatting text run time.

Typical use case is : clickable list field with titles that wrap. Say you set 
type size to 16, text height to 20, dontWrap is false, first indent -40, left 
margin 20. This looks fine, but the lines are too close together.. Since there 
is no way to apply "spaceBelow" to a field…you have to dynamically run a script 
to "set the type" of each line run time after loading the field.

So far so good until this

# card script

put tTitles into fld "audioList"  # contains 30 lines
addSpaceBelowListLines (the long id of fld "audioList"),10


lib_SivaSivaMedia # a global "backscript" -- one of many

on addSpaceBelowListLines pField,pSpace
    put the number of lines of pField
# returns 1 --
# --  of course, that's a prop of the var, not the object it refes to

     repeat with x = 1 to (the number of lines of pField)
          set the spacebelow of line x of pField to pSpace
     end repeat
end addSpaceBelowListLines

# only line 1 gets added space.

In the msg box I can test

put the number of lines of (the long id of fld "audioList")
[return] 30

but

put the number of lines of pField = 1

# ok I get it a var,  single string, 1 line only

of course we can add to the card script

put tTitles into fld "audioList"
put the number of lines of tTitles into pLineCount
addSpaceBelowListLines (the long id of fld "audioList"), pLineCount, 10

LIBRARY:

on addSpaceBelowListLines pField, pLineCount, pSpace
repeat with x = 1 to pLineCount
          set the spacebelow of line x of pField to pSpace
     end repeat
end addSpaceBelowListLines

And this works.. it even has an interesting visual effect as the lines layout 
dynamically in front of the users, spreading out top to bottom.
( though I probably should lock and unlock the screen for small devices speed)

But that it would be nice not be "stuck" with only finding out the properties 
of the variable as a variable.

i.e. pField is a variable with 1 line…

but  to be able to address the properties of the object referred to by a 
variable containing the long ID of an object/

How do we do that?

BR




_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to