How to get an item out of a list box

This forum is currently in read-only mode.
From the Asset Store
Over 2700 files with all the colour combinations from a 15 colours palette!
  • 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....

  • 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:

    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...)
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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?

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)