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

pwme

Member
Licensed User
Longtime User
it is possibile?

I have an dialog box with radio buttons.

I would like to "auto close" the dialog box when I choose an radio button. Is it possibile?

Sub rb_CheckedChange(Checked As Boolean)
Dim e As RadioButton

e= Sender
If e.Checked Then
' Close. Same as choose "ok" button
End If

End Sub
 

pwme

Member
Licensed User
Longtime User
Yes,

you are right, but not in my case. With inputlist you can have only one radio button for each row. I have created more radio buttons on the same line

example

° A ° B ° C ° D ° E
° F ° G ° H ° I ° J

(excuse me for bad example)


so in this case dialog it's better. Is there a "close" property ?

thank you for your answer
 

pwme

Member
Licensed User
Longtime User
It works! Great Job!

just a little strange behaviour. I have a button to call the dialog. If I click very very very quickly the BA4 opens 2 instance. So when you close the first, you still see your dialog (and you can't close it). But normally (normal click) it works without problem. I like to close all possible bugs.

How to check if dialog open is already running?

if db=null?

many thanks again
 

Informatix

Expert
Licensed User
Longtime User
It works! Great Job!

just a little strange behaviour. I have a button to call the dialog. If I click very very very quickly the BA4 opens 2 instance. So when you close the first, you still see your dialog (and you can't close it). But normally (normal click) it works without problem. I like to close all possible bugs.

How to check if dialog open is already running?

if db=null?

many thanks again

Define a global boolean: IsDialogOpened
Set it to true when you open the dialog and check whether it's true before displaying the dialog.
 

yuhong

Member
Licensed User
Longtime User
I want use customdialog,I want custom define Title ,button style etc...
Can you help me ?
QQ图片20130718093434.jpg
 

dwsands

Member
Licensed User
Longtime User
I made a change to Dialogs (now v2.93) that I would like to see made to the official version if you are willing. The change is:
  • Made the textview where the resulting color was displayed an edittext so that it could be used to enter text. So an associated SetText, GetText and SetHint were added along with the appropriate code. In my case I only needed to see the textcolor as black but I would assume others would want to change the textcolor as well. I only made changes to the colordialog but the other 2 color dialogs getting the same changes would be valuable to others as well.
Thanks for considering this...David
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Is it possible to change the background colors to make the dialogs look more like InputMap and InputList ?
 

slugger

Member
Licensed User
Longtime User
Hi,

I have a panel with a listview inside and I use the CustomDialog to show it on the screen.

Unfortunately the last line (line # 100) of the listview is not visible but it's covered by the button at the bottom of the dialog, see the attached image.

Is there a way to get the net inner height of the CustomDialog window (without the top title and the bottom buttons) so I can adjust the panel height?
 

Attachments

  • Screenshot_2013-08-23-17-23-31.jpg
    Screenshot_2013-08-23-17-23-31.jpg
    27 KB · Views: 250

slugger

Member
Licensed User
Longtime User
Did you try the Better Dialogs library?

I am trying right now but the results are the same, take a look at the attached screenshot.

This is the code I am using to show the dialog:

B4X:
   Dim lvLog As ListView
    Dim BD As BetterDialogs

    lvLog.Initialize("lvLog")
   
    lvLog.Color=Colors.Yellow
    lvLog.SingleLineLayout.Label.TextColor=Colors.Black
    lvLog.SingleLineLayout.Label.Typeface=Typeface.DEFAULT_BOLD
    lvLog.SingleLineLayout.Label.TextSize=20
   
    Dim i As Int
    For i=0 To 100
        lvLog.AddSingleLine("This is line # " & i)
    Next
       
    If lvLog.Size>0 Then lvLog.SetSelection(lvLog.Size -1)
       
    Dim btnCancel As Button
   
    btnCancel.Initialize("")
    btnCancel.Text = "<Font Color='Yellow'>C</Font>ancel"
    btnCancel.TextColor = Colors.White
    'btnCancel.Background = CreateStateListDrawable
       
    BD.CustomDialog("Events Log",-1,-1,lvLog,100%x,PanelHeight,10dip,Colors.Yellow,Null,btnCancel,Null,False,"BD1")

Panelheight is a variable that contains the height of the upper side of the screen and is calculated like this:

PanelHeight=pnlButton.Top-2

where pnlButton is a panel at the bottom of the screen.

The output is like the one I got using Dialogs.

Screenshot_2013-08-26-12-44-13.png
 

slugger

Member
Licensed User
Longtime User
Apparently I found a way to show all the lines.

I ask for the height of the items of the listview and subtract that height from the DlgHeight parameter:


B4X:
Dim lvHeight As Float
 
lvHeight=lvLog.SingleLineLayout.ItemHeight
BD.CustomDialog("Events Log",-1,-1,lvLog,100%x,PanelHeight-lvHeight,10dip,Colors.Yellow,Null,btnCancel,Null,False,"BD1")
 

icefairy333

Active Member
Licensed User
Longtime User
os:android 2.3(error) android 4.0.4(ok)
using the filedialog with showfolderonly=true and chosen:/sdcard/1/
the modify function return /sdcard/1
and the org function return /sdcard
the "/sdcard" is a link of "/mnt/sdcard" made by os
public String getFilePath()
throws Exception
{
return filepath.getAbsolutePath();//use this is ok on android 2.3
// return this.filepath.getCanonicalPath(); //use this it will return a wrong path
}

thank you
 
Status
Not open for further replies.
Top