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

mhdi

Member
Licensed User
Longtime User
Thankyou. That works.

Another two

1) Is it possible to programatically disable a dialog button? For example, I want to disable the OK button until some condition is met.
2) I have a TabHost and the dialog positions itself below the tabs. How can I make the dialog position itself at the top of the screen?

Thanks again,
 

mrjaw

Active Member
Licensed User
Longtime User
There is help for this library. I saw the examples but would be nice if it has a helpfile to read before.

how can I do to read a String

x=Dlg.String()

Thks!
 

Penko

Active Member
Licensed User
Longtime User
B4X:
Dim Id As InputDialog
   Dim ret As Int
   Bmp.Initialize(File.DirAssets, "icon.png")
   Id.InputType = Id.INPUT_TYPE_TEXT
   Id.Input = ""
   Id.Hint = "This is my hint"
   Id.HintColor = Colors.DarkGray 
   
   ret =  Id.Show("Please enter something", "This is my title", "Yes", "Cancel", "",Bmp)
   Msgbox(ret,"Selection")
Msgbox("You entered: " & Id.Input)

This code is from the previous page, I just fixed some logical mistakes. What can be improved is that you check ret against DialogResponse.POSITIVE so that the logic is executed when the user has clicked YES only. That should happen exactly after calling Show(). The buttons you don't need should be left as empty string in the corresponding argument.

If you don't need an icon, just pass Null to the last argument instead of Bmp.





Sent from my HTC Desire using Tapatalk
 
Last edited:

joneden

Active Member
Licensed User
Longtime User
Hi Andrew,

Not sure if you're still active on this or not but I'll post my queries anyway :)

1) An entry in post 52 mentioned about programatically closing a customdialog, I take it that it's still not possible to do and that the three buttons on the bottom do all that.

2) I'm having issues with making a MsgBox and ProgressDialog open while the customdialog is open. Am I correct that this is not possible owing to the way Android works? I'll just do some fudges to make it work if that's the case - would prefer not to but such is life.

3) I'm using a Jelly Bean device, Galaxy S2 with latest CM10 - nice :), and find that I can click outside the customdialog and that closes the dialog. Is there a way to stop that? If not are you planning an update or should I just implement a fudge to reload the customdialog?

Those issues aside it's a fantastic set of dialogs!

Cheers,

Jon
 

gapi

Active Member
Licensed User
Longtime User
Hi, I use dialog custom in project ... I added six EditText in the dialog but I would need more, how I can scroll the contents of the dialog?

tnx ;)
 

joneden

Active Member
Licensed User
Longtime User
That's easy enough - I use customdialog2 and you add a ScrollView to it

B4X:
uxPopupInfo.AddView(uxPopupInfoScrollView, 85%x, 250dip)

Before that add a panel to the scroll view with the EditText views on it...

Hope that helps

Jon
 

agraham

Expert
Licensed User
Longtime User
... programatically closing a customdialog, I take it that it's still not possible to do and that the three buttons on the bottom do all that.
Correct.

I'm having issues with making a MsgBox and ProgressDialog open while the customdialog is open.
You can't do this.

and find that I can click outside the customdialog and that closes the dialog. Is there a way to stop that?
No.
 

joneden

Active Member
Licensed User
Longtime User
Cool thanks for letting me know. I have work arounds for all issues now...

Cheers,

Jon
 

gapi

Active Member
Licensed User
Longtime User
That's easy enough - I use customdialog2 and you add a ScrollView to it

B4X:
uxPopupInfo.AddView(uxPopupInfoScrollView, 85%x, 250dip)

Before that add a panel to the scroll view with the EditText views on it...

Hope that helps

Jon

scrollview don't have a 'addView' method for add a panel o it !! How can do it ? :BangHead: tnx

reply from me to me :s scrollview.Panel.addView() it's the solution! ^^ thanks @joneden
 
Last edited:

mrjaw

Active Member
Licensed User
Longtime User
Hi!
I need to show a little report, just text, and I dont know that control to use. I thougth use dialog but I need a scroll because this report will be large.

What kind of view recomend me ? MsgBox?
 

mrjaw

Active Member
Licensed User
Longtime User
There is a dialog that the Edit view has few lines instead of one ?
 

newSteve

Member
Licensed User
Longtime User
Close Keyboard

I don't know what I'm missing, but I can't get the keyboard to close at all. I have a droid X, Android 2.3.4, I open an input dialog, click on the box, keyboard pops up, I enter the text, click add, everything works, but the keyboard won't close. There has to be a way to close it. If I hit enter, the keyboard goes away, but then I still have to click Add.

Any help?

Hello,

got it to work.

Just need to replace my messagebox with:

B4X:
Msgbox(Id.Input  ,"Selection")

and now the keypad goes away after they press the button.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
That looks like a CallSub has become a CallSubDelayed in the ListView code. Only Erel can tell.
The previous post was deleted by the author, so I'm not sure what is the context of this question. ListView_ItemClick now uses BA.RaiseEventFromUI instead of BA.RaiseEvent. It should have been changed before. It is somewhat similar to CallSubDelayed, though CallSubDelayed is much more sophisticated.
 

trisium

Member
Licensed User
Longtime User
The previous post was deleted by the author, so I'm not sure what is the context of this question. ListView_ItemClick now uses BA.RaiseEventFromUI instead of BA.RaiseEvent. It should have been changed before. It is somewhat similar to CallSubDelayed, though CallSubDelayed is much more sophisticated.

Hi Erel,
I use a custom dialog (modal) with a listview. In the previous version of B4A the ListView_ItemClick-event was triggered when an item was tapped in the listview, in the version 2.20 (same project without any changes in code) the ListView_ItemClick-event only gets called when the dialog is closed. It occurs to me that you explain here the reason for this behaviour - but i don't understand what i have to change in my code... :BangHead: Could you help me?
Many thanks!
Tom
 

joneden

Active Member
Licensed User
Longtime User
Hi Erel,

Referencing the previous two posts, you said you would need to use a non-modal approach for the spinner (actually listbox but I'm getting the same issue with a spinner). Is there no way around this such as reflector? Seems weird to me as other click events all work on the custom dialog - I have image views reacting to clicks, checkboxes etc....

Alternatively do you happen to know if there is a custom spinner type control that might work instead?

Regards,

Jon
 
Status
Not open for further replies.
Top