Author Topic: [ListEntry] ### Format Instead Of #?  (Read 2690 times)

purplesanz

  • Newbie
  • *
  • Posts: 3
    • View Profile
[ListEntry] ### Format Instead Of #?
« on: March 23, 2020, 02:12:44 AM »
Is it possible to have a [ListEntry] that looks like this:

001
002
003
etc.

...instead of the default 1, 2, 3?

Thank you in advance.

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: [ListEntry] ### Format Instead Of #?
« Reply #1 on: March 23, 2020, 03:25:01 AM »
Use a magic function and return a string formatted how you wish. :)

purplesanz

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: [ListEntry] ### Format Instead Of #?
« Reply #2 on: March 23, 2020, 11:59:24 AM »
Thank you for your reply.

So far, I have this:

local listbox = fe.add_listbox( x, y, w, h );
listbox.charsize = 25;
listbox.align = Align.Left;
listbox.format_string = "[ListEntry]";

But I don't understand how to do what you said. Could you please give me an example? perhaps for 01 or 00001?

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: [ListEntry] ### Format Instead Of #?
« Reply #3 on: March 23, 2020, 12:21:37 PM »
maby like

listbox.format_string = "0[ListEntry]";

would be  ..
01-09
010-099
0100-0999   hmm

help a friend....

purplesanz

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: [ListEntry] ### Format Instead Of #?
« Reply #4 on: March 23, 2020, 12:39:11 PM »
That's exactly what I tried last night!

But what I'm trying to achieve, is:

001
009
010
099
100
101
etc.

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: [ListEntry] ### Format Instead Of #?
« Reply #5 on: March 23, 2020, 02:00:36 PM »
No. A magic function. Read the docs. There is a good example. Working OT at an atf facility so not home to provide examples myself, but can help if you get a start.

https://github.com/mickelson/attract/blob/master/Layouts.md#magic
http://www.squirrel-lang.org/doc/squirrel3.html

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: [ListEntry] ### Format Instead Of #?
« Reply #6 on: March 23, 2020, 03:13:51 PM »
mabey somthing like this not shure if it works

Code: [Select]
fe.add_text( "[ListEntry] [[ListSize]]",
0, 0, 400, 20 );

no...it dont :-\
« Last Edit: March 23, 2020, 03:20:28 PM by jedione »
help a friend....