Polygons

Terence Heaford lheaford at icloud.com
Sun Apr 4 14:08:46 EDT 2021


OK, I have changed your script by adding these lines to the mouseUp handler

set the backgroundColor of grc "myPoly" to red

set the forecolor of grc "myPoly" to blue


Now if you switch the lines on/off you will see that the fill does not work without all lines.

Not sure what this means exactly.

Thanks

Terry


> On 4 Apr 2021, at 18:43, Ian McKnight via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> I have to say that I'm not seeing this.
> I seem to remember that graphics can't show a fill unless all lines are
> visible.
> As a test I created a graphic called "myPoly" .
> I placed a checkbox called "showSides" (and removed its script)
> in a button I placed the following script:
> 
> -----------------------------------------------------------------------------
> 
> *on* mouseUp
> 
> *-- points for a 100 unit square with 4 sides visible*
> 
> *put* "50,50" &cr& "150,50" &cr& "150,150" &cr& "50,150" &cr& "50,50" &cr
> into tPointsFor4Lines
> 
> *-- points for a 100 unit square with alternate sides visible*
> 
> *put* "50,50" &cr& "150,50" &cr& cr& "150,150" &cr& "50,150" &cr &cr&
> "50,50" &cr into tPointsFor2Lines
> 
> *set* the opaque of grc "myPoly" to true *-- ensures fill is visible*
> 
> *if* the hilite of btn "showSides" is true
> 
> *then*
> 
> *set* the points of grc "myPoly" to tPointsFor4Lines *-- all sides showing*
> 
> *else*
> 
> *set* the points of grc "myPoly" to tPointsFor2Lines *-- alternate sides
> showing*
> 
> *end* *if*
> 
> *end* mouseUp
> 
> ----------------------------------------------------------------------------------
> 
> When you run this and flip between 4 and 2 sides its showing the square is
> drawn correctly,
> 
> 4 sides visible - filled and 2 sides visible - not filled
> 
> If you check the Inspector for the graphic the opaque property hasn't
> changed.
> 
> The only way I can think to overcome this is to create another graphic -
> the same size as your first one, place it underneath your graphic and group
> them together. Then when all sides are visible you can make this background
> graphic invisible and when sides are 'missing' make it visible again to
> provide the fill or simply leave it visible since it won't be seen under
> your original graphic. When sides 'disappear' and the fill disappears this
> graphic will then provide your fill.
> 
> 
> Hope this is of some help
> 
> Regards
> 
> Ian
> 
> 
> On Sun, 4 Apr 2021 at 18:04, Terence Heaford via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> 
>> When you do this it appears to affect the fill settings. I lose the fill
>> where there are no lines and the closure of the points also moves.
>> 
>> I can’t believe it’s LC, it must be me. A simple script example would be
>> useful if you have the time.
>> 
>> A square, that’s easy, that has the side lines missing and is filled with
>> a colour.
>> 
>> Regards
>> 
>> Terry
>> 
>> 
>>> On 4 Apr 2021, at 15:39, Ian McKnight via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>>> 
>>> By a space I mean a blank line!
>>> Ian
>>> 
>>> On Sun, 4 Apr 2021 at 15:39, Ian McKnight <iangmcknight at gmail.com
>> <mailto:iangmcknight at gmail.com>> wrote:
>>> 
>>>> Hi
>>>> Put a space in-between the points where you want  the line in not be
>>>> drawn. The shape is still constructed but with missing sides.
>>>> 
>>>> Ian
>>>> 
>>>> On Sun, 4 Apr 2021 at 15:02, Terence Heaford via use-livecode <
>>>> use-livecode at lists.runrev.com> wrote:
>>>> 
>>>>> Thanks for that, clearly understood.
>>>>> 
>>>>> To expand on the original question. If you have a hexagon, is it
>>>>> possible  to only draw lines on sides 1,3,5,6 and no lines on sides
>> 2,4.
>>>>> 
>>>>> Thanks Terry
>>>>> 
>>>>>> On 4 Apr 2021, at 12:43, Ian McKnight via use-livecode <
>>>>> use-livecode at lists.runrev.com> wrote:
>>>>>> 
>>>>>> Yes. Polygons use a list of 4 points to describe a triangle. The
>> first
>>>>> and
>>>>>> last are the co-ords of the same vertex to ensure closure.
>>>>>> If the last point is left out then the line between the last vertex
>> and
>>>>> the
>>>>>> first vertex is not drawn.
>>>>>> So make sure that your list of points doesn't begin with the right
>> angle
>>>>>> vertex and you're good to go.
>>>>>> 
>>>>>> Ian
>>>>>> 
>>>>>> 
>>>>>>> On Sun, 4 Apr 2021 at 12:12, Terence Heaford via use-livecode <
>>>>>>> use-livecode at lists.runrev.com> wrote:
>>>>>>> 
>>>>>>> If I draw a shape using a polygon, as an example assume a right
>> angled
>>>>>>> triangle.
>>>>>>> 
>>>>>>> Is it possible to hide the line between the points that make up the
>>>>>>> hypotenuse?
>>>>>>> 
>>>>>>> Thanks
>>>>>>> 
>>>>>>> Terry
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> _______________________________________________
>>>>>>> use-livecode mailing list
>>>>>>> use-livecode at lists.runrev.com
>>>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>>>> subscription preferences:
>>>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> Regards
>>>>>> 
>>>>>> 
>>>>>> Ian McKnight
>>>>>> 
>>>>>> iangmcknight at gmail.com
>>>>>> =======================
>>>>>> _______________________________________________
>>>>>> use-livecode mailing list
>>>>>> use-livecode at lists.runrev.com
>>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>> subscription preferences:
>>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>> 
>>>>> _______________________________________________
>>>>> use-livecode mailing list
>>>>> use-livecode at lists.runrev.com
>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>> subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>> 
>>>> 
>>>> 
>>>> --
>>>> Regards
>>>> 
>>>> 
>>>> Ian McKnight
>>>> 
>>>> iangmcknight at gmail.com
>>>> =======================
>>>> 
>>> 
>>> 
>>> --
>>> Regards
>>> 
>>> 
>>> Ian McKnight
>>> 
>>> iangmcknight at gmail.com <mailto:iangmcknight at gmail.com>
>>> =======================
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode <
>> http://lists.runrev.com/mailman/listinfo/use-livecode>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> 
> 
> -- 
> Regards
> 
> 
> Ian McKnight
> 
> iangmcknight at gmail.com
> =======================
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list