Drawing a line

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Drawing a line

Mark Rizun
Hello!

Task is simple - draw a line on a form(actually this line will be a border of a cell). While browsing classes I found LineSegment and LineMorph. Which of them is better to use in my case? And another question: I know how to initialize both of them, but don't know how to draw it on my form.

Thank you for help.
Mark 
Reply | Threaded
Open this post in threaded view
|

Re: Drawing a line

Uko2
Hi Mark,

sadly, I’m not confident about this, but maybe you should use Athens

Uko

On 16 Jan 2014, at 10:52, Маркіян Різун <[hidden email]> wrote:

> Hello!
>
> Task is simple - draw a line on a form(actually this line will be a border of a cell). While browsing classes I found LineSegment and LineMorph. Which of them is better to use in my case? And another question: I know how to initialize both of them, but don't know how to draw it on my form.
>
> Thank you for help.
> Mark


Reply | Threaded
Open this post in threaded view
|

Re: Drawing a line

Igor Stasenko
In reply to this post by Mark Rizun
look at Canvas class


On 16 January 2014 10:52, Маркіян Різун <[hidden email]> wrote:
Hello!

Task is simple - draw a line on a form(actually this line will be a border of a cell). While browsing classes I found LineSegment and LineMorph. Which of them is better to use in my case? And another question: I know how to initialize both of them, but don't know how to draw it on my form.

Thank you for help.
Mark 



--
Best regards,
Igor Stasenko.
Reply | Threaded
Open this post in threaded view
|

Re: Drawing a line

EstebanLM
In reply to this post by Uko2
hi,

I think you need LineMorph.
AFAIK, LineSegment is just used to draw PolygonMorph (not sure about that)

Esteban

On 16 Jan 2014, at 11:00, Yuriy Tymchuk <[hidden email]> wrote:

> Hi Mark,
>
> sadly, I’m not confident about this, but maybe you should use Athens
>
> Uko
>
> On 16 Jan 2014, at 10:52, Маркіян Різун <[hidden email]> wrote:
>
>> Hello!
>>
>> Task is simple - draw a line on a form(actually this line will be a border of a cell). While browsing classes I found LineSegment and LineMorph. Which of them is better to use in my case? And another question: I know how to initialize both of them, but don't know how to draw it on my form.
>>
>> Thank you for help.
>> Mark
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Drawing a line

Henrik Sperre Johansen
In reply to this post by Mark Rizun

On 16 Jan 2014, at 10:52 , Маркіян Різун <[hidden email]> wrote:

> Hello!
>
> Task is simple - draw a line on a form(actually this line will be a border of a cell). While browsing classes I found LineSegment and LineMorph. Which of them is better to use in my case? And another question: I know how to initialize both of them, but don't know how to draw it on my form.
>
> Thank you for help.
> Mark

myForm getCanvas line: pt1 to: pt2 width: w color: c

You only need to use a LineMorph if the line is not supposed to be static, otherwise drawing it directly on the Form is just as easy.

Unless what you actually want is to create something like a spreadsheet, in which case a CellMorph, with RectangleMorph (cell outline) / StringMorph (cell contents) as subcomponents would probably be a better solution.
(And the spreadsheet itself a morph, with CellMorphs as subcomponents)

Cheers,
Henry

signature.asc (859 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Drawing a line

Mark Rizun

Thanks for help. I'll try out your suggestions.
Mark

16 січ. 2014 12:50, користувач "Henrik Johansen" <[hidden email]> написав:

On 16 Jan 2014, at 10:52 , Маркіян Різун <[hidden email]> wrote:

> Hello!
>
> Task is simple - draw a line on a form(actually this line will be a border of a cell). While browsing classes I found LineSegment and LineMorph. Which of them is better to use in my case? And another question: I know how to initialize both of them, but don't know how to draw it on my form.
>
> Thank you for help.
> Mark

myForm getCanvas line: pt1 to: pt2 width: w color: c

You only need to use a LineMorph if the line is not supposed to be static, otherwise drawing it directly on the Form is just as easy.

Unless what you actually want is to create something like a spreadsheet, in which case a CellMorph, with RectangleMorph (cell outline) / StringMorph (cell contents) as subcomponents would probably be a better solution.
(And the spreadsheet itself a morph, with CellMorphs as subcomponents)

Cheers,
Henry
Reply | Threaded
Open this post in threaded view
|

Re: Drawing a line

Mark Rizun
Problem is solved)
Looked at Canvas class and used it, as some of you adviced.
As for me it was the best choice for such a simple task.
Thank you again.


2014/1/16 Маркіян Різун <[hidden email]>

Thanks for help. I'll try out your suggestions.
Mark

16 січ. 2014 12:50, користувач "Henrik Johansen" <[hidden email]> написав:


On 16 Jan 2014, at 10:52 , Маркіян Різун <[hidden email]> wrote:

> Hello!
>
> Task is simple - draw a line on a form(actually this line will be a border of a cell). While browsing classes I found LineSegment and LineMorph. Which of them is better to use in my case? And another question: I know how to initialize both of them, but don't know how to draw it on my form.
>
> Thank you for help.
> Mark

myForm getCanvas line: pt1 to: pt2 width: w color: c

You only need to use a LineMorph if the line is not supposed to be static, otherwise drawing it directly on the Form is just as easy.

Unless what you actually want is to create something like a spreadsheet, in which case a CellMorph, with RectangleMorph (cell outline) / StringMorph (cell contents) as subcomponents would probably be a better solution.
(And the spreadsheet itself a morph, with CellMorphs as subcomponents)

Cheers,
Henry

Reply | Threaded
Open this post in threaded view
|

Re: Drawing a line

Igor Stasenko



On 16 January 2014 14:00, Маркіян Різун <[hidden email]> wrote:
Problem is solved)
Looked at Canvas class and used it, as some of you adviced.

it was me, me :)
 
As for me it was the best choice for such a simple task.
Thank you again.

now you owe me a pony
 

2014/1/16 Маркіян Різун <[hidden email]>

Thanks for help. I'll try out your suggestions.
Mark

16 січ. 2014 12:50, користувач "Henrik Johansen" <[hidden email]> написав:


On 16 Jan 2014, at 10:52 , Маркіян Різун <[hidden email]> wrote:

> Hello!
>
> Task is simple - draw a line on a form(actually this line will be a border of a cell). While browsing classes I found LineSegment and LineMorph. Which of them is better to use in my case? And another question: I know how to initialize both of them, but don't know how to draw it on my form.
>
> Thank you for help.
> Mark

myForm getCanvas line: pt1 to: pt2 width: w color: c

You only need to use a LineMorph if the line is not supposed to be static, otherwise drawing it directly on the Form is just as easy.

Unless what you actually want is to create something like a spreadsheet, in which case a CellMorph, with RectangleMorph (cell outline) / StringMorph (cell contents) as subcomponents would probably be a better solution.
(And the spreadsheet itself a morph, with CellMorphs as subcomponents)

Cheers,
Henry




--
Best regards,
Igor Stasenko.