I have written an update that does some of these functions better. See this link:
http://neosoftware.com/community/viewto ... 22&t=21587
=====================================================================
Original post:
I have created a NB function (not JScript / VBS - just using NB commands) that enhances the use of the NB Listbox.
This will allow you to:
Move - selected items between listboxes
Copy - selected items between listboxes
Delete - if items are selected, these will be removed, otherwise the entire contents will be deleted.
Import - Import the contents of a variable array (which is what you get when you do a StrParse). Imported items will be appended to the Listbox and not replace existing items.
Export - Export the contents of a listbox to a variable array. The contents will append to the array and not replace the current contents.
Dedupe - remove duplicate listings from a ListBox. This can be set to be case sensitive, or not. I was able to remove duplicates from a 1000 entry listbox in less than 15 seconds with a compiled app.
There are 4 text parameters to this NB Function.
[%1] - the action you want to use (Move, Copy, Delete, Import, Export, DeDupe)
[%2] - primary listbox (moving FROM, copying FROM, deleting FROM, importing TO, exporting FROM, deduping in, etc.)
[%3] - secondary listbox (if used). Listbox you are moving TO, copying TO.
[%4] in Move, Copy & Delete - give the name (w/o brackets) of the variable that contains the selected items of the listbox. For Import/Export give the name (w/o brackets) of the variable array you are working with. For DeDupe - indicate yes if you require case sensitive search for duplicates ( example: Hello <> hello)
example:
Code: Select all
Call "ListBoxFunctions" "Move" "Listbox2" "Listbox1" "listbox2"
I have created a demo pub to show how these functions are used. You can enter lists via the entry boxes at the bottom. Box on right is multiline. Click "Set Listbox2 w/ entry list" to put the text in the right side listbox. Then highlite groups and move/copy delete them as desired.
If you click the "Add to Array" button, it will put that entry into the respective array for importing.
I have left some alertboxes in for clarity. They are easy to remove in the function.
Files:
ListBox Demo - compiled executable
ListBox Demo - NeoBook Pub file
NB Function file - must be placed in your NB installation folder / functions. Demo app calls it by ListBoxFunctions
Feedback is welcome.
David P.