B4A Library Dialogs library

Status
Not open for further replies.
This library contains several modal, that is blocking, dialogs by which the user can enter data. Presently they are an InputDialog for numbers and text, a TimeDialog for times and and a DateDialog for dates.

Note that modal dialogs can close unexpectedly and not return to your code if the Activity needs to close, most likely because the user rotated the device. There is a brief discussion of this in the overall library help in the xml. This can also occur with the Basic4android modal dialogs InputList, InputMultiList, Msgbox and Msgbox2 whose modal mechanism is used by the dialogs in this library.

Edit : - Version 1.1 posted with minor bug fix. See post #6 for details.

Edit : - Version 1.2 posted with Color dialogs. See post #16 for details.

Edit : - Version 1.3 posted with bug fix. See post #19 for details.

Edit : - Version 1.4 posted with a Number dialog. See post #20 for details.

Edit : - Version 1.5 posted with some enhancements. See post #28 for details.

Edit : - Version 1.6 posted with a File Dialog. See post #30 for details.

Edit : - Version 1.7 posted with a minor UI change. See post #33 for details.

Edit : - Version 1.8 posted with a Custom dialog. See post #37 for details.

Edit : - Version 1.9 posted with a bug fix. See post #42 for details.

Edit : - Version 2.0 posted with a bug fix. See post #48 for details.

Edit : - Version 2.1 posted with a second Custom dialog. See post #68 for details.

Edit : - Version 2.2 posted. See post #75 for details.

Edit : - Version 2.3 posted. See post #90 for details.

Edit : - Version 2.4 posted. See post #135 for details.

Edit : - Version 2.5 posted. See post #148 for details.

Edit : - Version 2.6 posted. See post #155 for details.

Edit : - Version 2.7 posted. See post #168 for details.

Edit : - Version 2.8 posted. See post #206 for details.

Edit :- Version 2.91 posted by Mildev. See post #317 for details. His version 2.91 is based on my unpublished v2.9 which set the text box in FileDialog to SingleLine mode.

Edit : - Version 2.92 posted. See post #341 for details.

Edit (Erel): Version 3.00 posted. Developers using B4A v6.80+ should use this version.

V4.01 is released with several improvements: https://www.b4x.com/android/forum/t...-dialogs-and-async-methods.80204/#post-507930

B4A version | Dialogs library version
------------------------------------
7.0+ 4+
6.8 3.00
<6.8 2.92
 

Attachments

  • Dialogs2.92.zip
    59.4 KB · Views: 12,994
  • Dialogs3.00.zip
    48.9 KB · Views: 2,946
  • Dialogs4.01.zip
    72.2 KB · Views: 9,560
Last edited by a moderator:

aklisiewicz

Active Member
Licensed User
Longtime User
I did that, but the library is still not on the list, I'm not getting why some of the libraries register fine and some don't (?)
Now getting to the App:
It compiles fine and runs but the only thing I can get from it is a student list. Nothing else. I see there are some procedures defined (i.e. FillStudentsTable, ExportToJSON etc.) but it seems like there is no access to it. I would suggest when posting an example like this to put some description as what the App supposed to do, otherwise it is confusing for newbies like me.

Arthur
 
Last edited:

klaus

Expert
Licensed User
Longtime User
Where did you install B4A ?
Is it in C:\Program Files\Anywhere Software\Basic4android ?

In your previous post you say that you copied the files to
C:\Program Files\Anywhere Software\Basic4android\Libraries\Dialogs2.2

You must copy Dialogs.jar and Dialogs.xml to
C:\Program Files\Anywhere Software\Basic4android\Libraries
with their orignal names.

Best regards.
 
Last edited:

aklisiewicz

Active Member
Licensed User
Longtime User
OK, I thought if I could store it in subfolder (it would be more organized this way). Also I did not expect to close and reopen application for see the changes. After copying to the main LIB folder I can see it now, but

when I compile an example I still get error:


Compiling code. Error
Error parsing program.
Error description: Unknown type: colordialog
Are you missing a library reference?
Occurred on line: 71
Dim cd As ColorDialog



Thank you - Arthur
 

aklisiewicz

Active Member
Licensed User
Longtime User
that was it, I checked it and it works.
This library looks great, I really love it!
Thank you for your time.



PS>
one other problem I have (but it is not related to your App only) is the timeout message I get while compiling some Apps (including yours), and without pushing it further it sits there with this message on the screen. do you know if there is any way to resolve this ?

Arthur
 

Christian

Member
Licensed User
Longtime User
Hi Andrew,

thank you for supplying the dialogs library. When using the code below and entering a number like 12.3 the number dialog returns 123 thus not returning the decimal separator. Do you have any idea what goes wrong?

With regards

Christian

B4X:
'using dialogs library version 2.2
Sub Globals
   Dim lblInput As Label
   Dim nd As NumberDialog
End Sub

Sub Activity_Create(FirstTime As Boolean)
   lblInput.Initialize("lblInput")
   lblInput.Color=Colors.White
   lblInput.TextColor=Colors.Black
   lblInput.TextSize=30
   Activity.AddView(lblInput,10,10,60,30)
   nd.Digits=4
   nd.Decimal=1
   nd.ShowSign=True
