Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

pre-selection of a listbox item after clicking a button

ra_be
Level 2
Level 2

Hello,

I have a listbox with a lot of item to choose. Now I have to implement a button that the listbox will scroll down to a particular item of the listbox.

E.g. click on button1 -> the listbox scrolls automatically to item no. 20 (and select it)

click on button 2 -> the listbox scroll automatically to item no. 30 (and selcect it)

Does anyone have an idea?

Thanks.

Regards,

ra_be

1 Accepted Solution
djaknow
Correct answer by
Level 7
Level 7

Hi ra_be,

Here's a simplified sample that should help you.

View solution in original post

5 Replies
djaknow
Correct answer by
Level 7
Level 7

Hi ra_be,

Here's a simplified sample that should help you.

View solution in original post

ra_be
Level 2
Level 2

Thanks. Actually it is too easy...

Jono_Moore
Level 10
Level 10

So how does that work accessing the specified value without using "boundItem."

I've just been playing around with something similar and couldn't get it to work with just using rawValue (I've got a couple of recent threads about it on here).

ra_be
Level 2
Level 2

The code is "Listbox.rawValue = 1;" or "Listbox.rawValue = 27;".

But you have to define the "element values" before. Click on your listbox, then object, then connection. Just tick the "Define elements value" and the code should work. (I am not quite sure with names and captions as I am not using an English version of LSD.)

djaknow
Level 7
Level 7

Using the boundItem method is probably a better way of doing it for the examples you posted Jono, especially for the switch statement. ra_be's sounded like a simple one-off. ra_be, good catch on calling out that you have to specify the item values, I didn't think to mention that.