Sorting images using filename on Scrollview

Asmoro

Active Member
Licensed User
Longtime User
Hi all,

As the title says, does anyone know an useful example or code for this handling.

After a lot of reading here, it seems that List.Sort will do the thing,
but only with strings and numbers and not with filenames. (correct me if I'm wrong)

Sorting in alphabet (upper/low case), combining letters and numbers etc.
using buttons or tabhost is something that I really want to know.

In case someone wants to experiment, attached a test project made with Klaus underneath.

Thanks for now.
 

Attachments

  • ScrollViewList.Sort test.zip
    13.7 KB · Views: 179

Asmoro

Active Member
Licensed User
Longtime User
Hi Klaus,

Ok, I get it, but users are allowed to save an image with upper and low
cases text and numbers within.
That means no matter the input, the sorting has to be functioning well.
(if you want to sort a character "B" or "b", it still catch the b character.)

In your project, retrieving the flags on the scrollview are not displayed
in alphabetically order.

So, could you give me some code(example) to start with
to get some idea how has to be done.

Unfortunately no examples at hand here.
 
Last edited:
Upvote 0

Asmoro

Active Member
Licensed User
Longtime User
Thanks Klaus, you're the best.:sign0188:

Meanwhile I managed to use a little peace of code from someone else
to get it right.

And it did the trick, but not really perfect with this code in button click event:

B4X:
If Files.Size > 0 Then
   Files.Sort(True)
End If

Just what you've said, very casesensitive.
I presume that not every user thinks about upper and lowcases when
they're doing some text input.

One more thing though:

I have several textinput in the filename and want to catch one of these for sorting.
Do I have to make some space between or "_" or .....

Example: filename= England Big Ben clock history.jpg or England_Big Ben_clock_history.jpg
 
Upvote 0

Derek Johnson

Active Member
Licensed User
Longtime User
Hi all,

In case someone wants to experiment, attached a test project made with Klaus underneath.

The attached project has a missing library:

Error description: Unknown type: customdialog2
Are you missing a library reference?
Occurred on line: 51
Dim cd As CustomDialog2
 
Upvote 0
Top