Page 1 of 1

Is there an easy way to distinguish type of object

Posted: Wed Mar 25, 2009 12:11 pm
by planix
Hi,

Simple question... I hope.

I have a piece of code that iterates through the fields on a card and clears the contents.

Problem: When I ran this it cleared the text entry field contents and deleted all the contents of the label fields as well :-(

Is there are simple way to distinguish a label field from a text entry field? I was hoping that there was a standard "type" property but I can't find it. Otherwise, I am guessing I will need to set up a custom property for each label field to make it non-deleteable.

Cheers

Posted: Wed Mar 25, 2009 1:32 pm
by Klaus
Hi Planix,

well, a field is a field be it "Label" or Text entry" :-)

But both have different properties that you could check:
Here the two main differences in the DEFAULT properties, which can of course be changed/modified!
(L = Label, TE = Text entry)

"showborder"
L = false
TE = true

"locktext"
L = true
TE = false

Maybe this is the prop for you to check!
...
if the locktext of fld XYZ <> true then
## probably NOT a "Label" field!
put empty into fld XYZ
end if
...

You get the picture :-)


Best from germany

Klaus

Posted: Thu Mar 26, 2009 1:58 am
by planix
Thanks Klaus,

In the end I got around it because I don't name label fields. So they all have the default name "Label Field". So, I just checked each field in the repeat loop as to whether it contained the word "label"

Code: Select all

if the name of this field contains "Label" then
   next repeat
end if
Simple enough but I think it would be better if labels were a separate object from fields or there was a type property somewhere.

Cheers