Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    475

    ListBox Troubles

    Hi there,

    I'm trying to put 2 values into itemtext (listbox items).
    For example; first value the time, and second value some text or date.

    time = System.GetTime(TIME_FMT_MIL);
    ListBox.AddItem("ListBox1", time, "Some text.");

    It seems these two values can't get along. The first value shows up the second doesn't.:mad:

    I tried to do the same with the paragraph but same results, the first value shows up the second doesn't. How can i put more than one value (different than text) into paragraph, input object or listbox?

    Does anybody knows how this problem can be solved?

    Thank you.

  2. #2
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Hi. You can concatenate a variable to a string by using the .. operator, i.e.:

    firstName = "John";
    Dialog.Message("Message Title", firstName, " is your first name.");

    doesn't work... The correct way is:

    firstName = "John";
    Dialog.Message("Message Title", firstName.." is your first name.");

    Try it out, this will display a message box with the text "John is your first name."... You can pretty much freely concatenate values like that wherever you like...

    Corey Milner
    Creative Director, Indigo Rose Software

  3. #3
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    475
    Well thank you

    It works.

  4. #4
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Cool...

    Corey Milner
    Creative Director, Indigo Rose Software

  5. #5
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    475
    Hello Corey,

    Thank you for your help.

    Another thing, what you gave me works fine but when i do this;
    ListBox.AddItem("ListBox1", date.. time.. "some text", "");
    i get this; (12/27/200307:44:50some text).
    Surely must be some kind of ........... to make them split from each other but i don't know it. Would you tell it to me please?

    Thank you

  6. #6
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Hi. No spaces between the .. and the quote i.e.:

    Dialog.Message("Your Title", myDate..myTime.." is this...");

    Or if you need to add a space:

    Dialog.Message("Your Title", myDate.." "..myTime.." is this...");

    Just FYI keep in mind when you are naming variables to avoid the reserved keywords, i.e. the following words are reserved and cannot be used for variable or function names:

    and
    break
    do
    else
    elseif
    end
    false
    for
    function
    if
    in
    local
    nil
    not
    or
    repeat
    return
    table
    then
    true
    until
    while



    Corey Milner
    Creative Director, Indigo Rose Software

  7. #7
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    475
    Thanks for your time.
    Last edited by sside; 12-27-2003 at 12:41 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts