B4A Library Dialogs library

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

Thread Status:
Not open for further replies.
  1. corwin42

    corwin42 Expert Licensed User

    The trial version can't use libraries.

    You are a licensed user. Why don't you use the licensed version?
     
  2. fziebell

    fziebell Member Licensed User

    Very good and interesting question.

    I bought b4a few years ago. And think , this is my support expired.

    Before I buy a new license , I wanted to test certain functions , whether b4a for me makes sense .

    I have already pointed out that I use the trial version and am a little surprised that Erel has no such restrictions .

    But OK. Then I have to I make up my mind if I try to purchase a full version .

    Thank you.
     
  3. fziebell

    fziebell Member Licensed User

    Ok. I have a new license . Everything is going well , the dialog lib also.

    It would have saved me two days if the test would have pointed to the limitation version .

    Thanks to the forum

    ...continue testing b4a.

    Special Thanks to corwin42
     
    Last edited: Jun 22, 2015
  4. demasi

    demasi Active Member Licensed User

    I want to create a class for my dialogs, but I don't know how to get the result of my dialog, from the class to the activity like in this code, from the dialogs lib demo. As you can see, the result is in the same sub, like a return from a function:

    Code:
    Sub btnInput_Click
        
    Dim Id As InputDialog
        
    Id.Input = ""
        
    Id.Hint = "Enter some text!"
        
    Id.HintColor = Colors.ARGB(1962551400)
        ret = 
    DialogResponse.CANCEL
        ret = 
    Id.Show("Input the required text""B4A Input Dialog""Yes""No""Maybe", Bmp)
        
    ToastMessageShow(ret & " : " & Id.Input, False)  
    End Sub
    I don't know how to code this in a class.Can someone give-me a clue?

    I can get a result like this using this code, not recommended as it stops the thread at the while loop. But it does what I need. Wrong way.

    Code:
    public Sub show
        pnl.Initialize(
    "pnl")
        pnl.Color=
    Colors.White
        ed.Initialize(
    "")
        ed.TextColor=
    Colors.Black
        
    Dim b1 As Button
        b1.Initialize(
    "b1")
        pnl.AddView(ed,
    10dip,10dip,200dip,60dip)
        pnl.AddView(b1,
    10dip,100dip,100dip,50dip)
        mActivity.AddView(pnl,
    5%x,25%x,90%x,50%x)
        btt=
    0 'this is defined at class globals
        Do While btt=0
            
    DoEvents
        
    Loop
        
    Return ed.Text
    End Sub

    Sub b1_click
        
    Dim w As Button
        w=
    Sender
        ret = ed.Text
        pnl.RemoveView
        btt=
    1
    End Sub
    If I try to code the correct way, without blocking the thread, it would like this:

    Code:
    public Sub show
        pnl.Initialize(
    "pnl")
        pnl.Color=
    Colors.White
        ed.Initialize(
    "")
        ed.TextColor=
    Colors.Black
        
    Dim b1 As Button
        b1.Initialize(
    "b1")
        pnl.AddView(ed,
    10dip,10dip,200dip,60dip)
        pnl.AddView(b1,
    10dip,100dip,100dip,50dip)
        mActivity.AddView(pnl,
    5%x,25%x,90%x,50%x)
        btt=
    0 'this is defined at class globals
    End Sub

    Sub b1_click
       ret = ed.Text
       pnl.RemoveView
       
    CallSub(Main,"Message")
    End Sub
    "Message" is a sub at the Main activity:

    Code:
    ...
    Dim class as MyClass
    ...
    class.initialize()
    ...

    Sub Message()
        
    Log(class.ret)
    End Sub
    This way it works, but the program flow is more complicated, because the return is in another sub.
    I want to use like in the Dialogs lib, or my example above, with the loop, where the return of the class is is the same sub, top down.
    How can I make this?

    Thank you for any help.
     
  5. wineos

    wineos Member Licensed User

    Hi,

    I tried the attached Dialogs Demo, DateDialog and TimeDialog, and get the 2 screens (see the attachments): demo - date, demo - time

    demo - date.png demo - time.png

    Then, I copied the code and modify it, but my app get different screens (see the attachments): app - date, app - time

    app - date.png app - time.png

    Why I cannot get the screen like the demo ones? Can anybody help?

    Thanks a lot!
     
  6. demasi

    demasi Active Member Licensed User

    Look at the manifest.
    Go to Project / Manifest Editor
    Look for a line like this:

    Code:
    SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light")
    You can change the theme. Maybe this is the case.
    Try to erase ".Light" and you'll have a dark theme.

    Or you can comment or erase this theme line, and you'll get the default theme for the mobile.

    The dialogs demo does not use this theme line.
     
    wineos likes this.
  7. wineos

    wineos Member Licensed User

    Thank you demasi. But whatever I modify or erase this theme line, the screens are still different.

    I really want to get the datedialog and timedialog looks as the demo one.

    Please help. Thanks a lot!

    :(
     
  8. warwound

    warwound Expert Licensed User

    Compare the demo manifest with your project's manifest.
    Are there different android sdk levels in each manifest?
     
    wineos likes this.
  9. demasi

    demasi Active Member Licensed User

    I see.
    I think the problem is the Android version in your cell or emulator.
    Android 5 shows like your first two screens.
    Android 4 or less shows the other way.
     
    wineos likes this.
  10. wineos

    wineos Member Licensed User

    Thank you warwound and demasi. I compare both Demo's and myapp's Android Manifest file, and find the code of @android:style, so I manually remove it.

    Then, just as demasi said, I found that I can only have Demo's style on API level 21 and higher: http://stackoverflow.com/questions/3712710/android-calendar-view-for-date-picker

    A bit disappointed, but now I can get the Demo's style on my Nexus 7 with Android 5.1.1.

    Thank you both of you. :)
     
  11. imgsimonebiliato

    imgsimonebiliato Well-Known Member Licensed User

    Hello,
    I want to create a class that show a custom panel.
    But I want to show this panels, like your dialogs. So I want to call the method Show without any params like yours...
    Please, can you help me, with some example code?
     
  12. Informatix

    Informatix Expert Licensed User

    For custom dialogs, try BetterDialogs.
     
  13. imgsimonebiliato

    imgsimonebiliato Well-Known Member Licensed User

    Thank you but I would like to create my own
     
  14. Informatix

    Informatix Expert Licensed User

    In Java? Because in B4a, just forget.
     
  15. imgsimonebiliato

    imgsimonebiliato Well-Known Member Licensed User

    Ahn... I thought B4A
     
  16. Erel

    Erel Administrator Staff Member Licensed User

    BTW, native Android doesn't support modal dialogs at all. This is a unique feature of B4A.
     
  17. rleiman

    rleiman Well-Known Member Licensed User

    Hi,

    Your library is very nice. Can you alter your library to display the KitKat time picker instead of the outdated wheel type time picker when a user chooses TimeDialog ?

    I found out that users who have Lollipop installed get the KitKat time picker displayed when TimeDialog is called. If the phone has KitKat installed and the TimeDialog is called, the outdated one is displayed.

    I used the sample app that came with the Dialogs library to see which time picker would be displayed.

    I also used this in the manifest:

    Code:
    'This code will be applied to the manifest file during compilation.
    'You do not need to modify it in most cases.
    'See this link for for more information: http://www.basic4ppc.com/forum/showthread.php?p=78136
    AddManifestText(
    <uses-sdk android:minSdkVersion=
    "10" android:targetSdkVersion="14"/>
    <supports-screens android:largeScreens=
    "true"
        android:normalScreens=
    "true"
        android:smallScreens=
    "true"
        android:anyDensity=
    "true"/>)
    SetApplicationAttribute(android:icon, 
    "@drawable/icon")
    SetApplicationAttribute(android:
    label"$LABEL$")
    'End of default text.
    I also compiled the app with API 23 but still the outdated pre-KitKat time picker is displayed.

    The attached photos show the outdated and KitKat time pickers.

    Thanks.
    Google Calendar time picker.png
     

    Attached Files:

    Last edited: Nov 19, 2015
  18. rleiman

    rleiman Well-Known Member Licensed User

    Hi Informatix,

    I will try your library.
     
  19. DonManfred

    DonManfred Expert Licensed User

    First agraham is no more a active user so i guess there will be no update.
    Second i´m sure the lib just call the same methods as in 2011 there do not exist such a picker in android.
    The RESULT is based on the Android Version you are using (Device). Update to Lollipop and it will show up the nice picker instead of the old one.
     
  20. rleiman

    rleiman Well-Known Member Licensed User

    Hi Don,

    Is there a way to do the same thing that Google does with the Google calendar in B4A? They use a KitKat time picker but I don't know how to do it with B4A. If Google does it, I'm sure it can be done with B4A (at least I hope since many people are still using KitKat like myself :confused:)

    My current device can't be upgraded since that functionality is locked by the device manufacturer. In the worst case, I will use it and know that anyone who has Lollipop will see the nicer time picker. Well, that's what I will assume since I can't see the change on my device.
     
    Last edited: Nov 20, 2015
Thread Status:
Not open for further replies.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice