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,760
  • Dialogs3.00.zip
    48.9 KB · Views: 2,777
  • Dialogs4.01.zip
    72.2 KB · Views: 9,037
Last edited by a moderator:

agraham

Expert
Licensed User
Longtime User
Works fine for me!
B4X:
   ...   
   Dim lv As ListView
   lv.Initialize("lv")
   lv.AddSingleLine("one")
   lv.AddSingleLine("two")
   lv.AddSingleLine("three")
   pnl.AddView(lv, 300dip, 120dip, 120dip, 250dip)
   
   cd.AddView(pnl, 77%x, 60%y) ' sizing relative to the screen size is probably best
   ret = cd.Show("B4A Custom Dialog", "Yes", "No", "Maybe", Bmp)      
End Sub

Sub lv_ItemClick (Position As Int, Value As Object)
   ToastMessageShow(Position, True)
End Sub
 

Inman

Well-Known Member
Licensed User
Longtime User
That is strange. My code is similar, except I used AddTwoLinesAndBitmap2. Must be some mistake of mine.

I will probably switch to Tabhost. Thanks for the help anyway.
 

netman200288

New Member
Licensed User
Longtime User
Thanks

Hi agraham.
Thanks for the useful insight. Yeah.. since it's a "feature", I guess there's nothing that can be done.

Once again.. thanks for the great work in producing the libraries!
 

brainfart

Member
Licensed User
Longtime User
Trouble setting ColorPicker palette

Hello,
I am probably messing up the Basic language syntax but i am not able to solve this problem.:BangHead:
I am trying to set the palette to a predefined colors. Here in my code they are bogus. I created an array of integers and there are 15 as required in the documentation. Then I copy / reference the array to the ColorPickerDialog.palette parameter.
The code compiles but at run time I get an error ".....java.lang.ArrayIndexOutOfBoundsException...."
What am I doing wrong?

Thanks.

B4X:
Dim result As Int
Dim CPD As ColorPickerDialog
Dim ColorZ() As Int
ColorZ = Array As Int(0xff0000,0x00ff00,0x0000ff,0xeeeeff,0x020202,0x777777,0x777777,0x777777,0x777777,0x777777,0x777777,0x777777,0x777777,0x777777,0x777777)
CPD.Palette = ColorZ
CPD.RGB = Main.ChrColor
result = CPD.Show("Pick Character Color","OK","Cancel","",Null)
 

brainfart

Member
Licensed User
Longtime User
I counted 15 :D
3 rows of 5 plus the current color but that one comes from the RGB parameter.
I even added a
B4X:
ToastMessageShow("Array Size: " & CPD.Palette.Length,True)
to see what it is by default and it returned 15.
I have verified that I am using dialogs version 2.6
So since the size of palette array is 15 and mine is 15 why do I get the error.
Is there a problem in my syntax CPD.Palette = ColorZ ?
 

thedesolatesoul

Expert
Licensed User
Longtime User
Hello Andrew,
I am seeing a small issue with the Time dialog (probably affects date dialog as well).
When you enter the time with the virtual keyboard, and click done, the time doesnt return correctly. Only if you use the +/- buttons or the edit text (for minutes/hours) loses focus, only then the correct time is returned.
 

ostau

Member
Licensed User
Longtime User
Hide soft keyborad

Hallo Graham,

hopefully I didn´t miss a previous entry. I´m using your component and it´s very usefull. But the user has always to click twice on the ok-Button with this code:

Dim GetPW As InputDialog
GetPW.PasswordMode = True
GetPW.Input = ""
GetPW.Hint = "Bitte Passwort eingeben"
ret = GetPW.Show("Passwort","Passwort eingeben", "OK","","",Null)

(one on the ok-Button of the dialog, the second click to close the soft keybord.
Is there a way to hide the soft keyboard with the click on the dialog´s OK-button?

Kind regards, Oskar
 

agraham

Expert
Licensed User
Longtime User
As from version 2.4 of the Dialogs library pressing any of the three Dialog buttons in the InputDialog and the two CustomDialogs with the keyboard displayed should close both the dialog and the keyboard. It does this on both my ZTE Blade (2.1) and my Motorola Xoom (3.2). If it does not do it on your device then it must be a "feature" of that device.
 

ostau

Member
Licensed User
Longtime User
As from version 2.4 of the Dialogs library pressing any of the three Dialog buttons in the InputDialog and the two CustomDialogs with the keyboard displayed should close both the dialog and the keyboard. It does this on both my ZTE Blade (2.1) and my Motorola Xoom (3.2). If it does not do it on your device then it must be a "feature" of that device.

Hallo Graham,
thanks for your quick reply and my late one:). I´m using the Galaxy Tab 7 (P1000) with V2.2. I checked the behaviour: on my device the keyboard is closed when the dialog appears. When clicking on the input text, the keyboard is shown. Any idea?

Kind regards, Oskar
 

vb1992

Well-Known Member
Licensed User
Longtime User
"It seems to be a "feature" of the actual Android DateDialog that if you enter a number by the keyboard it doesn't "stick" until you press + or - or move the focus to another date element. I am afraid that I don't think there is anything I can do in the library as there is no interaction possible in code with the dialog between showing it and receving the values back when the user closes it."

Andrew, is there a way for the TimeDialog to not allow the keyboard to pop up, so this problem can't surface, thanks
 

Steve

Member
Licensed User
Longtime User
Trapping the Enter key in the input dialog

Hi Agraham,

Thanks loads for the useful Dialogs library. Not being a real UI expert this saves me a lot of time developing my apps. :)

I am using an input dialog to let users perform searches from within my app. The dialog itself works perfectly except for something one of my users has asked for, and that is for the Enter key on either a physical keyboard or D-pad to be synonymous with clicking OK. Is this possible to do with the Dialogs library?

Thanks,
Steve
 

DemoFreak

Member
Licensed User
Longtime User
Hi,

is there an elegant method to let the user input an ip address?

When I set the InputDialog.INPUT_TYPE_DECIMAL_NUMBERS one can only enter a single dot, but also a minus sign.

Sure, I'll check the user input with regex, but it would be nice if the user can't even enter "wrong" characters.
 
Status
Not open for further replies.
Top