Android Question Is there the way open B4ADesigner,B4JDesigner,andB4iDesigner in one application

Theera

Well-Known Member
Licensed User
Longtime User
Hello all,
I have just unzip xAnotherDatePicker.b4xlib to edit code for Thai delvelopler. Now I place all of files in the folder (ThaiCarlendar)
I have just found the expert's strategy can can converting dirrectly to be b4xlib file as the picture. I can modify only B4ADesigner and B4JDesigner by creating B4XMainPages,but
I can modify B4iDesigner because I have not enough money to buy. I wish someone help me duplicate lblYear and overlay on it as lblBEYear for me and save bil file.

P.S. I have added some code in anotherdatepicker.bas already.

Thank you in advanced.

Theera
 

Attachments

  • ThAnotherDatePicker.zip
    17.6 KB · Views: 84
  • convertingB4xlib.png
    convertingB4xlib.png
    15.6 KB · Views: 91

aeric

Expert
Licensed User
Longtime User
I opened your zip but I don't see any latest changes. All files are dated 2017 and 2018. Am I dreaming?

AnotherdatePicker.bas has no indication of code change and I suspect you didn't upload the new file. If you made changes, add comments and let people know which lines of code you made changes.

Create a B4A or B4J layout file to show which position you want to put the new label or do you want to replace the old lblYear?
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
I opened your zip but I don't see any latest changes. All files are dated 2017 and 2018. Am I dreaming?

AnotherdatePicker.bas has no indication of code change and I suspect you didn't upload the new file. If you made changes, add comments and let people know which lines of code you made changes.

Create a B4A or B4J layout file to show which position you want to put the new label or do you want to replace the old lblYear?
The really,I had edited xanotherdatepicker.bas once time. I have copied it instead of the original. Because of B4iDesigner which I don't have ,so I don't know how to continue,sir.
Thank you for the kind of you always help me. I asked for perhaps,there is the way to convert bal->bjl->bil files .
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
I think I have found my solution. I will go home to test them. But it's better if they are be one.
 

Attachments

  • Screenshot_20230803_170256.jpg
    Screenshot_20230803_170256.jpg
    53.6 KB · Views: 84
  • Screenshot_20230803_170206.jpg
    Screenshot_20230803_170206.jpg
    77.8 KB · Views: 78
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
Attached you find a B4XPages project.
Working on all three platforms, and of course all three layout files in the Files folder of each platform.
Up to you to include them in your b4xlib.
 

Attachments

  • ThAnotherDatePicker.zip
    191.8 KB · Views: 75
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Hi Klaus,
Your code is right,but it 's error for Thai developler. Please see my the picture. However,I had solved in B4A by adding some code in AnotherDatePicker and adding label "lblBEYear" overlap label "lblYear". My problem is that I can't create LblBEYear in B4iDesigner because I don't have B4i.
 

Attachments

  • ThCarlendar.png
    ThCarlendar.png
    9.6 KB · Views: 78
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Hi again,
I had done in B4A and B4J ,But I don't B4i for being b4xlib file. If you help me add lblBEYear(label) overlap on lblYear and save bil file, I think I can do convert to be b4xLib.
 

Attachments

  • ThCarlendar2.png
    ThCarlendar2.png
    12.3 KB · Views: 78
Upvote 0

aeric

Expert
Licensed User
Longtime User
I don't understand why you need to put another label on the original label.
You may just need to modify the code to plus 543 in AnotherDatePicker.bas.

B4X:
    month = DateTime.GetMonth(DateTime.Add(DateTime.Now, 543, 0, 0))                    ' Line 99
    year = DateTime.GetYear(DateTime.Add(DateTime.Now, 543, 0, 0))                      ' Line 100
    minYear = Props.Get("MinYear")
    maxYear = Props.Get("MaxYear")
    minYear = minYear + 543                                                             ' Line 103
    maxYear = maxYear + 543                                                             ' Line 104
    months = DateUtils.GetMonthsNames
    If selectedDate = 0 Then selectedDate = DateTime.Add(DateTime.Now, 543, 0, 0)       ' Line 106

    setDate(DateTime.Add(DateTime.Now, 543, 0, 0))                                      ' Line 316
 
Last edited:
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
I don't understand why you need to put another label on the original label.
You may just need to modify the code to plus 543 in AnotherDatePicker.bas.