End Sub

Sub lblInput_Click
   nd.Show ("","OK","","",Null)
   lblInput.Text=nd.Number
End Sub
 

klaus

Expert
Licensed User
Longtime User
one other problem I have (but it is not related to your App only) is the timeout message I get while compiling some Apps (including yours), and without pushing it further it sits there with this message on the screen. do you know if there is any way to resolve this ?
You could try to change the Timeout value.
Sometimes, I remove an existing Emulator and create a new one.

Best regards.
 

alfcen

Well-Known Member
Licensed User
Longtime User
Please write:

lblInput.Text = nd.Number / 10

or:

lblInput.Text = nd.Number / Power(10,nd.Decimal)

for multiple use.
 

IvanR

New Member
Licensed User
Longtime User
TimeDialog showing hour+1

Hi

Thank you for the great library. I'm using the TimeDialog with 24 hours format.

The TimeDialog shows always one hour later than what I set in xx.Hour, e.g.
this code snippet


Dim td As TimeDialog
Dim txt as String

txt = "18:35"

Td.Hour = DateTime.GetHour(DateTime.TimeParse(txt))
Td.Minute = DateTime.GetMinute(DateTime.TimeParse(txt))
Td.Is24Hours = True

ret = Td.Show("Enter time", "Time", "OK", "Cancel", "", Null)


shows "19:35" within the dialog.

Do I have to subtract 1 from the hour value before passing it to the TimeDialog?

Thank you in advance for your help!

Ivan
 

agraham

Expert
Licensed User
Longtime User
I assume, although you don't show it, that you must have changed DateTime.TimeFormat as with the default setting your code fragment throws an "Unparseable date" exception. Having inserted that in the code I do not see the effect you describe. The expected values of 18 and 35 are shown in the dialog.
B4X:
   Dim td As TimeDialog
   Dim txt As String
   txt = "18:35"
   DateTime.TimeFormat = "HH:mm"
   Td.Hour = DateTime.GetHour(DateTime.TimeParse(txt))
   Td.Minute = DateTime.GetMinute(DateTime.TimeParse(txt))
   Td.Is24Hours = True
   ret = Td.Show("Enter time", "Time", "OK", "Cancel", "", Null)
 

IvanR

New Member
Licensed User
Longtime User
Yes, you are right. I forgot to mention that I have changed the format as follows

DateTime.TimeFormat = "HH:mm"
 

vangogh

Active Member
Licensed User
Longtime User
wish... numeric keypad

the "getnumber" is a bit "strange". you compose a number using +/- on a predefined lenght...

what about a nice numeric keypad?

thanx
 

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
I have the following code in my app:

B4X:
Dim fi As String
Dim ret, ret2 As Int
Dim xx As Boolean
[FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] fd [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008b8b][FONT=Courier New][SIZE=2][COLOR=#008b8b][FONT=Courier New][SIZE=2][COLOR=#008b8b]FileDialog[/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
[SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New]fd.FastScroll = [/FONT][/SIZE][/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]fd.FilePath = [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]File[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2].DirDefaultExternal[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]fd.FileFilter = [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]".sav"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
ret = -2
 
Do While ret = -2
    fd.ChosenName = ""
    ret = fd.Show("Choose a deal to replay:", "Open", "Cancel", "Delete", Null) 
    If fd.ChosenName = "" Then Return
 
    If File.Exists(File.DirDefaultExternal, fd.ChosenName) = False Then
        Msgbox(fd.ChosenName & " does not exist.", "")
        ret = -2 ' repeat loop
 
    Else If ret = -2 Then
        ret2 = Msgbox2("Confirm: delete?", fd.ChosenName, "Yes", "No", "", Null)
        If ret2 = -1 Then
            xx = File.Delete(File.DirDefaultExternal, fd.ChosenName)
            If xx = False Then Msgbox(fd.ChosenName & " was not deleted.","")
        End If
    End If
Loop

I thought that I had read somewhere that the three options in fd.Show returned -1, -2, -3, but instead, it is returning -1, -3, -2 such that Cancel= -3 and Delete= -2. Is there something in my code causing this?

Also, I would like to add an option to email a file, but it appears that fd.Show is limited to 3 options. Is there a better way to accomplish all of this?
 

kickaha

Well-Known Member
Licensed User
Longtime User
Your code will also be easier to follow if you use DialogResponse.CANCEL etc instead of numbers.
 

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
Your code will also be easier to follow if you use DialogResponse.CANCEL etc instead of numbers.

If you check my code, you'll see that most of what I'm operating on is when the user has selected DELETE, which I substituted for NEGATIVE, so using DialogResponse.NEGATIVE (since there is obviously no .DELETE) wouldn't help the readability, I don't think.
 

kkolle

Member
Licensed User
Longtime User
Hi Andrew,

I´m using the TimeDialog!
When I´m using the keyboard to set the minutes to "00" I still get the initialized minutes.
I hope the attached screenshots could help!

Greetings from germany
 

Attachments

  • 01.jpg
    01.jpg
    16 KB · Views: 373
  • 02.jpg
    02.jpg
    12.3 KB · Views: 370
Status
Not open for further replies.
Top