[Class] DEDialogs - Files and input dialogs
The attached class is an addition to the already many solutions to such dialog.
This one has the following features:
1. It is modal-like, so the result is returned to the same sub that launched the request . Events are limited to the dialog events.
2. Flexibility in the appearance - size, colors, textsize.
3. Length is adjusted to the number of files.
4. A single filter or a list of filters.
5. Enable or disable browsing from the pre-defind directory.
6. Single or multiple files selection (returned as a string or a list)
7. File name can be returned with or without the full path.
Explanation and question:
the 1 feature is achieved by using this piece of code in the "show" sub:
The loop is waiting for the buttons click events and then return the result.
I found that the doevent allows click events but not events like keyboard keying or list_ItemClick of a listview - they are just ignored. While doing the message class [Class] Message I found that if a dialog like this is launched by activity_keypress, it doesn't work also. I have read what Agraham wrote in his Dialog library but understood only partly and whould like to get better understanding.
Anyway - this class works, I'll be glad to have feedback.
Edit: some improvements , better look.
Edit: Orientation change is not performed while the dialog is on !
Edit:
Class name was changed to DEDialogs as the following methods were included:
- GetSingleFile - to select an existing file
- GetSeveralFiles - to select several files to a list
- SetFileName - to create a new file or select an existing file
- GetInput - to get input from the user
- SetSort - to define type and direction of sorting the list
Edit: ver updated to 1.1 :
- added SetButtomsText - to change the text of "Ok" and "Cancel" from default
- added parameter of header text in SetInput.
Edit: ver 1.2 better adaptation to various screen sizes.
Edit: ver 1.3 added sort by date using this http://www.b4x.com/android/forum/threads/sorting-of-filelist.18337/#post-108770 and added method SetSort to define type and direction of sorting the list.
A bug in input ET color was fixed.
Edit: ver 1.4 includes correction for item line height in tablets.
Edit: ver 1.5 compatible with b4a ver. 7 (wait for)
The attached class is an addition to the already many solutions to such dialog.
This one has the following features:
1. It is modal-like, so the result is returned to the same sub that launched the request . Events are limited to the dialog events.
2. Flexibility in the appearance - size, colors, textsize.
3. Length is adjusted to the number of files.
4. A single filter or a list of filters.
5. Enable or disable browsing from the pre-defind directory.
6. Single or multiple files selection (returned as a string or a list)
7. File name can be returned with or without the full path.
Explanation and question:
the 1 feature is achieved by using this piece of code in the "show" sub:
B4X:
result = 0
Do While result = 0
DoEvents
Loop
If result = DialogResponse.POSITIVE Then
Return ret
Else
Return DialogResponse.CANCEL
End If
I found that the doevent allows click events but not events like keyboard keying or list_ItemClick of a listview - they are just ignored. While doing the message class [Class] Message I found that if a dialog like this is launched by activity_keypress, it doesn't work also. I have read what Agraham wrote in his Dialog library but understood only partly and whould like to get better understanding.
Anyway - this class works, I'll be glad to have feedback.
Edit: some improvements , better look.
Edit: Orientation change is not performed while the dialog is on !
Edit:
Class name was changed to DEDialogs as the following methods were included:
- GetSingleFile - to select an existing file
- GetSeveralFiles - to select several files to a list
- SetFileName - to create a new file or select an existing file
- GetInput - to get input from the user
- SetSort - to define type and direction of sorting the list
Edit: ver updated to 1.1 :
- added SetButtomsText - to change the text of "Ok" and "Cancel" from default
- added parameter of header text in SetInput.
Edit: ver 1.2 better adaptation to various screen sizes.
Edit: ver 1.3 added sort by date using this http://www.b4x.com/android/forum/threads/sorting-of-filelist.18337/#post-108770 and added method SetSort to define type and direction of sorting the list.
A bug in input ET color was fixed.
Edit: ver 1.4 includes correction for item line height in tablets.
Edit: ver 1.5 compatible with b4a ver. 7 (wait for)
Attachments
Last edited: