Page 1 of 1
Setting the style of a graphic to line
Posted: Sun Nov 30, 2014 6:35 am
by Steelweaver52
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
Re: Setting the style of a graphic to line
Posted: Sun Nov 30, 2014 6:47 am
by Dixie
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
Re: Setting the style of a graphic to line
Posted: Sun Nov 30, 2014 7:00 am
by Steelweaver52
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
Re: Setting the style of a graphic to line
Posted: Sun Nov 30, 2014 7:22 am
by Dixie
try :-
Code: Select all
set the style of the templateGraphic to "line"
putting 'line' in quotes...

Re: Setting the style of a graphic to line
Posted: Sun Nov 30, 2014 8:00 am
by Steelweaver52
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
Re: Setting the style of a graphic to line
Posted: Sun Nov 30, 2014 8:09 am
by Dixie
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
Re: Setting the style of a graphic to line
Posted: Sun Nov 30, 2014 3:55 pm
by Steelweaver52
Dixie: thank you very much. That was very helpful!
---Tom Nally