Ok, some success here! After painstakingly removing stuff one thing at a time and testing build after build I finally figured out what the culprit is: The horizontal and vertical alignment button Containers.
The color selector container is a different beast, in that it’s entirely constructed in code, where the alignment buttons rely on external images for display. Not sure if that’s the issue or something else.
Here is a test application that fails on windows. If you remove the text horizontal alignment container from the popover window, it will work.
[EDIT - link to updated project posted a couple messages down, containing the necessary image files]
So what might be causing this?
Select File > Collect Project Items to make sure your project is properly transportable. We don’t need your plugins, but we do need the project images.
Everything should be in there - there’s a folder with the support images included in the zip file. Does that not work?
That folder contains just the .xojo_image definitions, not the actual images. Xojo leaves those in-place on your disk. Collect Project Items copies them to the destination project location.
Ahh I see - the xojo image files are included but the originals are not. Here’s a link to the collected project:
It’s to do with using the Paint event. Try it: comment out the Paint event handler on TextJustifyHorizButtons.
Technically, changing the backdrop of an item on the container would cause the view to be dirty, raising the Paint event again. You should be getting a StackOverflowException in my opinion.
Honestly, my recommendation would be to redesign this, but you may opt to file a bug report for the Paint event issues if you wish. Something isn’t quite right there and it needs attention.
huh. So if not changing the backdrop, how do you implement a custom image-based button like this? All the examples I’ve seen do it this way.
A Canvas subclass would allow you to implement a button that you could assign a off / highlighted / selected state image to. In the Paint event handler of the Canvas subclass, you use Graphics.DrawPicture to draw the appropriate image. You avoid creating endless loops this way because you are the one handling the drawing.
Using a Canvas subclass would also allow you to simplify the design. Each button instance on the container would be tracking the hover state, rather than needing to do so with MouseEnter and MouseExit on every control.
There’s a series on the Xojo Blog about creating custom controls that may help. It discusses how you can track hover states and raise a Pressed event so that using the Canvas subclass is like using a button.
3 Likes
Ok that did it. thanks!
Now I have to rebuild all my containers in the main app to use this but it looks like it shouldn’t take too long.
@Ulrich_Bogun - is this the solution to the problem you’ve been seeing as well?