Page 1 of 1

Reference Combo Box

Posted: Thu Mar 05, 2020 12:15 am
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.

Re: Reference Combo Box

Posted: Thu Mar 05, 2020 1:37 am
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

Re: Reference Combo Box

Posted: Thu Mar 05, 2020 2:34 am
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.

Re: Reference Combo Box

Posted: Thu Mar 05, 2020 4:04 am
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.

Re: Reference Combo Box

Posted: Thu Mar 05, 2020 5:48 am
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

Re: Reference Combo Box

Posted: Thu Mar 05, 2020 10:36 am
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...
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 5014 times
...and all mystery should be resolved :D

Re: Reference Combo Box

Posted: Thu Mar 05, 2020 2:59 pm
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.

Re: Reference Combo Box

Posted: Thu Mar 05, 2020 3:16 pm
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"