B4A Library Dialogs library

Status
Not open for further replies.

corwin42

Expert
Licensed User
The trial version can't use libraries.

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

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.
 

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:

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:

B4X:
Sub btnInput_Click
    Dim Id As InputDialog
    Id.Input = ""
    Id.Hint = "Enter some text!"
    Id.HintColor = Colors.ARGB(196, 255, 140, 0)
    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.

B4X:
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:

B4X:
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:

B4X:
...
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.
 

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!
 

demasi

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

B4X:
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

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!

:(
 

warwound

Expert
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!

:(
Compare the demo manifest with your project's manifest.
Are there different android sdk levels in each manifest?
 

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.
 

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?
 

Informatix

Expert
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?
For custom dialogs, try BetterDialogs.
 

Erel

Administrator
Staff member
Licensed User
BTW, native Android doesn't support modal dialogs at all. This is a unique feature of B4A.
 

rleiman

Well-Known Member
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.
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:

B4X:
'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
 

Attachments

Last edited:

DonManfred

Expert
Licensed User
Can you alter your library to display the KitKat time picker instead of the outdated wheel type time picker when a user chooses TimeDialog ?
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.
 

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:
Status
Not open for further replies.
Top