0 Favourites

How do I create a list that is NOT a pull down?

  • Hi to All,

    My question:

    How do I create a list for mobile devices? Similar to the standard listview in jquerymobile or the tableview in Xcode?

    Thanks in advance for your help.

  • So, I take it from the lack of response to my question, that there is no way to generate a list (similar to what is seen in all cell phones) and no way to populate that list.

    Too bad, I was hoping that Construct 2 could create applications as well as games( <ul><li></li></ul>). The list is a standard for all the applications though.

    Create a list/tableview and then populate the list using something like json.

    Save back to the list using localstorage or the like.

    -Just4Fun

  • The only built-in thing in Construct that resembles what you want is the "List" object with its type set to "List box".

  • you could ofcourse easily create a fully customizable list using the TokenAt expression in combination with the dictionary object..

  • The built in feature is called an Array Object. It lets you do a list on a 1, 2, or 3 dimensional matrix

    Use an array for your list. This will let you sort, pop, delete and insert your list entries.

    https://www.scirra.com/tutorials/307/ar ... -beginners

    It will also let you load and save from a .json string!

    In C2 the Array variable is an Object,. You cant set a global array From the event sheet, thanks littlestain!. Nor can you make an array instance variable like in Scripting languages. From the Array you can load the list into a Dictionary for additional functionality.

    You can insert an arrays .JSON string, into another arrays index. This makes it possible to save all of your games arrays into a single array. This is a simple method of making a custom save game file. Makes it really easy to load too! Just one string!

    I recommend the Array because it is easier to understand for people who have used real scripting languages like C#, Javascript, or Python. You can also find usable code theory on StackOverflow.com. Just substitute the Array object for the Array Variable that they are describing.

    You could also do it manually with a Text object, Text instance variable, or a Dictionary object. This will require some Ninja code skills, and the knowledge of the get token at, and Token count, and making your own loop to cycle through the text. The array object has all of this built in! Not to mention the Sorting, popping, inserting and deleting.

    Here is the code difference to get the word "Text":

    tokenat("The,Text,From,Your,Custom,Built,String,Here"), 1, ",")[/code:yxzfx0ab]
    
    Or just grab the second value of an array (0 base):
    
    [code:yxzfx0ab]Array.At(1)[/code:yxzfx0ab]
    
    Trust me, the second one is MUCH easier to debug when you are scanning over hundreds of events.
    
    You will not have to "Cast" your values into Floats, integer or strings either. You just grab the value and run!
    Here is an example of grabbing some screen locations of a game tile from a string, the INT() is me casting them from  a string into an Integer:
    
    [code:yxzfx0ab]X:  int(tokenat(SliderController.Slider_Label_Offset, 0, ","))[/code:yxzfx0ab]
    [code:yxzfx0ab]Y:  int(tokenat(SliderController.Slider_Label_Offset, 1, ","))[/code:yxzfx0ab]
    
    Here is what the array would look like:
    
    [code:yxzfx0ab]X:  Array.At(Array.CurX)[/code:yxzfx0ab]
    [code:yxzfx0ab]X:  Array.At(Array.CurY)[/code:yxzfx0ab]
    
    Anyway, the amount of text in your expression, and casting variable back and fourth takes up valuable CPU resources. You also can NOT do complex expressions in a function like grabbing tokens, you need to have global/instance variables set for the function to be able to access them.
  • In C2 the Array variable is an Object,. You cant set a global array, nor can you make an array instance variable like in Scripting languages.

    Correct me if I'm wrong..

    Isn't an array set to global on creation?

    Wouldn't adding an array to a container work as using it as an instance variable?

    Maybe you mean something different, that's why I'm asking..

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • > In C2 the Array variable is an Object,. You cant set a global array, nor can you make an array instance variable like in Scripting languages.

    >

    Correct me if I'm wrong..

    Isn't an array set to global on creation?

    Wouldn't adding an array to a container work as using it as an instance variable?

    Maybe you mean something different, that's why I'm asking..

    Ah sorry about that, LittleStain.

    I meant the way you create them. In conventional programming you define the global variables at the top of the script (usually, they dont actually have to be here). This is where most people would assume you make an array.

    I mentioned this because they might think C2 does not support them. When they are actually an object that you add to the game board, rather than to the list of Global variables. People who are used to normal programming might overlook this when they right click on the event sheet to make one is why I mentioned it.

    I am not very good at English,

  • Thanks! REALLY appreciate the reply to my question. Sounds doable. Just needs some good skills. I'm not a code jockey. I'll try some things out and beg for help when I'm approaching the deep end of the pool. For me that could be at wading level.

    -Just4Fun

  • You also can NOT do complex expressions in a function like grabbing tokens, you need to have global/instance variables set for the function to be able to access them.

    Could you explain this statement?

    Why wouldn't you be able to do this?

    Maybe you mean something else with "function" and/or "complex expressions", but I haven't run into this limitation..

  • > You also can NOT do complex expressions in a function like grabbing tokens, you need to have global/instance variables set for the function to be able to access them.

    >

    Could you explain this statement?

    Why wouldn't you be able to do this?

    Maybe you mean something else with "function" and/or "complex expressions", but I haven't run into this limitation..

    Sorry again, the Function Plugin :p

    My English.... I just cant!

  • Sorry again, the Function Plugin :p

    My English.... I just cant!

    I thought you meant the function plugin, but I don't understand why it's not possible to use "complex expressions" in it..

    I do it all the time..

  • > Sorry again, the Function Plugin :p

    >

    > My English.... I just cant!

    >

    I thought you meant the function plugin, but I don't understand why it's not possible to use "complex expressions" in it..

    I do it all the time..

    Make a "How do I : Make a function with complex expressions", and I will make you an example when I get home from work. I will also show you how to use an array with a dictionary so you wont have to cast , and use tokens like you where suggesting to this new user.

    Maybe Ashley or someone else can answer before i am done with my work.

    Really surprises me how many people on the forums do not know about array. They are the backbone to programming. Most people learn about them the same time they learn about Str, Int, and Float.

    @Magistross you should learn about Arrays too, they would really help your plugins I bet.

  • Magistross you should learn about Arrays too, they would really help your plugins I bet.

    Trust me, I already know quite a lot about arrays, I'm a computer programmer too.

    Thing is, I thought Just4fun was talking about the UI and a way to visually represent a list.

  • >

    > > Sorry again, the Function Plugin :p

    > >

    > > My English.... I just cant!

    > >

    >

    > I thought you meant the function plugin, but I don't understand why it's not possible to use "complex expressions" in it..

    > I do it all the time..

    >

    Make a "How do I : Make a function with complex expressions", and I will make you an example when I get home from work. I will also show you how to use an array with a dictionary so you wont have to cast , and use tokens like you where suggesting to this new user.

    Maybe Ashley or someone else can answer before i am done with my work.

    Really surprises me how many people on the forums do not know about array. They are the backbone to programming. Most people learn about them the same time they learn about Str, Int, and Float.

    Don't worry, I know how to use arrays..

    I also know how to put them inside a container, so you can use them like instance variables..

    For something as simple as a list I prefer using the dictionary object with the possibility of adding to the string by append and creating a visual list with a simple function using tokencount and tokenat..

    I guess that's just personal preference..

  • I guess that's just personal preference..

    You might try arrays, they sort much faster iirc.

    @Magistross Ah yes! I understand.

    At I thought he meant there is no Bullet list like HTML at first because he was using the <li> thing. Then I though he meant how to make something with the same functionality.

    I really love your Tile AI plugin. When I first installed it yesterday, it made me want to quit my current project and start one using this great new add-on to C2! I immediately thought i gotta make an "Ultima III" clone!

    Have a nice day everyone I have work to do.

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