I have (one more time) a problem:
I set a Canvas Backgroun Color user selectable. I load an image (using both Open an Drag and Drop) and this works fine running in the I:DE.
It does not works when the standalone runs
To be clear: when I set a custom color, the Canvas image background is set to the new color (when running in the IDE), nothing happens in the StandAlone. The test images I drop on the Canvas have transparency parts that use the custom background color.
And I do not know what to do: I already follow the lst of usual things to do (WiFi Off, Poser OFF/PowerON, only Xojo is running / Clear Xojo Caches, delete the previous compile and clear the Trash, etc.)
I do not have my Windows 10 laptop to test that behavior under Windows.
Ideas ?
Edit: I forgot to say I use 2015r1. I cannot make tests with the current version since my license is expired. (I will test running in the IDE there, just in case I discover something-.
I am not sure what you are actually doing. There is no BackColor for Canvas so you create a Picture of that color and set it as a Backdrop image?
Or do you do something in the Paint event?
Both.
I load an image either by drag and drop or Open (drag and drop most of the time, macOS and Windows), and if a color is set, the Paint event have code to draw a background using this color. I have a Canvas button to SelectColor. If the color was changed, I paint the background using that color. Usually, my images have an alpha channel
I also have an Alpha CheckBox.
I checked my project running on 2018r4: works fine, no error.
The Windows version have the same wrong behavior on Windows XP (VirtualBox on my Mac).
How is your EraseBackground setting in your Canvas?
I imagine that your Paint event should look like:
if hasBackgroundColor then //True is a background color was set
g.ForeColor = me.useColor //useColor is the color for the background
g.Fillrect 0, 0, g.width, g.height
g.DrawPicture myPict, 0, 0 //myPict holds the Picture to draw. here we do not care about the size
end if
Standard: ON.
I resize the dropped/loaded image and I apply it to an offscreen picture, then I set it to the Canvas Backdrop.
I think that I paint the Canvas from the (other) Canvas Custom Selector (if/when the selected color is different).
I do not use DrawPicture, I only set the loaded Picture to the Canvas Backdrop.
I wasted so many times to get it work that my eyes are tired.
Back to Basic: the project as run in the IDE works fine, but once I build the StandAlone, I do not get my background color.
To have an idea, look at some WIndows 10 system folder icons with a custom icon in a blue filled Square. That looaks like what I do:
a small image in a Square Black Outlined (or no) and custom background color.
For some reason, I discovers this is not a problem of a drop/open image. The trouble appears when I want to fill acolor in the Canvas. I changed the color used to fill the Canvas, without drawing any image, and it worked while running in the IDE / do not works in the Stand Alone
I will create a brand new project and try to make this and only this (fill the Canvas with a Custom Color) working in the Stand Alone application. As usual, if I can achieve that, I will report the code to the main project.
Thanks Stéphane for trying an answer.