S stevenindon Active Member Licensed User Nov 30, 2021 #1 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 40.7 KB · Views: 653 B4i.png 37.1 KB · Views: 634
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
LucaMs Expert Licensed User Longtime User Nov 30, 2021 #2 stevenindon said: What is the best replacement for Edittext (Android) that can be supported by both? Click to expand... B4XView. Upvote 0
stevenindon said: What is the best replacement for Edittext (Android) that can be supported by both? Click to expand... B4XView.
angel_ Well-Known Member Licensed User Longtime User Nov 30, 2021 #3 I use B4XFloatTextField (library XUI Views) Upvote 0
LucaMs Expert Licensed User Longtime User Nov 30, 2021 #4 angel_ said: I use B4XFloatTextField (library XUI Views) Click to expand... Yes. I suggested B4XView as "general rule/way", for all kind of views. ... but I am doing 10 things at the same time and so I was succinct (and I read very superficially, quickly). (I've gotten too old to do multiple things at once ??) EDIT: none of which will make me a single... penny. Upvote 0
angel_ said: I use B4XFloatTextField (library XUI Views) Click to expand... Yes. I suggested B4XView as "general rule/way", for all kind of views. ... but I am doing 10 things at the same time and so I was succinct (and I read very superficially, quickly). (I've gotten too old to do multiple things at once ??) EDIT: none of which will make me a single... penny.
klaus Expert Licensed User Longtime User Nov 30, 2021 #5 I agree with LucaMs ! You may have a look at chapter Compatibilities B4A B4i B4J XUI in the B4X Cross platform projects. You may also have a look at the B4X CustomViews booklet and the B4X XUI booklet. Upvote 1
I agree with LucaMs ! You may have a look at chapter Compatibilities B4A B4i B4J XUI in the B4X Cross platform projects. You may also have a look at the B4X CustomViews booklet and the B4X XUI booklet.
S stevenindon Active Member Licensed User Dec 1, 2021 #6 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: Dec 1, 2021 Upvote 0
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?
Erel B4X founder Staff member Licensed User Longtime User Dec 1, 2021 #7 You misunderstood the main concept of XUI. You should continue to use the basic UI elements and simply set their type to B4XView. B4J Pane = B4i Panel = B4A Panel = B4XView B4J Label = B4i Label = B4A Label = B4XView .... Upvote 0
You misunderstood the main concept of XUI. You should continue to use the basic UI elements and simply set their type to B4XView. B4J Pane = B4i Panel = B4A Panel = B4XView B4J Label = B4i Label = B4A Label = B4XView ....
S stevenindon Active Member Licensed User Dec 1, 2021 #8 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 105 KB · Views: 501 Upvote 0
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
LucaMs Expert Licensed User Longtime User Dec 1, 2021 #9 Just select the views, check B4XView and click on Generate Members. Then see the code that is generated automatically. Upvote 0
Just select the views, check B4XView and click on Generate Members. Then see the code that is generated automatically.
S stevenindon Active Member Licensed User Dec 1, 2021 #10 LucaMs said: View attachment 122525 Just select the views, check B4XView and click on Generate Members. Then see the code that is generated automatically. Click to expand... 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: Dec 1, 2021 Upvote 0
LucaMs said: View attachment 122525 Just select the views, check B4XView and click on Generate Members. Then see the code that is generated automatically. Click to expand... 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..?
LucaMs Expert Licensed User Longtime User Dec 1, 2021 #11 stevenindon said: 1) Where do i find setting as image above in my IDE? Click to expand... Upvote 0
LucaMs Expert Licensed User Longtime User Dec 1, 2021 #12 stevenindon said: 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? Click to expand... 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 said: 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? Click to expand... 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.
LucaMs Expert Licensed User Longtime User Dec 1, 2021 #13 stevenindon said: 3) Dim MynewButton as B4xView <<-- how actually it knows its a button? or a label or etc..? Click to expand... By creating it by Designer yes. Upvote 0
stevenindon said: 3) Dim MynewButton as B4xView <<-- how actually it knows its a button? or a label or etc..? Click to expand... By creating it by Designer yes.
S stevenindon Active Member Licensed User Dec 1, 2021 #14 LucaMs said: By creating it by Designer yes. Click to expand... 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 said: By creating it by Designer yes. Click to expand... 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
LucaMs Expert Licensed User Longtime User Dec 1, 2021 #15 stevenindon said: 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 Click to expand... I have already answered that question: https://www.b4x.com/android/forum/threads/b4x-components.136472/post-863546 Upvote 0
stevenindon said: 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 Click to expand... I have already answered that question: https://www.b4x.com/android/forum/threads/b4x-components.136472/post-863546
M Mahares Expert Licensed User Longtime User Dec 1, 2021 #16 stevenindon said: I am having trouble creating a button (B4xView) by code Click to expand... You need something structured like this: Code: 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 said: I am having trouble creating a button (B4xView) by code Click to expand... You need something structured like this: Code: 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)
Peter Simpson Expert Licensed User Longtime User Dec 1, 2021 #17 Mahares said: Dim xButton As B4XView =sButton xButton.SetColorAndBorder(xui.Color_Red, 6dip,xui.Color_Cyan,10dip)[/code] Click to expand... sButton can be also set as follows, both ways work perfect. Code: sButton.As(B4XView).SetColorAndBorder(xui.Color_Red, 6dip, xui.Color_Cyan, 10dip) Upvote 0
Mahares said: Dim xButton As B4XView =sButton xButton.SetColorAndBorder(xui.Color_Red, 6dip,xui.Color_Cyan,10dip)[/code] Click to expand... sButton can be also set as follows, both ways work perfect. Code: sButton.As(B4XView).SetColorAndBorder(xui.Color_Red, 6dip, xui.Color_Cyan, 10dip)
S stevenindon Active Member Licensed User Dec 1, 2021 #18 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
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.