Hey John, On Mon, Jul 30, 2018 at 7:05 PM John DeSoi via 4D_Tech <4d_tech@lists.4d.com> wrote:
> The selected row numbers matter if you are not using ORDA or a fully > materialized collection of objects. I hesitant to comment directly on what you're doing because frankly you are frequently doing really sophisticated stuff I'm not at all sure I understand. With that caveat I will offer that I have encountered situations where I simply needed to do things a bit more old school - meaning I really wanted to be able to use a collection associated with a listbox but I just couldn't make it work. To get what I wanted I had to use an array based listbox and some code to manage the synchronization with the collection. It was less code than classic 4D and conceptually easier. You've probably noticed there are some other things you can't do directly to listboxes associated with collections: you can't sort the listbox - but you can sort the collection you can't add/delete rows to the listbox - you add elements to the collection I haven't tried dragging and dropping. You can add more columns to the listbox which can display data based on that element of the collection. I had a listbox/collection where each element refers to a graphic file. Basically the contents of each element are the new Path to object command (which is totally fabulous, BTW). I displayed the file name (This.name) and added a column that had a method as its data source. The method made a thumbnail of the image file and I passed the collection element as a parameter also using 'This'. There are some redraw issues but the basic premise works fine. What I couldn't do was simply add a picture column and have some external method loop through the listbox rows and populate that column with the picture even using the same method to create it. This may change but I think it's safe to say that if you need to need to have that sort of row-index selection information you don't want to associate the listbox with the collection but manage it yourself. I have 4D 16 interfaces for Spotify and Apple Music that implemented lazy > loading using a "fake" selection of records. Collection based list boxes > make it possible to eliminate the table and support very powerful > generalized code (e.g. components). > It is cool. I think this is what Thomas means by 'use a variable like the database.' I also find it strange that I can select rows with a single API call, but > determining the selected rows takes 3 different methods depending on the > type of list box. True. Array based listboxes work one way, selection based ones another and now collection based ones a third. They are three different types of data even if managed through the same interface. With the selected rows, I can easily iterate over the rows for any of the > different listbox types. > I think this is exactly what the new For each structure is meant to do - iterate over the selected elements. You don't need to know the indices if all you need is the elements. But it sounds like you want the row numbers to sync with the other data. In that case I don't think you have a choice besides an array based listbox. -- Kirk Brooks San Francisco, CA ======================= *We go vote - they go home* ********************************************************************** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************