Setting the style of a graphic to 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
Steelweaver52
Posts: 14
Joined: Fri Jan 02, 2009 6:41 am

Setting the style of a graphic to line

Post by Steelweaver52 » Sun Nov 30, 2014 6:35 am

Hello.

Regarding the following handler...

on mouseUp
create graphic "new_line";
set the style of graphic "new_line" to xxxxx;
end mouseUp

...I'm finding that not all of the listed styles for a graphic object will allow compilation.

The following six styles will work: curve, oval, polygon, rectangle, regular and roundRect.

The following style will not compile for me: line.

Does anyone know of a workaround?

Thanks!

---Tom Nally

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Setting the style of a graphic to line

Post by Dixie » Sun Nov 30, 2014 6:47 am

Set the properties of the graphic you wish to create before issuing the 'create' command...

Code: Select all

set the style of the templateGraphic to rectangle

Steelweaver52
Posts: 14
Joined: Fri Jan 02, 2009 6:41 am

Re: Setting the style of a graphic to line

Post by Steelweaver52 » Sun Nov 30, 2014 7:00 am

Thanks, Dixie.

The following line...

set the style of the templateGraphic to line;

...produces a compilation error.

The lines shown below produce no compilation errors:

set the style of the templateGraphic to oval;
set the style of the templateGraphic to curve;
set the style of the templateGraphic to rectangle;
set the style of the templateGraphic to roundRect;
set the style of the templateGraphic to regular;
set the style of the templateGraphic to polygon;

Thanks!

---Tom Nally

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Setting the style of a graphic to line

Post by Dixie » Sun Nov 30, 2014 7:22 am

try :-

Code: Select all

 set the style of the templateGraphic to "line"
putting 'line' in quotes...:-)

Steelweaver52
Posts: 14
Joined: Fri Jan 02, 2009 6:41 am

Re: Setting the style of a graphic to line

Post by Steelweaver52 » Sun Nov 30, 2014 8:00 am

Thanks, Dixie.

That definitely works. The code compiles without error, and the object is created.

Even though I can't see the object, I know it is there because its "handles" show up in edit mode.

I'm mystified as to why it's not showing up.

I'm setting the lineSize to 5; I'm setting the visible to true; I'm setting the penColor to "red". I'm setting the borderColor to "red".

Objects other than lines will show up with no problems. I'm only having trouble with the line object.

I'll keep experimenting.

Thanks again.

---Tom Nally

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Setting the style of a graphic to line

Post by Dixie » Sun Nov 30, 2014 8:09 am

Hi Tom...

The graphic is there...:-) but now you need to give your line graphic a line to show...

Code: Select all

on mouseUp
   set the style of the templateGraphic to "line"
   set the points of the templateGraphic to 20,20 & cr & 50,50
   create grc "boo"
end mouseUp

Steelweaver52
Posts: 14
Joined: Fri Jan 02, 2009 6:41 am

Re: Setting the style of a graphic to line

Post by Steelweaver52 » Sun Nov 30, 2014 3:55 pm

Dixie: thank you very much. That was very helpful!

---Tom Nally

Post Reply