[wish] Designer: why not custom views? (or simply a new placeholder view)

fiaful

Member
Licensed User
Longtime User
Hi there! B4a is the best work I've seen made ​​in recent years ... really congratulations! the designer, then, is an excellent tool ...

But I'd be a little more "open" to the developers ... in particular I like to create views, but put them inside the activity becomes less friendly ...

want to say that I develop in B4a by 4 days ... and I'm already in love with this wonderful tool (I have almost finished developing my first component)

The smartest thing that could be done would be to add an annotation java (eclipse)-side to mark the view as a "component" for the designer (may be listed in a sub menu in the menu "add view > custom views") , another annotation to mark properties and its read and write methods for the properties window, and can be used @Events annotation to define custom events for "generate members" menu item ...

Something like this:

B4X:
@ShortName("myComponent") // existing
@Events(values={ myEvent(x as Int) }) // existing
@Version(1.0f) // existing
@IsDesignerComponent (true) // or something like this
@Properties(values={ { propName, readPropMethod, writePropMethod }, { readonlyProp, readReadonlyPropMethod, null } } ) // or something like this
public class myComponent extends ViewWrapper<...> implements ...
{
public <type> readPropMethod()
{
return ...
}
public void writePropMethod(<type> value)
{
...
}
public <type> readReadonlyPropMethod()
{
return ...
}
...
}
or, alternatively or together, a standard view called "placeholder" that included into "add view" menu allowing to define the "dimensions" and "relations with the screen and the other view" of the custom view that will replace it.

I already do this using a panel as a placeholder and replace it at runtime with this code B4a:

B4X:
' into b4a Activity_Create
Activity.AddView(myComponent, pnlPlaceholder.Left, pnlPlaceholder.Top, pnlPlaceholder.Width, pnlPlaceholder.Height)
pnlPlaceholder.RemoveView
though so I omit the z-order (but in this case I do not need)

while it would be nice to have a method of activity like this:

B4X:
' b4a code
Activity.replacePlaceholder (plhButton, myButton)

where plhButton is the name of the placeholder that must be replaced from the button, and myButton is the name of the button.

Obviously the above method should preserve all the spatial properties defined for the placeholder, including the z-order

Well ... clearly the first option would allow the development B4a-side much more friendly (allowing you to place the actual view without adding more code and defining at the same time both the properties that the events) ...

but I realize that the work be done to achieve it is much more than the second solution (although I would like to see them both made)

is also true that accomplished that, the designer would be the best tool of all time! :D

however ... congratulations for your work! :sign0098:
 

fiaful

Member
Licensed User
Longtime User
uhm....

I understand what you say ... I was really thinking to "Abstract designer", where all objects are represented by colored boxes (so why not, even custom ones) ...
for the properties, methods and events, if you can get them to export the XML generated by javadoc, so much the better, otherwise you could empower the developer to manually generate a XML ad-hoc ...

the designers (apk), I understand that it may be a bit more complex (but Android does not support reflection?) ...
could perhaps be created a specific class, from which to inherit custom views (a sort of plugin for the designer) ...
If you absolutely can not do this, the designer may still show a colored box (as in "abstract designer") would not show the appearance of the object, but would still be possible to modify the properties, methods and events such as the standard views ...

This would "really" save time and avoid writing several lines of code ...
and would give a boost to B4a more! :D

about your last sentence ...

Actually it is already done in Designer4android which is based on Basic4android designer

forgive me ... but I have not understood! :confused: :D

(text almost entirely generated by the google translator :sign0161:)
 

warwound

Expert
Licensed User
Longtime User
I have wondered whether it'd be possible to add a library - a custom View - to the B4A Core.jar file and that would then make them available in the Designer.

Would that not work then?
Assuming the custom Views are properly written ViewWrapper objects.

Martin.
 

DeerBear

Member
Licensed User
Longtime User
The designer program is a closed and signed APK file. You cannot add anything to it. It doesn't use Core.jar.

But it could load an "open" jar like Delphi does with BPLs.

The designer could have a "Refresh" menu item that
recompiles that JAR(could be aptly called "customviews.jar" or
something along those lines) and reload it.
Would this be possible?

I think expanding the capabilities of the designer in this way
would be *awesome* and would really let B4A make a quantum
leap.

Regards,

A
 

warwound

Expert
Licensed User
Longtime User
I think that anyway to incoroprate a custom libray into the Designer is a great idea.

The custom libray would have to be written so that it supports Designer integration.

The end result for the B4A user would be perfect...!

Martin.
 

DeerBear

Member
Licensed User
Longtime User
I think that anyway to incoroprate a custom libray into the Designer is a great idea.

The custom libray would have to be written so that it supports Designer integration.

The end result for the B4A user would be perfect...!

Martin.

I agree it would be awesome but, sadly, it's not possible
without an helluva load of work, or a very clever(and
time consuming to devise and do...) trick.

It suddenly dawned on me on my way back
home why it may not be possible. When I got home I did a
quick and specific check, which confirmed my suspects.
I don't know if I can tell the reason, but I am 100% sure it
can't be done easily.

Regards,

A
 
Top