User Tag List

Results 1 to 10 of 10

Thread: Having a brainfart with a listbox

  1. #1
    Forum Moderator

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Perry's Avatar
    Join Date
    Dec 2013
    Location
    Watertown, WI
    Posts
    4,392
    Mentioned
    58 Post(s)
    Tagged
    0 Thread(s)

    Having a brainfart with a listbox

    If I have a list box with

    1
    2
    3
    4
    5
    6

    and I only want to remove the last X amount of items, how do I do with a loop ?
    So if X = 2
    the result is
    1
    2
    3
    4

    I was thinking about

    Start loop "deletelines" 2 times

    on loop "deletelines"
    - Listbox: Delete LoopIndex("deletelines") - 2
    or
    - Listbox: Delete 2 - LoopIndex("deletelines")
    or
    List Nb Lines( "checklist" ) - LoopIndex("deletelines")

    but none of them work


    but that ain't it..

    Anyone able to resolve my brainfart?

    Thanks

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    chrilley's Avatar
    Join Date
    Jul 2006
    Posts
    962
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    If I understand correctly then this should do the trick:

    * On loop "delete"
    List : Delete line List Nb Lines( "List" )


    Made a quick example to show what I mean.
    Attached files Attached files

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,363
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Make sure the list object is set to 0 index in the properties. Always delete the bottom line. Retrieve the number of list items to find it. When you delete a line, the length of the list is reduced by 1, and so is the index of the last item.

  4. #4
    Forum Moderator

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Perry's Avatar
    Join Date
    Dec 2013
    Location
    Watertown, WI
    Posts
    4,392
    Mentioned
    58 Post(s)
    Tagged
    0 Thread(s)
    Thank you all

    List : Delete line List Nb Lines( "List" ) did the trick...
    I shouldn't have added the rest behind it...
    Knew it was something stupid lol

  5. #5
    Forum Moderator

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Perry's Avatar
    Join Date
    Dec 2013
    Location
    Watertown, WI
    Posts
    4,392
    Mentioned
    58 Post(s)
    Tagged
    0 Thread(s)
    i had the box unchecked for the listbox 1 based index.. did not know that it was adding the items backwards in the list.. is that normal? @Yves

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleFirefly 3D ModuleInstall Creator Pro
    twister's Avatar
    Join Date
    Jan 2007
    Location
    Pacific Northwest USA
    Posts
    349
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Hi Perry, this is from the list help file.

    Sort. If checked, the entries of the list will be sorted in alphabetical order.

    1-based index. If not checked, the first line of the list will have number 0. If checked, it will have number 1. This is a personal choice of yours. Programmers usually choose 0 based indexes.

    Add a Line
    The Add a Line action adds a line of text to the bottom of the List object.

    Insert a Line
    The Insert a Line action inserts a line of text into the List object. Note: if you use -1 as index (or 0 if the indexes begin from 1), the line is added to the end of the list.

    I personaly test the total line number to the start delete line number, thus deleting the remainder of line numbers, stopping when total equals start +1 /- 1.

  7. #7
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,341
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    That lists are sorted alphabetically, and not numerically, is an important point if your list enters double-digits.
    It means for example, that "10" will be sorted ahead of "2", because "1" comes before "2" - unless you manually add leading zeroes (ie. make it "02").

    The easy way (for positive integers) is to say:

    right$( "00" + str$( value ), 3)

    ...where the number on the right (3) is the desired number of digits, and the number of zeroes in the string is one less than that.

    Fortunately, CF2.5's val() function will ignore leading zeroes, so getting the original number out of the list again is not a problem.

    If you ever need a method that works for floats as well as integers, you will need to add both leading and trailing zeroes (you can use "len( str$(val mod 1))" to get the number of digits after the decimal point), or use multiplication to shift the decimal point, and then ignore everything after.

  8. #8
    Forum Moderator

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Perry's Avatar
    Join Date
    Dec 2013
    Location
    Watertown, WI
    Posts
    4,392
    Mentioned
    58 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by twister View Post
    Hi Perry, this is from the list help file.

    Sort. If checked, the entries of the list will be sorted in alphabetical order.

    1-based index. If not checked, the first line of the list will have number 0. If checked, it will have number 1. This is a personal choice of yours. Programmers usually choose 0 based indexes.

    Add a Line
    The Add a Line action adds a line of text to the bottom of the List object.

    Insert a Line
    The Insert a Line action inserts a line of text into the List object. Note: if you use -1 as index (or 0 if the indexes begin from 1), the line is added to the end of the list.

    I personaly test the total line number to the start delete line number, thus deleting the remainder of line numbers, stopping when total equals start +1 /- 1.


    Thanks.

    I use Insert Line "1" , 0
    I use Insert Line "2" , 0
    I use Insert Line "3" , 0

    when it's checked I get

    1
    2
    3

    but unchecked it is

    3
    2
    1

  9. #9
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleFirefly 3D ModuleInstall Creator Pro
    twister's Avatar
    Join Date
    Jan 2007
    Location
    Pacific Northwest USA
    Posts
    349
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    @Perry . Yes, I get the same result because the insert line number is always 0 (zero) on all three. Insert Line "1" , 0; Insert Line "2" , 0; Insert Line "3" , 0. Always inserting at line number 0 gives that result which gives the appearance of being backwards.

    Insert a Line
    The Insert a Line action inserts a line of text into the List object. Note: if you use -1 as index (or 0 if the indexes begin from 1), the line is added to the end of the list.

    But if 1-base index is unchecked, the insert line number start should be 0, and cheched 1. For some reason it still works.

    Sequencial line numbering: If checked it works if I used sequencial line numbering starting at line 1, Insert Line "1" , 1; Insert Line "2" , 2; Insert Line "3" , 3. If unchecked it did not work. I had to change the starting line to 0 (zero) Insert Line "1" , 0; Insert Line "2" , 1; Insert Line "3" , 2.

    Hope this helps, and it is a mind bender

  10. #10
    Forum Moderator

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Perry's Avatar
    Join Date
    Dec 2013
    Location
    Watertown, WI
    Posts
    4,392
    Mentioned
    58 Post(s)
    Tagged
    0 Thread(s)
    no kidding lol. I guess I never realized that in all those years.
    but got that part all fixed now.. updating my other boxes, so that things will match again..

Similar Threads

  1. Get ID of Group into Listbox?
    By warlords in forum Fusion 2.5
    Replies: 0
    Last Post: 4th November 2018, 08:24 AM
  2. Replies: 2
    Last Post: 27th August 2018, 07:36 AM
  3. Total brainfart trying to figure out a random range
    By Del_Duio in forum Fusion 2.5
    Replies: 1
    Last Post: 9th February 2017, 03:28 PM
  4. Copy Listbox Data to another Listbox Example
    By Stephen in forum File Archive
    Replies: 3
    Last Post: 26th April 2009, 05:16 PM
  5. listbox algorithm question
    By reptilezero in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 14th August 2006, 06:14 PM

Posting Permissions

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