Reference Combo Box

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
JackieBlue1970
Posts: 64
Joined: Thu Jan 16, 2020 10:28 pm
Location: Max Meadows, VA USA

Reference Combo Box

Post by JackieBlue1970 » Thu Mar 05, 2020 12:15 am

I've set up a combobox with a simple Y/N choice. How do you reference which choice was chosen? I've tried several ways based on the limited available references in the googles, the LiveCode dictionary, and the forums. I've tried to reference it directly like:

ex 1:

Code: Select all

 if the label of "cboFreight" is empty 
ex 2:

Code: Select all

put the label of "cboFreight" into tValue
   answer tValue
None of this works. Doesn't error on "compile" but on execution. I've tried other variations (with and without label references) but haven't been able to get a reference to check or even using "answer"

Thanks.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Reference Combo Box

Post by FourthWorld » Thu Mar 05, 2020 1:37 am

The combobox is a subclass of button - add the object type to the reference and you should be good:

Code: Select all

 if the label of button "cboFreight" is empty
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

JackieBlue1970
Posts: 64
Joined: Thu Jan 16, 2020 10:28 pm
Location: Max Meadows, VA USA

Re: Reference Combo Box

Post by JackieBlue1970 » Thu Mar 05, 2020 2:34 am

FourthWorld wrote:
Thu Mar 05, 2020 1:37 am
The combobox is a subclass of button - add the object type to the reference and you should be good:

Code: Select all

 if the label of button "cboFreight" is empty
Thanks. I’ll give it a try. A combo as a button. Not exactly logical.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Reference Combo Box

Post by FourthWorld » Thu Mar 05, 2020 4:04 am

Think of it as a selector. The LC button class includes both push buttons (standard, rectangle) and selector buttons (checkbox, radio, option, combo, other menu types).

No matter what type, you'll want to reference objects by some type specifier (button, field, etc, or the generic control) along with the unique element (name, ID, ordinal). The name alone doesn't give it enough information to know what you're referring to.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9670
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Reference Combo Box

Post by dunbarx » Thu Mar 05, 2020 5:48 am

What Richard said.

You wrote:

Code: Select all

 if the label of "cboFreight" is empty 
Consider that you are asking for the label of a quoted string. What is the label of "cboFreight", that is, the simple string of letters "cboFreight". Strings do not have properties.

See?

Craig

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Reference Combo Box

Post by bogs » Thu Mar 05, 2020 10:36 am

JackieBlue1970 wrote:
Thu Mar 05, 2020 2:34 am
Thanks. I’ll give it a try. A combo as a button. Not exactly logical.
If you ever wonder what an object's base is, you can always do something like this to find out...
aPic_namesAndSuch.png
A rose by any other name...
... or just look at the titlebar of the property inspector...
aPic_namesAndSuch2.png
A quick inspection of your property...
aPic_namesAndSuch2.png (12.71 KiB) Viewed 3993 times
...and all mystery should be resolved :D
Image

JackieBlue1970
Posts: 64
Joined: Thu Jan 16, 2020 10:28 pm
Location: Max Meadows, VA USA

Re: Reference Combo Box

Post by JackieBlue1970 » Thu Mar 05, 2020 2:59 pm

bogs wrote:
Thu Mar 05, 2020 10:36 am

If you ever wonder what an object's base is, you can always do something like this to find out...
aPic_namesAndSuch.png
... or just look at the titlebar of the property inspector...
aPic_namesAndSuch2.png
...and all mystery should be resolved :D
Nice trick. Still seems strange to me.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Reference Combo Box

Post by Klaus » Thu Mar 05, 2020 3:16 pm

Get used to it! :-D

And we also only have ONE field object, but setting some props, what the TOOL palette gratefully does for us, we get a:
label
Listfield
Scrolling listfield
"simple" (text entry) field
ONE Line text entry field

Dito for the scrollbars, we only have ON scrollbar object and can make it a:
slider
progress bar
"simple" scrollbar
"little arrows", no idea if this has a special name?

And all of them are addressed just with:
-> field "name or number of field"
-> scrollbar "name or number of scrollbar"

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”