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

Reference Combo Box

Post by JackieBlue1970 »

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: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Reference Combo Box

Post by FourthWorld »

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

Re: Reference Combo Box

Post by JackieBlue1970 »

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: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Reference Combo Box

Post by FourthWorld »

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: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: Reference Combo Box

Post by dunbarx »

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: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Reference Combo Box

Post by bogs »

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...
A rose by any other name...
A rose by any other name...
... or just look at the titlebar of the property inspector...
A quick inspection of your property...
A quick inspection of your property...
aPic_namesAndSuch2.png (12.71 KiB) Viewed 6769 times
...and all mystery should be resolved :D
Image
JackieBlue1970
Posts: 64
Joined: Thu Jan 16, 2020 10:28 pm

Re: Reference Combo Box

Post by JackieBlue1970 »

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: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Reference Combo Box

Post by Klaus »

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