Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
on mouseUp
repeat with x=1 to number of cards
repeat with y=1 to number of buttons of cd x
set the hilite of btn y of cd x to false
end repeat
end repeat
repeat with x=1 to number of cards
repeat with z=1 to number of fields of cd x
put empty into fld z of cd x
end repeat
end repeat
end mouseUp
the problem i have is that the label fields are also put to empty together with the text fields. is there any way to limit the empty to text fields only?
It depends on how you have set up the fields, but if you have (for instance) named the fields that have editable text (eg field "first_name") and named label fields "Label" or just left as default "field" then you could add a check
repeat with x=1 to number of cards
repeat with z=1 to number of fields of cd x
if not (the short name of field z of card x begins with "field") then -- or other appropriate test
put empty into fld z of cd x
end if
end repeat
end repeat
This is a bit of overkill in most respects, but if you read this thread http://forums.runrev.com/phpBB2/viewtop ... 204#p34204 you can see it is easy enough to set default properties, the built-ins include the rect, and contents. If you adapt the handlers mentioned you can tailor them to just deal with what you want. HTH
What Sparkout and Simon really mean is that a label field is just an ordinary field with a few properties set a certain way. You can morph an editable field, say, into a label field by hand just by fooling around with those properties. There is therefore no way for LC to distinguish one type from another, the way you correctly distinguish control types in your handler. You have to do that yourself, which is what Sparkout meant by "how you have set up the fields". So some convention, the name property being suggested in this case, will allow you to check and separate the fields of interest when you do your initialization. But it must be a property that distinguishes the two "types" of fields. Your choice...