Page 1 of 2
How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 2:55 pm
by Martin-HC
Hi,
I've a script that draws a graphic (like a column chart) using the draw command. Before I start drawing I've set linesize and pencolor. The graphic draws smoothly and everything works as expected. However, when I go to another card the graphic is lost. It's also lost when I save the stack.
What am I missing here?
Martin
Re: How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 3:45 pm
by Klaus
Hi Martin,
never heard of this problem!?
Sure there is no "pre-/opencard" handler that will "clean up" the card?
Best
Klaus
Re: How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 3:54 pm
by Martin-HC
There's no openCard handler or any other handler that 'cleans up' the card. (If I want to draw a new graphic I use a button that cuts the rectangle of the graphic.)
Re: How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 4:00 pm
by Klaus
OK, OK, just wanted to be sure.
But what do you mean by:
(If I want to draw a new graphic I use a button that cuts the rectangle of the graphic.)
Maybe you could post the script and/or stack here?
Re: How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 4:11 pm
by Martin-HC
Klaus wrote: ↑Tue Oct 28, 2025 4:00 pm
OK, OK, just wanted to be sure.
But what do you mean by:
(If I want to draw a new graphic I use a button that cuts the rectangle of the graphic.)
Maybe you could post the script and/or stack here?
To delete the previously drawn graphic I use this script:
choose select tool
drag from 0,0 to 560,744
cut
choose browse tool
Re: How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 4:44 pm
by Klaus
Sorry, I meant the script to create the graphic(s).
Re: How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 6:58 pm
by jacque
Check both the card and stack properties to see if the cantModify property is true. The symptoms sound like that's the case.
Re: How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 7:03 pm
by Klaus
Yes, but in that case you cannot even draw anything on a card at all!
Re: How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 7:13 pm
by bn
Martin,
I think you run afoul of an LC bug that if you use the paint tools and you do not explicitly create an image object where you "paint" then LC creates an image object for you but the problem is that that image is not "stable".
Could you try to create an image object of the size and location you want first and then do your drawing-
This is just a hunch but worth trying.
A bit of code would help to track this down.
Kind regards
Bernd
EDIT:
the bug report is here:
https://quality.livecode.com/show_bug.cgi?id=24034
It was fixed in 10.0.2 RC-1
Re: How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 8:20 pm
by jacque
Klaus wrote: ↑Tue Oct 28, 2025 7:03 pm
Yes, but in that case you cannot even draw anything on a card at all!
I think you can, you can do almost anything but leaving the card removes all changes. Maybe something changed?
Re: How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 8:34 pm
by dunbarx
Bernd.
I never use paint tools, though I remember back in 1987 I doodled a lot with HC.
In a new stack I made a small "drawing" using each of the seven standard paint tools in the toolbar, rectangle, line, brush, etc.
I saved the stack and re-opened. All the doodles except for the line and polygon disappeared. I tried it again, and only the line came back. And after a third time, everything disappeared.
I think there is something wrong here.
Craig
Re: How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 8:36 pm
by dunbarx
Bernd.
Could you try to create an image object of the size and location you want first and then do your drawing-
Why would that be of any use, even if it worked? The whole point of paint tools, awkward as they are, is lost if you have to prep them with an image. In that case, what do you need to paint for?
Craig
Re: How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 8:45 pm
by dunbarx
Bernd.
Well, I see what you meant. If you import an image, and I guess that could be 100% whiteSpace that fills the card window, then any painting you do within the rect of that image sticks. Note that you can only paint within the image rect because the tools fail to paint at all outside it. They will actually stop painting if the cursor leaves the image, and start up again when you return.
Craig
Re: How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 8:49 pm
by bn
dunbarx wrote: ↑Tue Oct 28, 2025 8:36 pm
Bernd.
Could you try to create an image object of the size and location you want first and then do your drawing-
Why would that be of any use, even if it worked? The whole point of paint tools, awkward as they are, is lost if you have to prep them with an image. In that case, what do you need to paint for?
Craig,
An image is created on the fly if you "just" paint. And the "automatic" image has the size of the card. Actually you probably want your image to have a certain smaller dimension. On top of this it was broken up until LC 10.0.2 RC-1.
I think the cleanest solution would be to create an image object of the desired dimension and paint into that image object.
Kind regards
Bernd
Re: How to save a graphic on a card using paint tools
Posted: Tue Oct 28, 2025 9:56 pm
by dunbarx
Bernd.
I do not understand. If I paint a line on a new card, it is true that the rect of the "image" of that line fills the card window. Save that stack. It is lost if I close and reopen. An imported image, however, allows the paint to survive if that paint lies within the rect of that image.
What am I missing?
craig