B4X:
    month = DateTime.GetMonth(DateTime.Add(DateTime.Now, 543, 0, 0))                    ' Line 99
    year = DateTime.GetYear(DateTime.Add(DateTime.Now, 543, 0, 0))                      ' Line 100
    minYear = Props.Get("MinYear")
    maxYear = Props.Get("MaxYear")
    minYear = minYear + 543                                                             ' Line 103
    maxYear = maxYear + 543                                                             ' Line 104
    months = DateUtils.GetMonthsNames
    If selectedDate = 0 Then selectedDate = DateTime.Add(DateTime.Now, 543, 0, 0)       ' Line 106

    setDate(DateTime.Add(DateTime.Now, 543, 0, 0))                                      ' Line 316
Because Thailand has Christain,too so I would add option for selection
B4X:
If Used=C.E.Year then
      LblYear.visiable=true
      LblBEYear.visiable=false
Else
      LblYear.visiable=false
      LblBEYear.visiable=true
End If
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
If I need to add H.E. Year for muslim,too. I think I will add another label. Thailand has not only Christian and Bhudhim ,but also has Muslim. I would make it better for everybody. How do I code it?,Aeric.
Many thanks,Aeric,and others
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
If I need to add H.E. Year for muslim,too. I think I will add another label. Thailand has not only Christian and Bhudhim ,but also has Muslim. I would make it better for everybody. How do I code it?,Aeric.
Many thanks,Aeric,and others
You can use If-Else-ElseIf or Select-Case in code.
You just need only 1 label.
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Hi Aeric,
I have 2 problems in B4A ,B4J (I can't test B4i)
1. How do I change btnToday.Text and btnCancel.Text in AnotherDatePicker.bas?
2.I added my function ConvertThaiContents() and create Textbox as B4XView for getting newdate in AnotherDatePicker1_DateChanged() in B4XMainPage ,but it can't show the contents Thai massage about date in Thai. It is about NewDate must be C.E.Year,isn't it?
B4X:
Public Sub ConvertThaiContents(MyTargetDate As Long) As String
    
    Dim myyear As String=DateTime.GetYear(MyTargetDate)
    Dim mymonth As String= DateUtils.GetMonthName(MyTargetDate)
    Dim myday As String=NumberFormat(DateTime.GetDayOfMonth(MyTargetDate),2,0)
    Dim myThaidate As String=myday&" "&mymonth&" "&myyear
    
    Return myThaidate
End Sub
B4X:
Private Sub AnotherDatePicker1_DateChanged (NewDate As Long)
           TxtBoxDate1.Text=AnotherDatePicker1.ConvertThaiContents(NewDate)
End Sub

Best Regards,
Theera
 

Attachments

  • Lastest.zip
    15 KB · Views: 71
Upvote 0

aeric

Expert
Licensed User
Longtime User
1. How do I change btnToday.Text and btnCancel.Text in AnotherDatePicker.bas?

You can add it inside DesignerCreateView sub, as long as after the line loading the "DatePicker" layout will do:
B4X:
pnlDialog.LoadLayout("DatePicker")
btnToday.Text = "วันนี้"
btnCancel.Text = "ยกเลิก"

I don't understand your second question.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Check this:

Add Reflection library in B4A.
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
   
    Dim format As String = "dd MMM yyyy"
    SetDateFormat("th", "TH", format)
End Sub

Private Sub AnotherDatePicker1_DateChanged (NewDate As Long)
    'TxtBoxDate1.Text=AnotherDatePicker1.ConvertThaiContents(NewDate)
    TxtBoxDate1.Text = DateTime.Date(NewDate)
End Sub

Private Sub SetDateFormat(Language As String, Country As String, format As String)
    #if B4A or B4J
    Dim locale As JavaObject
    locale.InitializeNewInstance("java.util.Locale", Array(Language, Country))
    Dim DateFormat As JavaObject
    DateFormat.InitializeNewInstance("java.text.SimpleDateFormat", Array(format, locale))
    Dim r As Reflector
    r.Target = r.RunStaticMethod("anywheresoftware.b4a.keywords.DateTime", "getInst", Null, Null)
    r.SetField2("dateFormat", DateFormat)
    #else if B4i
    Dim locale As NativeObject
    locale = locale.Initialize("NSLocale").RunMethod("alloc", Null).RunMethod("initWithLocaleIdentifier:", Array(Language & "_" & Country))
    DateTime.As(NativeObject).GetField("dateFormat").SetField("locale", locale)
    DateTime.DateFormat = format
    #End if
End Sub
Edit: This method cannot be used as the year value changed.
 
Last edited:
Upvote 0
Top