B4A Library [Lib] BetterDialogs

I tried to improve the most useful dialogs of the Dialogs library. In my version, HTML tags are interpreted (even in the text of buttons), the InputBox uses a Masked EditText and has more options, you can check if the input is valid before closing the dialog, and the CustomDialog is fully customizable. I also solved an issue with the virtual keyboard.

MsgBox (under Gingerbread and JellyBean):

msgbox.png


InputBox (under Gingerbread and JellyBean):

inputbox.png


CustomDialog (under Gingerbread and JellyBean):

cd1.jpg


Another CustomDialog (under Gingerbread and JellyBean):

cd2.png


v1.1:
- I added a CloseDialog function;
- I added a margin parameter to the custom dialog.

v1.2:
- I fixed a bug in InputBox when there's a default value;
- I added the BackKeyPressed event for custom dialogs.

v1.3:
- I added a PasswordMode option to the InputBox;
- I added a CancelOnTouchOutside option.

v1.4:
- I added a CursorPosition option to the InputBox.

v2.0:
- I moved the CustomDialog parameters to the BD_CustomDlgParams class.
- I added two new parameters: Duration and DialogGravity.
- I removed the Margin parameter and added the MarginHeight parameter (to be used when Gravity is set to TOP).
- The BodyWidth and BodyHeight parameters defines now accurately the size of the dialog body.

v2.1:
- I added a "closing" event raised just before a custom dialog is dismissed. You can cancel the closure by returning False.

v2.11:
- I added the "DlgResponse" parameter to the Closing event.

This library does not work with Android versions < 2.
It requires another library: Masked EditText
 

Attachments

  • BetterDialogs v2.11.zip
    55.6 KB · Views: 2,389
  • Java source - BetterDialogs.zip
    8.5 KB · Views: 765
Last edited:

NeoTechni

Well-Known Member
Licensed User
Longtime User
I'm having a problem with CustomDialog, even though OpenKeyboard = true, the keyboard refuses to popup when I click the textbox.
 

Informatix

Expert
Licensed User
Longtime User

NeoTechni

Well-Known Member
Licensed User
Longtime User
1) was just for testing. I don't use it there
2) that seems to be it, I'll try. Thank you.
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
Worked, thank you. But the stuff I drew on the canvas didnt follow anymore, had to draw it on a panel first. And theres a huge blank title. Can I leave it umdeclared? Id like it to be 1 or 0 pixels
 

Prosg

Active Member
Licensed User
Longtime User
hi,

Is it possible to have no divider ?

edit : Forget it... with my theme no divider

ty
 
Last edited:

Prosg

Active Member
Licensed User
Longtime User
Hi again

When i use a custom dialog and i have on edittext i can't access to this events
B4X:
Sub txtDateFin_FocusChanged (HasFocus As Boolean)
    Log("yes")
End Sub

The event are in memory and when i close the dialogs all the event appear on log

What that ?
 
Last edited:

Prosg

Active Member
Licensed User
Longtime User
ok the event is working with maskededit text but...

i have this event... it's the nicely datepicker from ManManfred
https://www.b4x.com/android/forum/threads/datepicker-dialog-v1-0-0.53215/#content

B4X:
Sub dt_ondateset(year As Int, month As Int, day As Int)
    Log($"dt_ondateset(${year}, ${month}, ${day})"$)
    txtDateDebut.Text = day & "/" & month & "/" & year
End Sub

and when i choose the date... it doesn't update the txtdateDebut.... (ben when i close the dialog the log appear with the same delay)

how can i solve this ?

regards
 
Last edited:

Informatix

Expert
Licensed User
Longtime User
ok the event is working with maskededit text but...

i have this event... it's the nicely datepicker from ManManfred
https://www.b4x.com/android/forum/threads/datepicker-dialog-v1-0-0.53215/#content

B4X:
Sub dt_ondateset(year As Int, month As Int, day As Int)
    Log($"dt_ondateset(${year}, ${month}, ${day})"$)
    txtDateDebut.Text = day & "/" & month & "/" & year
End Sub

and when i choose the date... it doesn't update the txtdateDebut.... (ben when i close the dialog the log appear with the same delay)

how can i solve this ?

regards
You cannot. DonManfred has to change his code to make it work.
 

JdV

Active Member
Licensed User
Longtime User
Hi

Is it possible to have an InputBox dialog that prompts for a password/passcode of up to 10 digits but which doesn't show 10 dots in the input field?

I want the input field to be completely blank but still obscure the characters when they are typed and also restrict the number of characters entered to 10.

Regards

Joe
 

Attachments

  • Passwd.png
    Passwd.png
    15.4 KB · Views: 236

Informatix

Expert
Licensed User
Longtime User
Hi

Is it possible to have an InputBox dialog that prompts for a password/passcode of up to 10 digits but which doesn't show 10 dots in the input field?

I want the input field to be completely blank but still obscure the characters when they are typed and also restrict the number of characters entered to 10.

Regards

Joe
If you don't want to display anything, then don't use an InputBox (the EditText is useless) and create a custom dialog with a numeric keyboard (10 buttons and you're done).
 
Top