Different name for Graphic line

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
kevin007
Posts: 40
Joined: Mon Sep 21, 2015 7:46 am

Different name for Graphic line

Post by kevin007 » Thu Apr 21, 2016 6:41 am

Hi All,

Using the below code I draw line, my problem is each time name of the lines is same, Is it any way to change it, If the name already is there the name should change. eg: If the line name is LI then when I draw new line it's name change to LI1 and so on. How I solve this problem ?

Code: Select all

set the style of the templateGraphic to "line" 
choose graphic tool 
set the name of the templategraphic to "LI"
Thanks
Kevin
--
Thanks
Kevin

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Different name for Graphic line

Post by Klaus » Thu Apr 21, 2016 10:06 am

Did you already count all the line graphics in your stack(s)?
(Hint, hint!) 8)

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

Re: Different name for Graphic line

Post by dunbarx » Thu Apr 21, 2016 3:38 pm

Or you can create a naming scheme, and use the "last" keyword. Read about this in the dictionary. Now read about the "lastGraphic" message.

So if you had a custom property that held the number of line graphics you create, you can easily

Code: Select all

on lastGraphic
set the graphicCount of this card to  the graphicCount of this card + 1
set the name of last grc to "Line" & the graphicCount of this card
end lastGraphic
Do you know what a custom property is?

Craig Newman

Post Reply