Listbox Shorting

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Locked
User avatar
Dudus
Posts: 120
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Listbox Shorting

Post by Dudus »

Dear All,

can you please help me again? I have a listbox with these lines:
DE HU 2017-11-16
GB ES 2017-11-21
PL FR 2017-11-19

how can i make a button if I want to arrange by ascending and descending dates?
DE HU 2017-11-16
PL FR 2017-11-19
GB ES 2017-11-21

Thank you!
Dudus
User avatar
dpayer
Posts: 1394
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: Listbox Shorting

Post by dpayer »

Take a look at the options available on this listbox function:

http://neosoftware.com/community/viewto ... 22&t=21587
David Payer
Des Moines, Iowa
USA
User avatar
Dudus
Posts: 120
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: Listbox Shorting

Post by Dudus »

Thank you but im looking for an easier option without right click etc...
Any other easy solution? :)

Thank you!
D
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Listbox Shorting

Post by Gaev »

Dudus:

There is no easy way to sort items within NeoBook.

However, if your items are already stored on a file on disk, you can make use of the sort command offered in DOS ... something like this ...

Code: Select all

Run "sort" "/+7 c:\gk\unsorted.txt /O c:\gk\ascending.txt" "RunOnce+Wait+Hidden" "" ""

Run "sort" " /R /+7 c:\gk\unsorted.txt /O c:\gk\descending.txt" "RunOnce+Wait+Hidden" "" ""
... then load the sorted output into the Listbox.

Note 1: if your items are not on a disk file, you can always Loop through the items in the ListBox and write them out to a temporary file

Note 2: as I found out, this command does not work with folder/file names that contain spaces

Note 3: if you are running on a machine with a version of Windows older than XP, there is a slightly different syntax for the sort command ... see this web page for details ... https://www.computerhope.com/sorthlp.htm
User avatar
dpayer
Posts: 1394
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: Listbox Shorting

Post by dpayer »

Dudus wrote:Thank you but im looking for an easier option without right click etc...
Any other easy solution? :)

Thank you!
D
If ease is what you want, you can always hire someone to do your programming for you.

If you were to look at the functions, not just the demo app or the picture provided in the post, you would see that one of the functions is a sort. You don't even need to use the menuing option for that function. It is there for eye candy.

Read the full post. Download the function, look at the code that does the sorting (it is notated). It may be helpful.
David Payer
Des Moines, Iowa
USA
User avatar
virger
Posts: 540
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: Listbox Shorting

Post by virger »

Y si probas esta solucion ? Me cuentas como funciona
And if you try this solution? You tell me how it works

Code: Select all

{NeoBook 5 Objects}
NeoBookVer=5,80
ObjectType=3
Name=PushButton7
X=219
Y=14
W=80
H=30
Anchor=0
Align=2
ImageStyle=0
ObjAction=strparse "DE HU 2017-11-16`GB ES 2017-11-21`PL FR 2017-11-19`JN RD 2016-09-21`GU JN 2017-03-04" "`" "[arr]" "[nArr]"¶¶loop "1" "[nArr]" "[i]"¶.for (var i in arr) {¶        tempArr[i] = arr[i].match(/([^0-9]+)|([0-9]+)/g);¶        ¶setvar "[tempArr[i]]" "[arr[i]]"¶¶loop "¶        for (var j in tempArr[i]) {¶            if( ! isNaN(n = parseInt(tempArr[i][j])) ){¶                tempArr[i][j] = n;¶            }¶        }¶    }
LineColor=0
LineWidth=1
LineStyle=0
FillColor=14277081
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=9
COSTA RICA
PURA VIDA
User avatar
Dudus
Posts: 120
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: Listbox Shorting

Post by Dudus »

Gaev wrote: Run "sort" "/+7 c:\gk\unsorted.txt /O c:\gk\ascending.txt" "RunOnce+Wait+Hidden" "" ""

Run "sort" " /R /+7 c:\gk\unsorted.txt /O c:\gk\descending.txt" "RunOnce+Wait+Hidden" "" ""[/code]
Thank you Gave! This working fine for me :)
Dudus
User avatar
virger
Posts: 540
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: Listbox Shorting

Post by virger »

Magnifico, años de jugar con DOS y primera vez veo a plenitud el poder de SORT.
Gracias

Magnifico, years of playing with DOS and the first time I fully see the power of SORT.
Thank you
COSTA RICA
PURA VIDA
Locked