Graphic in Field
Kathy Jaqua
kgjaqua1 at sbcglobal.net
Sat May 21 19:50:44 EDT 2005
Hi Glen:
I did this In a field and it works quite well :-) (
or" How He did It by Baron Von Frankstein")
First:
I made two images by taking a screen shot of:
(If you have iCal on the Mac you can get a variety of
colors)
1. A check box button unchecked and I called it "Aqua
NoChButton.png"
2. A check box button checked and I called it "Aqua
CheckedButton.png"
I found that I needed to replace a character already
typed in a line ( in my case it was the number of the
line placed in character 1 of that line) with the
imageSource "Aqua NoChButton.png"
I used the following script to place the imageSource
"Aqua NoChButton.png":
on addSourceImage
--if line 1 of me <> "1" then put "1" into line 1 of
me
--if the imageSource of line 1 of me is empty then
set the imageSource of char 1 of line 1 of me --"Aqua
NoChButton.png"
put the number of lines in me into tCount
add 1 to tCount
put tCount & return after me
set the imageSource of char 1 of line tCount of me to
"Aqua NoChButton.png"
end addSourceImage
Second:
Then on a mouseclick In the field I toggle the two
images to make it appear As if it is a check button
on mouseDown
-- the first two lines are used to delete the
imageSource if needed
get the clickLine
if the controlKey is down then delete the clickLine
-- Line 3: gets the line number and puts it into the
field line
put the value of the clickLine into tclickLine
if the imageSource of line tclickLine of me is "Aqua
NoChButton.png" then
set the imageSource of char 1 of line tclickLine
of me to "Aqua CheckedButton.png"
else
if the imageSource of line tclickLine of me is
"Aqua CheckedButton.png" then
set the imageSource of char 1 of line tclickLine
of me to "Aqua NoChButton.png"
end if
end if
end mouseDown
Third:
If you Delete the check box imageSource you want to
reline or reorder the field lines in the correct
sequence use the following script: (Mark Wieder gave
me this last script)
on fixLines
-- action can occure when field is locked or
unlocked
get number of lines in me
put true into trailing
repeat while it > 0
if the number of words in line it of me is not 0
then
put false into trailing
else
if trailing then delete line it of me
else delete line it of me
end if
subtract 1 from it
end repeat
end fixLines
Hope this helps:
Kathy Graves Jaqua
A Wildest Dream Software
More information about the use-livecode
mailing list