NB Function - Advanced Listbox Functions

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Locked
User avatar
dpayer
Posts: 1394
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

NB Function - Advanced Listbox Functions

Post by dpayer »

UPDATE: April 7, 2016
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"
In this case the list box is named ListBox2 and the variable that holds the selected items is [listbox2]. Don't use the brackets when calling the function.

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.

Image

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.
Last edited by dpayer on Thu Apr 07, 2016 1:46 pm, edited 1 time in total.
User avatar
Wrangler
Posts: 1531
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA
Contact:

Post by Wrangler »

Good stuff, David. Thanks!
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
Luiz Alfredo
Posts: 198
Joined: Thu Apr 19, 2007 6:58 am
Location: Brazil

Post by Luiz Alfredo »

Very good. Thanks.
L.A.G.M.
User avatar
andybrock
Posts: 181
Joined: Mon Apr 20, 2009 1:38 pm
Location: Somerset, UK
Contact:

Re: NB Function - Advanced Listbox Functions

Post by andybrock »

Just wanted to say thank you for this. I know you posted it a while ago, but it just came in really handy for me :)

Andy
What I do and How I do it. - http://andybrocklehurst.com
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: NB Function - Advanced Listbox Functions

Post by Gaev »

David Payer:

Came to this post from here

You might consider adding these functionalities (with suggested action names in brackets)...

a) Rearrange the entries within a ListBox in Reverse Sorted Order (ReverseSort ?)

b) Copy selected items AND rearrange the resulting items in Reverse Sorted Order (CopyReverseSort ?)

c) Move selected items AND rearrange the resulting items in Reverse Sorted Order (MoveReverseSort ?)

d) Import items AND rearrange the resulting items in Reverse Sorted Order (ImportReverseSort ?)


You might even consider giving users a choice of specifying a regular (forward) Sort Order for above functions.
User avatar
dpayer
Posts: 1394
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: NB Function - Advanced Listbox Functions

Post by dpayer »

Gaev wrote:David Payer:

Came to this post from here

You might consider adding these functionalities (with suggested action names in brackets)...

.
Thanks Gaev. I think it is time to revisit many of my posted functions as I can see they could use a bit of polishing.

David
David Payer
Des Moines, Iowa
USA
User avatar
fkapnist
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece
Contact:

Re: NB Function - Advanced Listbox Functions

Post by fkapnist »

I just added ListBoxFunctions to my library of Neobook functions.

Thank you.

:P
Locked