How to save a graphic on a card using paint tools

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10392
Joined: Wed May 06, 2009 2:28 pm

Re: How to save a graphic on a card using paint tools

Post by dunbarx » Tue Oct 28, 2025 9:58 pm

Jacque.

The "cantModify" of the test stack I made was "false".

Craig

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4190
Joined: Sun Jan 07, 2007 9:12 pm

Re: How to save a graphic on a card using paint tools

Post by bn » Tue Oct 28, 2025 11:17 pm

dunbarx wrote:
Tue Oct 28, 2025 9:56 pm
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,
The original poster wanted to paint programatically and noticed that after doing that and he then goes to another card the drawing on the first card was gone. That is what I tried to explain what a probable cause of this could be. It is a bug in LC that was fixed in LC 10.0.2 RC-1. If the OP uses a version before 10.0.2 RC-1 I suggested to first create an image object programmatically and then paint into that image.
That is all I was trying to say. You also can follow the link to Quality Control Center I posted above to see another description of the problem.

Kind regards
Bernd

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7403
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: How to save a graphic on a card using paint tools

Post by jacque » Wed Oct 29, 2025 12:18 am

jacque wrote:
Tue Oct 28, 2025 8:20 pm
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?
I wasn't aware of the image bug, which is probably the cause. But just to note: cantModify does allow scripted changes which is what the OP is doing. I can't recall now whether it acts like HC did, which is to remove any changes when leaving the card.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10204
Joined: Fri Feb 19, 2010 10:17 am

Re: How to save a graphic on a card using paint tools

Post by richmond62 » Wed Oct 29, 2025 11:02 am

This ONLY seems to happen if the painting is done programmatically.

Martin-HC
Posts: 16
Joined: Fri Jan 31, 2025 5:27 pm

Re: How to save a graphic on a card using paint tools

Post by Martin-HC » Wed Oct 29, 2025 5:28 pm

bn wrote:
Tue Oct 28, 2025 7:13 pm
Could you try to create an image object of the size and location you want first and then do your drawing-
I created a new image with default properties. Then I set the rectangle of the new image to the rect of the painted image (or bigger).
This worked: when I leave the card or close the stack the image is saved.So it looks that your solution is working.
The IDE however is confusing. I'm trying to understand what is really happening.

(note: due to time zone differences and my limited time I can't always respond in a couple of hours. And I have a private life as well :D )

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4190
Joined: Sun Jan 07, 2007 9:12 pm

Re: How to save a graphic on a card using paint tools

Post by bn » Wed Oct 29, 2025 6:06 pm

Hi Martin,

I am glad it works for you.
I'm trying to understand what is really happening.
There is nothing really to understand here except that you hit a bug in LC that is now fixed.

Kind regards
Bernd

Martin-HC
Posts: 16
Joined: Fri Jan 31, 2025 5:27 pm

Re: How to save a graphic on a card using paint tools

Post by Martin-HC » Thu Oct 30, 2025 5:19 pm

Thanks Bernd!

Post Reply