B4A Library Dialogs library

Discussion in 'Additional libraries, classes and official updates' started by agraham, Dec 7, 2010.

  1. agraham

    agraham Expert Licensed User

    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
     

    Attached Files:

    Last edited by a moderator: Jun 5, 2017
  2. alfcen

    alfcen Well-Known Member Licensed User

    Hi Andrew,
    This is truly lovely. The dialogs are versatile and fully customisable, yet simple to use. Exactly what developers need for astronomy applications!
    Thanks so much for your work!

    Robert

    PS: Your option "Maybe" is cute :icon_clap:
     
  3. Amalkotey

    Amalkotey Active Member Licensed User

    Hi Andrew,

    how can I display the date dialog? I always get the subsequent message when you compile.

    Code:
    Compiling code.                         Error
    Error compiling program.
    Error description: Missing parameter.
    Occurred on line: 
    48
    Calendar.Show(
    "prompt""Kauf-Datum""OK""Abbruch", imgCalendarDown)
    Word: )
    Can you give me an example?

    regards
    Amalkotey
     
  4. Amalkotey

    Amalkotey Active Member Licensed User

    Ok, Found.

    Runtime-Error: java.lang.IlligalArgumentException
    current should be >= start and <= end

    Regards
    Amalkotey
     
    Last edited: Dec 22, 2010
  5. Amalkotey

    Amalkotey Active Member Licensed User

    Hello,

    I found the error. Works fine. Thank you.

    regards
    Amalkotey
     
  6. agraham

    agraham Expert Licensed User

    Version 1.1 has a bug fix to DateDialog.DateTicks. Java/Android count months from 0 to 11, Basic4android and Basic4ppc count them from 1 to 12. When setting the initially displayed date using DateTicks the displayed month was off by one because I omitted to do the correction. Reading the ticks value from DateTicks was fine, I got that right, it was just the inital setting that was off.
     
  7. WZSun

    WZSun Member Licensed User

    Hi Agraham,
    Not sure whether there is a bug in the DateDialog...

    Instead of using the + - to adjust the date, I tap on the say, Year field.. and it pops up the keyboard. I then manually entered say, 1996. When I confirmed the date, the year was displayed as 2010 (current year) and not 1996.

    Sometimes the DayOfMonth field was displayed a day earlier. For example, sometimes I manually changed the day to 16.. it displayed them as 15.

    I thought it was my scripts. I then launched your sample demo... I manually entered the year as 1996.. but it shows as 2009 once in a while.
     
  8. agraham

    agraham Expert Licensed 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. :(
     
  9. WZSun

    WZSun Member Licensed User

    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!
     
  10. tremara1

    tremara1 Active Member Licensed User

    Number dialog

    Any chance of a dialog with number input with +/- selector similar to the date dialog....just thought I'd ask. I really appreciate all the work you guys do with the libraries.
     
  11. JesseW

    JesseW Active Member Licensed User

    Phone keypad support

    If anyone is interested, you can use the phone keypad in AGraham's input dialog, like you can in the core object EditText view. Simply do it like this:

    Code:
    Dim id as InputDialog
    dim et as EditText
    id.InputType = et.INPUT_TYPE_PHONE
    result = 
    id.Show(...)
    I'm sure there is an integer constant value that can be used instead, but this is very readable.
    And best of all, it works very nicely. :sign0162:
     
  12. gjoisa

    gjoisa Active Member Licensed User

    Is it possible to use date dialog in the format of dd/mm/yyyy ?
     
  13. agraham

    agraham Expert Licensed User

    I assume you mean the layout of the actual Dialog which seems to be governed by the locale set under Language and Keyboard Settings. On an emulator set to English(United States) to it shows as [mm dd yyyy]and set to English(United Kingdom) it is [dd mm yyyy]
     
  14. Filippo

    Filippo Expert Licensed User

    Hi agraham,

    It is an error or is it can show the date not more than 2100?
    For certain calculations, it would be necessary.


    Ciao,
    Filippo
     

    Attached Files:

  15. agraham

    agraham Expert Licensed User

    It looks like the dialog can only show years from 1900 to 2100. I have no idea why that limitation exists.
     
  16. agraham

    agraham Expert Licensed User

    Version 1.2, now posted, includes two more modal dialogs to obtain color choices from a user. One allows the user to specify the R, G and B values of a color using sliders and the other gives the user a choice from 16 predefined colors.

    It would have been nice to combined the functions in one dialog but lack of space in a dialog precludes doing this in a easily usable way.
     
  17. tremara1

    tremara1 Active Member Licensed User

    GetColor2

    I just tried the updated dialog lib. You have done a great job but I seem to have a problem with GetColor2 is a blank dialog with the response buttons. Is it me??.....also any further dialogs in the future ie a number picker with +/- selection. Thanks again.
     
  18. agraham

    agraham Expert Licensed User

    That's very, very strange :confused: The demo layout is for a 240 x 320 density 1 screen and it works fine on my 480 x 800 density 1.5 phone so I would have thought it would work anywhere. However I just tried it on the 240 x 320 density 1 emulator and it doesn't appear so at the moment I am totally baffled! I'll look further tomorrow.

    There isn't a pure number picker dialog available in Android so there won't be one in the Dialogs library I'm afraid.
     
  19. agraham

    agraham Expert Licensed User

    Version 1.3 now posted. ColorPickerDialog now works correctly on HVGA aspect ratio screens.
     
  20. agraham

    agraham Expert Licensed User

    I lied in post #18 :)

    Version 1.4, now posted, includes a configurable modal number picker +/- dialog. I realized that the ColorPicker, although it might not look like it, had a lot of what was needed for a number picker dialog - so I made one!
     
Loading...