iOS Question Copy fields from bli to bal - Object reference not set to an instance of an object

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I thought we were able to copy fields from one designer type to another.

But every time I try and copy / paste a field from bli to bal I get a message
B4X:
An Error Occurred
Object reference not set to an instance of an object

Anyway I can get around this?
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Yes, you are right. Sorry (just was wondering if it was a known bug)

But I believe I figured it out.

Have been using the B4J - Bal2Bil to convert files.

Made some modifications to allow Togglebuttons & Radiobuttons to be converted into ImageViews.
NOW seems to work file (as far as B4i goes) but when I tried to copy back a field to bal the error occurred.

Looking closer at the b4j Bal2Bil I realized that when converting a TB or RB to IV I needed different routine and could not use the standard

Standard IV to IV
B4X:
Private Sub ConvertImageView(view As Map)
'    Log("ConvertImageView")
    
    Dim drawable As Map = view.Get("drawable")
    If  drawable.IsInitialized = False Then
        drawable.Initialize
    End If
    
    view.Put("ImageView", drawable.Get("file"))
    Dim content As Map = CreateMap(119: 0, 17: 4, 51: 9)
    view.Put("contentMode", content.Get(drawable.Get("gravity")))
End Sub

So I made this routine for the TB / RB convert
B4X:
Private Sub Convert_ImageView(view As Map)
    CurrentHeader.Put("JavaType", "B4IImageViewWrapper")
    CurrentHeader.Put("DesignerType", "ImageView")
    view.Put("csType", "Dbasic.Designer.MetaImageView")
End Sub

NOT sure it this is 100% correct but, B4i seems OK with the changes and I can now copy fields if I want to B4A

BobVal
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Well.....

When I copy RadioButtons I get cannot paste controls
When I copy ToggleButtons I get switches (don't want switches - they seem/are fixed in size)

So using Bal2Bil I can turn these into ImageViews and have them look and work the way I want.

NOW in a perfect world, designer would allow a Paste As or pop up a box and ask what I wanted them to be
 
Last edited:
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
Well.....

When I copy RadioButtons I get cannot paste controls
When I copy ToggleButtons I get switches (don't want switches - they seem/are fixed in size)

So using Bal2Bil I can turn these into ImageViews and have them look and work the way I want.

NOW in a perfect world, designer would allow a Paste As or pop up a box and ask what I wanted them to be
Not all controls can be copied from bal to bil
 
Upvote 0
Top