Replies: 3 comments 2 replies
-
@rvxfahim Nicely done! Although it would be nice to also work with the standard SD library It's still gets my vote for inclusion. I also would like the GUIslice API maximum scroll bar value to be optional and allow it to be replaced with a runtime dynamically computed value. As for long names, Java uses ellipsis (three dots) to indicate when a name is too long to fit in a list box. |
Beta Was this translation helpful? Give feedback.
-
@rvxfahim Ok, Here is my solution attached. So the idea is to get rid of your 2D char arrays and simply track the last position of a folder that was inserted into the listbox starting with zero position. Then when we come across a new folder we simply insert at that point and then increment last folder position by one. For simple files we just do an append not insertAt. Thus, all folders are placed at the top of the list and all simple files follow. Hard to explain but simple to code. One other point, you require walton.bmp be installed on the sd card. IMHO, we really shouldn't require a person to load it to view files on a random SD card I removed that and just use a plain background. Also, requiring a bmp to be loaded also means GUIslice needs to open the SD card and a conflict occurs because you set
now we simply use:
and the older SD library isn't needed or loaded. Since you had be using an array [50][30] which is 1500 bytes I used that size for the Listbox storage instead of your 500 in the Builder project file. Now with your version the "Enter" button is always enabled and if you press it on simple file you get and empty list. So my version enables this button only if you select a folder, otherwise the button is grayed out. Small details make an app more user friendly. Anyway, use what you want from my sample. Last point to run my version you will need to edit walden.ino and set your chipSelect back to SS since my SD needed to use 4. |
Beta Was this translation helpful? Give feedback.
-
@rvxfahim Something I forget to mention, If you have a name that can't fit in the listbox I truncate it and add ellipsis (...) Now another feature improvement you could make is to add a new Text field at the top, say 128 long and whenever someone selects a file or folder you fill that Text field in with the whole untruncated name. |
Beta Was this translation helpful? Give feedback.
-
After ironing out the small bugs I would be happy to see this demo be included in the examples of GUIslice
Here is a small demo clip:
https://youtu.be/XXgtdAwr-kg?t=19
Some feedback about the listbox:
The listbox starts empty. So there is now way to set the max scroll bar value(maybe I don't know how to), it can only be determined after the mcu boots and checks the SD card for files and directory. Hence I have to set the max scroll bar value at a large number during the design phase in GUIslice builder. so it would be nice to have a dynamic scrollbar along with a dynamic thumb size.
Long file names of directory/file has no space to show in the listbox, so if any file/directory name is bigger than the listbox width then the text overlaps on to the side of it. Suggestion: If an item in the listbox has a long name then make it scroll from left to right?
Here is my project file :
https://github.com/rvxfahim/walton
Beta Was this translation helpful? Give feedback.
All reactions