Control Property - What type am I ?

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!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
skindoc4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 77
Joined: Mon Jul 07, 2008 1:22 am

Control Property - What type am I ?

Post by skindoc4 » Fri Mar 06, 2009 7:29 am

I have a generic routine which scrolls through all the controls on a card. Is there a control property I can query which will tell the routine what kind of control the "n"th control actually is ie. is it a field, is it a checkbox, is it a button?

The different control types are treated differently by the routine so it must be able to evaluate the control type. The "style" property is close but not quite and I have been unable to discern a "type" property.

I could of course add a custom property to each control but this is not particularly elegant.

Alex

Klaus
Posts: 14192
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Fri Mar 06, 2009 9:20 am

Hi Alex,

you can check:
word 1 of the name of control X

"the name of ..." will return something like:
field "Name of field"
button "name of button"
scrollbar "Name of scrollbar
etc.

So the first word is what you are looking for :-)

If that is a button you can then check "the style of control X" which wil then
return "menu", "checkbox" etc.

Hope that helps.


Best form germany

Klaus

skindoc4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 77
Joined: Mon Jul 07, 2008 1:22 am

Control Property - What type am I?

Post by skindoc4 » Fri Mar 06, 2009 11:50 am

Hi Klaus

Just what I was looking for - thanks

Alex

Post Reply