B4J Library [B4X] [XUI] SD XUIView

Star-Dust

Expert
Licensed User
Update rel 0.06 - Fix Bugs
 

Star-Dust

Expert
Licensed User
Update rel 0.07
Added in CalendarPiker the possibility to set from Calendar the calendar starting from today's date (DateTime.Now)
 

Jack Cole

Active Member
Licensed User
It is good to add cross platform controls that do not exist as native controls.
It is a mistake to wrap existing native views. It only makes things more complicated.
It all depends on what your goals are. A top goal of mine is to minimize code differences across platforms. I *think* one of your primary goals is to remain true to the underlying native system (correct me if I'm wrong). I was personally pleased to find this library and that SD had wrapped the native panels and labels. I personally find it to be a weakness of b4x that some methods and UI types are different between b4a, b4i, and especially b4j. Like with b4j, you have Panes instead of Panels. In b4i, you have RemoveViewFromParent as a view method as opposed to RemoveView in b4a. I'm not sure I understand the philosophy behind those choices. I'm sure you have a reason, because you are a masterful developer. I just love the idea of consistency across platforms and efficiency in the development process.

I would like it if you could add a method to your XUI Views similar to SD's AddToParent method, which would allow programmatic view creation.

The B4XPanel and Labels makes me consider porting some apps to b4j. It is nice to have a consistent set of methods and types across platforms. It is also nice to be able to programmatically add views (not as a primary UI method, but there are times when it is needed).
 

Jack Cole

Active Member
Licensed User
I get an error trying to use this library in b4i while using Erel's XUI Views library.

In file included from /Users/jackcole/Desktop/b4ibuilder/UploadedProjects/<user id>/B4iProject/b4i_wordmemory2.m:113:
/Users/jackcole/Desktop/b4ibuilder/UploadedProjects/<user id>/B4iProject/b4i_b4xseekbar.h:166:1: error: duplicate interface definition for class 'b4i_b4xseekbar'
@interface b4i_b4xseekbar : B4IClass
^
 

Erel

Administrator
Staff member
Licensed User
I personally find it to be a weakness of b4x that some methods and UI types are different between b4a, b4i, and especially b4j. Like with b4j, you have Panes instead of Panels. In b4i, you have RemoveViewFromParent as a view method as opposed to RemoveView in b4a. I'm not sure I understand the philosophy behind those choices. I'm sure you have a reason, because you are a masterful developer. I just love the idea of consistency across platforms and efficiency in the development process.
All the inconsistencies you described are solved with XUI library. You need to learn how to work with B4XView. You don't need any other wrapper.
I will write it again as it keeps confusing developers:
All the inconsistencies you described are solved with XUI library. You need to learn how to work with B4XView.
More information here: https://www.b4x.com/android/forum/threads/b4x-xui-cross-platform-native-ui-library.84359/#content

BTW, it is trivial to work with B4XView and you don't lose anything as you can switch back and forth between the native type and B4XView. In fact it is simpler to work with B4XViews and B4XView includes methods that are not available in the native types.
 
Last edited:

LucaMs

Expert
Licensed User
(there)
2. Use B4XViews whenever possible and whenever it makes sense. You can change the types of views added with the designer to B4XView:
B4X:
Sub Globals
Private clv1 As CustomListView
Private clv2 As CustomListView
Private Label1 As B4XView '<--- manually change to B4XView
Private CheckBox1 As B4XView
End Sub
Remove that comment: "<--- manually...

(O.T., I know, but I don't think I should open a new thread just for this suggestion 😊)
 

angel_

Active Member
Licensed User
When I load this library with XUI Views and try to compile it appears these errors

B4X:
...
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xseekbar.h:31:1: error: duplicate interface definition for class 'b4i_b4xseekbar'
@interface b4i_b4xseekbar : B4IClass
^
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.m:2:
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.h:2:
/Users/administrator/Documents/Libs/iSD_XUIView.h:873:12: note: previous definition is here
@interface b4i_b4xseekbar : B4IClass
           ^
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.m:18:
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xseekbar.h:59:32: error: property has a previous declaration
@property (nonatomic)NSString* _meventname;
                               ^
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.m:2:
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.h:2:
/Users/administrator/Documents/Libs/iSD_XUIView.h:890:32: note: property declared here
@property (nonatomic)NSString* _meventname;
                               ^
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.m:18:
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xseekbar.h:60:32: error: property has a previous declaration
@property (nonatomic)NSObject* _mcallback;
                               ^
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.m:2:
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.h:2:
/Users/administrator/Documents/Libs/iSD_XUIView.h:891:32: note: property declared here
@property (nonatomic)NSObject* _mcallback;
                               ^
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.m:18:
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xseekbar.h:61:38: error: property has a previous declaration
@property (nonatomic)B4XViewWrapper* _mbase;
                                     ^
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.m:2:
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.h:2:
/Users/administrator/Documents/Libs/iSD_XUIView.h:892:38: note: property declared here
@property (nonatomic)B4XViewWrapper* _mbase;
                                     ^
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.m:18:
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xseekbar.h:62:30: error: property has a previous declaration
@property (nonatomic)B4IXUI* _xui;
                             ^
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.m:2:
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.h:2:
/Users/administrator/Documents/Libs/iSD_XUIView.h:893:30: note: property declared here
@property (nonatomic)B4IXUI* _xui;
                             ^
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.m:18:
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xseekbar.h:73:27: error: property has a previous declaration
@property (nonatomic)BOOL _vertical;
                          ^
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.m:2:
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_b4xsignaturetemplate.h:2:
/Users/administrator/Documents/Libs/iSD_XUIView.h:898:27: note: property declared here
@property (nonatomic)BOOL _vertical;
                          ^
6 errors generated.
...
 

Star-Dust

Expert
Licensed User
New Update 0.08 - FIX BUG

Now it won't conflict with XUI View, I changed the name of the B4XSeekBar object with B4XSeek_Bar.

Note: B4XSeek_Bar is not wrapping a corresponding in XUI Views
 

Star-Dust

Expert
Licensed User
Is it posible enable/disable B4XRadioButton by code?
B4XRadiobutton1.Enabled=False
or
B4XRadiobutton1.GetBase.Enabled=False
 

angel_

Active Member
Licensed User
Is it possible to change the color by disabling? like this or something similar:
B4X:
    If CheckBox1.Checked Then
        B4XRadioButton1.Enable = True
        B4XRadioButton1.TextColor = Colors.Black
    Else
        B4XRadioButton1.Enable = False
        B4XRadioButton1.TextColor = Colors.LightGray
    End If
 

Star-Dust

Expert
Licensed User
Is it possible to change the color by disabling? like this or something similar:
B4X:
    If CheckBox1.Checked Then
        B4XRadioButton1.Enable = True
        B4XRadioButton1.TextColor = Colors.Black
    Else
        B4XRadioButton1.Enable = False
        B4XRadioButton1.TextColor = Colors.LightGray
    End If
I will see in the next update.
 
Top