Scrolling List Field

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

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Scrolling List Field

Post by bjb007 » Mon Jul 07, 2008 6:40 am

Spend some hours trying all the
variations/combinations I can think
of to get the visible item of a scrolling
list field into a variable.

Exhausted...

Help appreciated.
Life is just a bowl of cherries.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Jul 07, 2008 9:26 am

Hi BJB,

What is a "visible item"? If you mean the property, you can retrieve this like any other property:

get the visible of fld x
put the visible of fld x into myVar

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Scrolling List Field

Post by bjb007 » Mon Jul 07, 2008 9:37 am

Mark
That's one of the many things I tried.

With your suggestion the variable has
"true" in it rather than the value of
the visible item (a number).
Life is just a bowl of cherries.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Jul 07, 2008 9:46 am

Hi BJB,

Why, yes of course, true or false. Why would you expect a number?

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Scrolling List Field

Post by bjb007 » Mon Jul 07, 2008 9:50 am

Well, "true" (whatever it means) isn't
much use, is it?

What does it mean?

Whereas the number would be very
handy.
Life is just a bowl of cherries.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Jul 07, 2008 10:00 am

Hi BJB,

What would you do with the number? Could you please explain what you want?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Scrolling List Field

Post by bjb007 » Mon Jul 07, 2008 10:14 am

I want to use the numbers
indicate how many occurrences
of a condition are present in data sets.

So I want the user to be able to
choose 2 and 5, say, to check if
there are two occurrences in the
last 5 sets of date or 3 in 5 or 4 in
6 etc.

So need to get the numbers into
variables.
Life is just a bowl of cherries.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Jul 07, 2008 10:19 am

BJB,

I don't understand what occurrences of numbers in datasets have to do with the visible property of a field.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Scrolling List Field

Post by bjb007 » Mon Jul 07, 2008 11:19 am

Can't really explain it better.
Just want to use the two numbers
which the user has chosen in the
scrolling fields at the bottom...

Image
Life is just a bowl of cherries.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Jul 07, 2008 11:21 am

Hi BJB,

Try this:

put the label of btn x into myVar

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Scrolling List Field

Post by bjb007 » Mon Jul 07, 2008 12:54 pm

Mark
That gives a compiler error at "of".

Have also tried a list field with no more
success than with the scrolling list field.

BTW am I odd in feeling that when I click
the "down" arrow on the scrollbar that I
should go to the next item down rather
than up?

The scrollbars in the Inspector behave the
same way which seems counter-intuitive to
me. Get around it by listing items from
largest to smallest!

Starting to wonder what these objects
are meant to be used for. Not much use
just having items to look at!
Life is just a bowl of cherries.

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Scrolling List Field

Post by bjb007 » Mon Jul 07, 2008 1:39 pm

Problem solved.

Place a button
Set style to menu
In the Inspector set type to "Option"
then "put label of button....." does
the trick.

Is there a place to change a button
style to "Menu" apart from programming it?

All of which, of course, still leaves the question
of what can one do with a scrolling list field -
apart from admiring it.
Life is just a bowl of cherries.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Jul 07, 2008 2:29 pm

Hi BJB,

What you call a scrolling list field is actually called a combo box. This caused me a lot of confusion.

The syntax "put the label of btn...." works for me, if used with a combo box. Apparently you do something wrong there. You might want to post your script.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Scrolling List Field

Post by bjb007 » Mon Sep 08, 2008 3:18 am

Mark

There is an item on the Object palette
with the title of "Scrolling List Field"
and one named "Combo Box".

If it really is a combo box perhaps the
name should be changed.
Life is just a bowl of cherries.

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Mon Sep 08, 2008 6:10 am

Actually, the item seen at the bottom of the screenshot is probably not a combobox. It may or may not be a scrolling list field - but it looks much more like an attempt to make a 'spinner' field, where you can increase the value b clcking in the 'upward' button and decrease it by clicking in the 'downward' button.

Revolution does not have a baked-in 'spinner' field. Just going out on a limb here, I suggest that bjb007 is actually using a really short scrolling list field with all the values separated by returns.

If that is the case (a few screenshots of the Inspector palette would confirm this) then it's a matter of getting the 'vScroll' property of the field and dividing that by the 'textHeight' of the field. You may have to add some fudge factor here to get it just right.

A quick test based on the above assumption showed the following to work:

Code: Select all

on mouseUp
   put the vScroll of field 1 into tVScroll
   put the effective textHeight of field 1 into tTextHeight
   answer (tVScroll DIV tTextHeight) + 1
end mouseUp
If you're looking to quickly build a spinner, you may be interested in the 'Objects library' in the 'Development' menu in the Rev IDE - there's an item 'Little arrows generic' which you can place onto your card and with a few properties link to a field and enter minimum and maximum values.

Hope this helped,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Post Reply