Xojo Conferences
MBSOct2019CologneDE

Listbox sorting numbers (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: ODBC login question...
Next thread: what is the best way to load images once?


Re: Jaguar RB?   -   German Bauer
  Listbox sorting numbers   -   Chris Bartlett
   Re: Listbox sorting numbers   -   Charles Yeomans
    Re: Listbox sorting numbers   -   Chris Bartlett
     Re: Listbox sorting numbers   -   Christian Miller
     Re: Listbox sorting numbers   -   Charles Yeomans
     Re: Listbox sorting numbers   -   Joe Huber
    Re: Listbox sorting numbers   -   Mike B
    Re: Listbox sorting numbers   -   Chris Bartlett

Listbox sorting numbers
Date: 07.05.02 18:52 (Tue, 7 May 2002 13:52:03 -0400)
From: Chris Bartlett
Is there a way to get a listbox to sort a column of numbers numerically
rather than alphabetically (that is, get it to sort 1,2,10, not 1,10,2).

-chris

<http://www.mythtech.net>

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Listbox sorting numbers
Date: 07.05.02 18:59 (Tue, 7 May 2002 13:59:33 -0400)
From: Charles Yeomans
If you're using RB 4, then this is very easy to do; read about the
CompareRows event in the Listbox documentation. Prior to v.4, some sort
of cleverness is required.

Charles Yeomans

On Tuesday, May 7, 2002, at 01:52 PM, Chris Bartlett wrote:

> Is there a way to get a listbox to sort a column of numbers numerically
> rather than alphabetically (that is, get it to sort 1,2,10, not 1,10,2).
>
> -chris
>
> <http://www.mythtech.net>


---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Listbox sorting numbers
Date: 07.05.02 19:12 (Tue, 7 May 2002 14:12:05 -0400)
From: Chris Bartlett
>If you're using RB 4, then this is very easy to do; read about the
>CompareRows event in the Listbox documentation. Prior to v.4, some sort
>of cleverness is required.

Yeah, I'm using 3.2.1.

Looks like I have a growing list of reasons to upgrade for projects that
don't need 68k. (Interactive shell is the one that is really making me
take a hard look at upgrading, that would be REALLY nice for my win32
projects)

Thanks... I'll either be creative, or I might just be lazy and leave it
sorting wrong (it is just a looks thing, it won't impare the use of the
app)

-chris

<http://www.mythtech.net>

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Listbox sorting numbers
Date: 07.05.02 20:17 (Tue, 7 May 2002 15:17:54 -0400)
From: Christian Miller
I use 3.5.2 and am running into something similar. I have a list box
with "y" rows and 6 columns. When the user clicks to sort by column, I
am creating an array and loading it with the listbox contents. Sort the
array by the column that was clicked, clear out the listbox, and
repopulate it. It works a LOT faster than what it sounds. The only
problem is that I am gaining a row every once in a while, and haven't
figured out why yet.

On Tuesday, May 7, 2002, at 02:12 PM, Chris Bartlett wrote:

>> If you're using RB 4, then this is very easy to do; read about the
>> CompareRows event in the Listbox documentation. Prior to v.4, some
>> sort
>> of cleverness is required.
>
> Yeah, I'm using 3.2.1.
>
> Looks like I have a growing list of reasons to upgrade for projects that
> don't need 68k. (Interactive shell is the one that is really making me
> take a hard look at upgrading, that would be REALLY nice for my win32
> projects)
>
> Thanks... I'll either be creative, or I might just be lazy and leave it
> sorting wrong (it is just a looks thing, it won't impare the use of the
> app)

Re: Listbox sorting numbers
Date: 07.05.02 21:06 (Tue, 7 May 2002 16:06:00 -0400)
From: Charles Yeomans

On Tuesday, May 7, 2002, at 02:12 PM, Chris Bartlett wrote:

>> If you're using RB 4, then this is very easy to do; read about the
>> CompareRows event in the Listbox documentation. Prior to v.4, some
>> sort
>> of cleverness is required.
>
> Yeah, I'm using 3.2.1.
>
> Looks like I have a growing list of reasons to upgrade for projects that
> don't need 68k. (Interactive shell is the one that is really making me
> take a hard look at upgrading, that would be REALLY nice for my win32
> projects)
>
> Thanks... I'll either be creative, or I might just be lazy and leave it
> sorting wrong (it is just a looks thing, it won't impare the use of the
> app)
>

I'm writing a sorting listbox for v.3 users which works somewhat like
the version 4 listbox. I'll finish it up here in a hour or so.

Charles Yeomans


---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Listbox sorting numbers
Date: 08.05.02 03:32 (Tue, 7 May 2002 19:32:40 -0700)
From: Joe Huber
>Thanks... I'll either be creative, or I might just be lazy and leave it
>sorting wrong (it is just a looks thing, it won't impare the use of the
>app)

Chris

One of the 'creative' approaches that I used is to pad the number
string on the left with space characters. This causes RB's
alphabetical sort to yield numerically ascending results.

NumString = right(" "+format(Number,"0"))

I filled the leading string with the HardSpace character
(Option-Space) which is the same width as the numeric characters in
most fonts. So this approach has the added benefit of right aligning
your numbers so they look better in the listbox.

Hope this helps,
Joe Huber

Re: Listbox sorting numbers
Date: 07.05.02 20:20 (Tue, 07 May 2002 21:20:18 +0200)
From: Mike B
On 7/5/02 21:04, "REALbasic Network Users Group"
<<email address removed>> wrote:

I had the same problem a while back and was told by someone on the list to
use 01, 02, 03 etc, th numbers would read... 08, 09, 10, 11 etc

If you can suffer the "0" on the beguining of the digits under 10 then it
works fine.

Hope this helps
Mike

>> If you're using RB 4, then this is very easy to do; read about the
>> CompareRows event in the Listbox documentation. Prior to v.4, some sort
>> of cleverness is required.
>
> Yeah, I'm using 3.2.1.
>
> Looks like I have a growing list of reasons to upgrade for projects that
> don't need 68k. (Interactive shell is the one that is really making me
> take a hard look at upgrading, that would be REALLY nice for my win32
> projects)
>
> Thanks... I'll either be creative, or I might just be lazy and leave it
> sorting wrong (it is just a looks thing, it won't impare the use of the
> app)


---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Listbox sorting numbers
Date: 08.05.02 03:50 (Tue, 7 May 2002 22:50:51 -0400)
From: Chris Bartlett
>Chris
>
>One of the 'creative' approaches that I used is to pad the number
>string on the left with space characters. This causes RB's
>alphabetical sort to yield numerically ascending results.
>
>NumString = right(" "+format(Number,"0"))
>
>I filled the leading string with the HardSpace character
>(Option-Space) which is the same width as the numeric characters in
>most fonts. So this approach has the added benefit of right aligning
>your numbers so they look better in the listbox.

Ooh.... I like that better than what I was going to do.

I was going to zero pad them, but doing so was going to make me have to
strip the zero back off when I dump the data to text (for some reason,
the client this is for finds it unacceptable to have zero padded
numbers... but they never see the application the text file is made from).

If I space pad them, I don't have to worry about stripping the zero back
off, I can just leave the space there when I dump to text.

Thanks

-chris

<http://www.mythtech.net>

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>