Source language: Translate to:

NB Function - Advanced Listbox Functions

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

NB Function - Advanced Listbox Functions

Postby dpayer » Fri Apr 06, 2012 1:48 pm

UPDATE: April 7, 2016
I have written an update that does some of these functions better. See this link:

viewtopic.php?f=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
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby Wrangler » Sat Apr 07, 2012 7:41 am

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
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Luiz Alfredo » Sun Apr 08, 2012 5:49 pm

Very good. Thanks.
L.A.G.M.
Luiz Alfredo
 
Posts: 195
Joined: Thu Apr 19, 2007 6:58 am
Location: Brazil

Re: NB Function - Advanced Listbox Functions

Postby andybrock » Thu Oct 10, 2013 7:21 am

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
andybrock
 
Posts: 181
Joined: Mon Apr 20, 2009 1:38 pm
Location: Somerset, UK

Re: NB Function - Advanced Listbox Functions

Postby Gaev » Mon Mar 28, 2016 7:47 am

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
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: NB Function - Advanced Listbox Functions

Postby dpayer » Mon Mar 28, 2016 8:58 am

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
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: NB Function - Advanced Listbox Functions

Postby fkapnist » Wed Apr 26, 2017 9:59 am

I just added ListBoxFunctions to my library of Neobook functions.

Thank you.

:P
User avatar
fkapnist
 
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest