Android Question B4X components

stevenindon

Active Member
Licensed User
Hello All,

I am currently developing custom view to be shared by Android and IOS. I started the programming of custom view in android and tried to bring the
same custom view (XXX.B4xlib) to IOS Library. I found some of the components (Edittext - in B4A) are not present in B4i (B4i using Textfield). Hence an error pops up when i try to run in IOS.

Are all these components supported by both Android and IOS? (At least Edittext (from android) is not supported by IOS.

What is the best replacement for Edittext (Android) that can be supported by both? Or is there an indication which component are supported / which are not?

Thanks
 

Attachments

  • B4a.png
    B4a.png
    40.7 KB · Views: 268
  • B4i.png
    B4i.png
    37.1 KB · Views: 269

klaus

Expert
Licensed User
Longtime User
Upvote 1

stevenindon

Active Member
Licensed User
Thank you all for your quick response on this. I have been using B4A for quite few years and are seriously looking into XUI instead off normal components as mentioned above that XUI view are cross platform. After playing it for few hours, i got really excited as all XUI views are built base on customview from erel's team.

I was just wondering why there is no panel as usual - What are the replacement?

Or is it that i can still use the conventional panel from B4A (In which exists in B4i) ? - Or is it CustomListView?

Missing of XUI view label as well. --> Replacement XUIview --> Scrolling label?
 
Last edited:
Upvote 0

stevenindon

Active Member
Licensed User
Erel,

Thank for your reply. Are you saying that all listed components can be set to type B4XView?

Example :
dim EditText1 as B4xview

Use it as usual ... and can port over to B4i without problem?

Thanks
 

Attachments

  • B4ACom.png
    B4ACom.png
    105 KB · Views: 208
Upvote 0

stevenindon

Active Member
Licensed User
View attachment 122525

Just select the views, check B4XView and click on Generate Members.

Then see the code that is generated automatically.
Hello Lucas,

QUESTIONS :
1) Where do i find setting as image above in my IDE?

2) By right clicking an object (For example button, I know that i can generate 'Dim Button1 as B4xView')..and that is on the Designer. What about if i am to generate a button by code?

B4X:
Dim MynewButton as B4xView
MynewButton.Initialize   <---- ERROR (No initialize)
Panel1.Addview(MynewButton,0,0,100,100)

*** Run with error as MynewButton not initialized

3) Dim MynewButton as B4xView <<-- how actually it knows its a button? or a label or etc..?
 
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
2) By right clicking an object (For example button, I know that i can generate 'Dim Button1 as B4xView')..and that is on the Designer. What about if i am to generate a button by code?
By code, you need to create before the "native View":

B4X:
Dim btnMynewButton As Button
Dim xMynewButton As B4XView

btnMynewButton.Initialize("EventName")
Panel1.Addview(btnMynewButton,0,0,100,100)
xMynewButton = btnMynewButton

but I strongly advise you not to create any type of View by code and to always use the Designer.
 
Upvote 0

stevenindon

Active Member
Licensed User
By creating it by Designer yes.
Thanks for your prompt reply. I know that components that we put in the designer form is easy and can be cast to B4XView (It will know that it is a button / label etc)

What about if i am to create a button via code?

Example :
B4X:
Dim sButton as B4XView
sButton.initialize("sButton")     <--- No such function
Panel1.Addview(sButton,0,0,100,100)

*Above gives me error saying sButton is not initialized. How can i initialise it?
and how did B4A knows that sButton is a button? (As it is set to B4xView)

I am having trouble creating a button (B4xView) by code
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Thanks for your prompt reply. I know that components that we put in the designer form is easy and can be cast to B4XView (It will know that it is a button / label etc)

What about if i am to create a button via code?

Example :
B4X:
Dim sButton as B4XView
sButton.initialize("sButton")     <--- No such function
Panel1.Addview(sButton,0,0,100,100)

*Above gives me error saying sButton is not initialized. How can i initialise it?
and how did B4A knows that sButton is a button? (As it is set to B4xView)

I am having trouble creating a button (B4xView) by code
I have already answered that question:
https://www.b4x.com/android/forum/threads/b4x-components.136472/post-863546
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I am having trouble creating a button (B4xView) by code
You need something structured like this:
B4X:
Dim sButton As Button
    sButton.initialize("sButton")    
    Root.Addview(sButton,0,0,100dip,100dip)   'you can use your panel for parent instead of root
    Dim xButton As B4XView =sButton
    xButton.SetColorAndBorder(xui.Color_Red, 6dip,xui.Color_Cyan,10dip)
 
Upvote 0

stevenindon

Active Member
Licensed User
Thank you all. You guys are superb!

Means button are actually wrapped by B4xView in which are supported by multiplatform. OK Got it!

In other words, B4xView is like a styler or CSS like which supported by multiplatform... instead of using the button properties which ,might not
be the same in IOS.
 
Upvote 0
Top