How to get an item out of a list box

For questions about using Classic.

Post » Thu May 27, 2010 4:32 am

I'm new to the forum and construct itself, soooooo, hi to you all....

I have problems getting a selected item out of a list box. None of the selectable functions and such seem to give me that option, and none of the python functions specific to the list box do either.

I was wondering if anyone could help me with this......

Feel free to ask if you need more info on what I'm doing.

Thanks very much.... :mrgreen:
B
1
G
2
Posts: 3
Reputation: 631

Post » Thu May 27, 2010 6:13 am

Hey.

I kinda solved my problem, only to create another one...

I'm able to get the text out of a list box using a python script, but once I try to output it into a text object, the layout crashes on me..

this is what I use:

[code:9a2bpwdy]Text.setText(scalesbox.LineText(scalesbox.SelectedLine))[/code:9a2bpwdy]

When I use this same text in a regular event, i get no error message and everything works fine...

Is it possible to simply get the line number, because that would work as well for what I have in mind., which is to use the line numbers to put them through the functions of an external library(also, the library in questions works just fine, so that's not the issue...)
B
1
G
2
Posts: 3
Reputation: 631

Post » Thu May 27, 2010 6:50 am

Okay, I've believe I found the problem(or at least part of it)

It seams, that my python scripts only execute once, even if I put them under the Always event.


Is this a common problem, or am I just doing something wrong here?

Any suggestions? :mrgreen:
B
1
G
2
Posts: 3
Reputation: 631

Post » Thu May 27, 2010 9:14 am

Are you just getting the text form a list box or are you actually trying to remove that entry from the box? It looks like you're just getting text.

You don't really need to use python for that, plain events will work just fine. Use a TextBox...set it's text to what you're trying there. (Maybe thats exactly what you're doing, you're just using python ..without a cap I'm a bit confused.)

What is it supposed to do? Change the text box's text whenever you select a different line? I'm pretty sure theres an event condition that says "If ListBox.SelectedLine changes" that you could use instead of Always.
B
2
S
2
G
3
Posts: 114
Reputation: 1,553


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest