B4J Question [Solved] Beta version B4J Custom Views

Daestrum

Expert
Licensed User
Longtime User
If I leave the custom view as a class, and add to the project, I can use it in the designer - CustomView is enabled in the add view menu.

If I compile to a library and add to project, I can only add the custom control via code, in the designer, the CustomView option is disabled.

Pretty sure Erel said we can use as a class or a library.

Any ideas?
 

LWGShane

Well-Known Member
Licensed User
Longtime User
Is the designer window active when you add it to the project? I believe you have to refresh the designer by closing and opening it again.


@DonManfred - Totally posted this in the wrong thread and had to repost here. (In case you got a notification of me mentioning you and having the post not be there.)
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Tried adding after designer opened, before I opened it, but it still will not see the control when in a library.

I will try re-doing as pure java library and see if it recognises it then.
 
Upvote 0

LWGShane

Well-Known Member
Licensed User
Longtime User
@Daestrum - Hmm. It works for me. I imported the module, opened the designer, and the control is there. I also did a test and when you import a module with the designer open, it doesn't recognize it so I had to close then re-open the designer.

Are you importing via Project > Add Existing Module ?
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
@ColdBlueLava no as it's compiled as a library I simply add in the libraries tab.
If I add as a 'normal' module (.bas) all is well.


EDIT
Re-wrote in pure java and it works, the designer can see it, so I must be missing something when making it into a library from the IDE.
 
Last edited:
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Sorted - found the cause of the problem.

The IDE > Library uses the old Doclet (v1.00), which leaves out the DesignerCreateView sub

Simply by editing the xml for the library and inserting the missing method, the control appears in the internal designer.

The missing method is (corrected for the IDE making names lower case)
B4X:
   <method>
	<name DesignerName="DesignerCreateView">_designercreateview</name>
	<comment></comment>
	<returntype>void</returntype>
	<parameter>
		<name>base</name>
		<type>anywheresoftware.b4j.objects.PaneWrapper.ConcretePaneWrapper</type>
	</parameter>
	<parameter>
		<name>label</name>
		<type>anywheresoftware.b4j.objects.LabelWrapper</type>
	</parameter>
	<parameter>
		<name>args</name>
		<type>anywheresoftware.b4a.objects.collections.Map</type>
	</parameter>
</method>

Hope this helps others to produce custom controls from the IDE > compile to library.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Still this is a workaround that should be fixed for final release, right @Erel?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…