Hi! I am looking to make a button which has a shape and an icon. It is important that the button can be focused (and clicked) only when the mouse pointer is on the shape itself, and not on the button rectangular bounding box.
i tried inheriting from
shapebutton to override the
hittest(), but i had to keep a pointer to the shape in the inherited class since i cannot access the private
shape object. at the end i managed to make it work but i feel it is the wrong way to do it.
So i created a PNG image which contains both the shape and the icon, and started experimenting with
ImageButton. This approach works great since the imageButton can ignore transparent backgrounds.
Then i started experimenting with SVGs for images, so that the interface could be well scaled, but here the problem is that imageButton can’t get an SVG as “image”.
So i moved the
DrawableButton class but the problem is still the same as
Shapebutton, i don’t see a good way to inherit from it since it does not expose the
drawable object as protected.
So is there a better way? should i go on Inheriting from DrawableButton and keeping a pointer to drawable? or should i give up and use raster images ?
i saw a Topic about this but it’s quite old and none responded