B4A Library Dialogs2 library - an update to the original Dialogs library

Note the separate download for an updated Dialogs2 class that fixes a bug in the original.

I wrote the original Dialogs library many moons ago and it has suffered with age owing to the changes made to Android and B4A over the years despite the administrations of several other people.

Although modal dialogs are deprecated in general they are still very convenient for use with my BasicIDE on-device development environment which does not implement Wait For, although there is an ugly workaround. Therefore I have taken the Dialogs v4.01 source code and updated it into a new Dialogs2 library.

Every dialog, except CustomLayoutDialog now supports both Show and ShowAsync. In past editions of B4A events raised by views on a CustomDialog or CustomDialog2 would run while the dialog was shown modally but over the years Erel has had to change the Msgbox mechanism as Android has (d)evolved and now custom dialogs that relied on events from views on the dialog no longer work as expected. For example in the reworked CustomDialog2 example in the DialogsDemo file the ListView ItemClick no longer works when Show is invoked but is fine with ShowAsync while a Button Click works in both cases.

Several of the dialogs would also not work properly in landscape on modern devices with tall narrow screens and higher display densities, I hope they all do now.

The DateDialog and TimeDialog are also problematic in landscape mode which Google doesn't seem to want to fix so I have included alternative TimeDialog2 and DateDialog2 classes in the demo which work for me and hopefully also for you.

EDIT: Dialogs 1.2 Posted. FileDialog now has a TextSize property.

EDIT2: See this link for a fix for a fix to a problem in DateDialog2.

EDIT3: Replace the Dialogs2.bas class in the demo with the separately posted one below to fix the above bug.
 

Attachments

  • Dialogs2_v1.2.zip
    89.2 KB · Views: 305
  • DateDialog2.bas
    5.2 KB · Views: 86
Last edited:

pliroforikos

Active Member
Licensed User
Good day to all
I wonder if there is a simple way to change basic colors of Date Dialog from this green to any other color.
Thank you
 

mmanso

Active Member
Licensed User
Hi there,

It's possible to create new input types for this library? These are the available ones:

screenshot_2021-03-03 08_58_33.png


I would like to create something like:

INPUT_TYPE_IPADDRESS

Thanks.
 

mmanso

Active Member
Licensed User
Ok, another doubt:

When you define a default value for the dialog with:

B4X:
Id.Input = defaultValue

the dialog opens and the default value is there (which is great). The problem is that the cursor is positioned on the begining of the field which means that if the user wants to change it he needs to do an extra touch on the screen to position on the end of the field and then delete the value...

Is this behaviour "workable"? Can I make the cursor go to the end of the field?

Ideally, when the default value is used, the cursor should be in the end and the default value should be "selected" so if the user don't want it, he should only start typing something and that would override the default value without any extra "touch" on the screen...

Thanks in advance.
 

Filippo

Expert
Licensed User
Ok, another doubt:

When you define a default value for the dialog with:

B4X:
Id.Input = defaultValue

the dialog opens and the default value is there (which is great). The problem is that the cursor is positioned on the begining of the field which means that if the user wants to change it he needs to do an extra touch on the screen to position on the end of the field and then delete the value...

Is this behaviour "workable"? Can I make the cursor go to the end of the field?

Ideally, when the default value is used, the cursor should be in the end and the default value should be "selected" so if the user don't want it, he should only start typing something and that would override the default value without any extra "touch" on the screen...

Thanks in advance.
The best thing is if you create your own dialogue.
Simply with a panel, 2 buttons and the text field you need.
 

valerioup

Member
Licensed User
in the libraries panel it tells me that there should be version 1.1 online but I only find 1.0
Is it an update issue or is the library elsewhere up to date?
 

Cyan

Member
Licensed User
Thank you for this library, very useful indeed.

One question that is non-obvious to me: is it possible to resize the CustomLayoutDialog after loading a layout?

I know in the instructions it mentions to use SetSize before loading a layout, I was just wondering if it's possible to resize it after? Reason for this is that I have a variable-length label in my layout and I wanted to be able to resize the dialog after (using the results of MeasureMultilineTextHeight).
 

Cyan

Member
Licensed User
I don't know what the effect of this would be - try it. If it doesn't do what you want can you have a hidden Label control and and call MeasureMultilineTextHeight on it before loading the dialog layout?
Thank you for taking the time to reply.

For reference, calling SetSize after Dialog_Ready doesn't do anything except shrink the height of it so that the dialog title barely shows, so unfortunately it didn't work.
However, your other suggestion for using MeasureMultilineTextHeight on a label control dynamically created worked a treat - thank you!!
 

endbyte

Member
I can't change the filedialog text size, it uses a disproportionate size and many long names of files or folders look bad, the library is excellent hopefully in the future in a new version the filedialog text size can be modified, excellent library I use it a lot .
 

endbyte

Member
I've not had this complaint before. Are you using a non-default system font size?

I use the default system font size, I use filedialog from its first version and the text of file and folder names has always appeared to me of a larger size than the default of the system and although I have never looked for a thousand ways to be able to configure it to another size I have found the way to do it, the font size that appears is perhaps 3 or 4 points larger than normal and does not match the font sizes of the rest of my applications, my humble suggestion maybe if the size could be configured in some way of the text, your library is excellent and I thank you very much for your contributions to the b4a community.
 

endbyte

Member

agraham

Expert
Licensed User
See post #1 for a fix to a problem with DateDialog2. I'll post an update sometime but life is too fraught at the moment with multiple hospital appointments for both me and my partner while I am in the middle of doing some big changes to BasicIDE Suite so it will have to wait a while till things calm down!
 
Top