tchart Well-Known Member Licensed User Longtime User May 6, 2013 #1 Sorry if this has been covered elsewhere, I have searched the forum and cant find anything. So I have a library which wraps a custom type called Graphic - the wrapper being GraphicWrapper. Now in another class I have method that returns an array of graphics (ie public Graphic[] getGraphics() etc) In b4a Im getting the "inconvertible types" One of the types being reported is Graphic[] and the other is GraphicWrapper[] How do I deal with this? 1) I have tried to return GraphicWrapper[] but this seems troublesome as I cant easily create an array of GraphicWrappers 2) As a work around I have successfully returned a b4a List of Graphic objects and this works well. Is approach #2 advisable or is there a better way to handle this?
Sorry if this has been covered elsewhere, I have searched the forum and cant find anything. So I have a library which wraps a custom type called Graphic - the wrapper being GraphicWrapper. Now in another class I have method that returns an array of graphics (ie public Graphic[] getGraphics() etc) In b4a Im getting the "inconvertible types" One of the types being reported is Graphic[] and the other is GraphicWrapper[] How do I deal with this? 1) I have tried to return GraphicWrapper[] but this seems troublesome as I cant easily create an array of GraphicWrappers 2) As a work around I have successfully returned a b4a List of Graphic objects and this works well. Is approach #2 advisable or is there a better way to handle this?
Erel B4X founder Staff member Licensed User Longtime User May 6, 2013 #2 You can either create an array of GraphicWrappers or a List of Graphic objects. Both solutions are good.
You can either create an array of GraphicWrappers or a List of Graphic objects. Both solutions are good.
tchart Well-Known Member Licensed User Longtime User May 6, 2013 #3 Erel said: You can either create an array of GraphicWrappers or a List of Graphic objects. Both solutions are good. Click to expand... Erel, Thanks for the reply. Is there an easy way to create/copy the array? Or do I need to loop through each one and use setobject?
Erel said: You can either create an array of GraphicWrappers or a List of Graphic objects. Both solutions are good. Click to expand... Erel, Thanks for the reply. Is there an easy way to create/copy the array? Or do I need to loop through each one and use setobject?
Erel B4X founder Staff member Licensed User Longtime User May 6, 2013 #4 If you choose to use an array then you will need to manually convert each item.
tchart Well-Known Member Licensed User Longtime User May 6, 2013 #5 Thanks Erel, I tried the array method but it was too cumbersome. Ive stuck with returning a B4A List object which works nicely.
Thanks Erel, I tried the array method but it was too cumbersome. Ive stuck with returning a B4A List object which works nicely.