I’m having an issue trying to use g.DrawPicture inside of DrawControlInLayoutEditor inside of a WebDSDK project (Xojo 2021r2.1).
Drawing simple objects (lines, rectangles, ovals) are fine. However, trying to use the DrawPicture method is breaking the visual control.
I’m following the example in the language reference and have tried parsing what feels like every possible way as memory block, local image in project, Base64 but no luck.
Is it possible to do this or is this a bug in Xojo?
Even just trying DrawText is breaking with using variables declared outside of the method.
For example this works as expected and draws text into the container:
g.DrawText("Example Text", 100, 100)
However, this breaks with the string variable being statically set.
g.DrawText(ExampleString, 100, 100)
So you can’t use variables declared outside the method even if they’re public?
No, but you can use Constants. I have one on each my products called “GraffitiProductName”, then you can get the value like this:
var title as String = ConstantValue( "GraffitiProductName" )
As for pictures, you can use PictureConstant with the BASE64 value – without the type header – of the picture stored in a constant (“LayoutEditorIcon” for example)
var icon As Picture = PictureConstant( "LayoutEditorIcon" )
I know, just wanted to add, since it’s also related to the DrawControlInLayoutEditor-Event and also does not work.
And since DrawControlInLayoutEditor takes the Graphics object as a parameter, users assume that they can use all methods/properties of the Graphics object in this event.