Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

How do I draw a line, and then delete it using Group2D and Object2D? (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Adding help command to top of Help menu
Next thread: Debug Console App?


Re: Functions Library   -   Garth Hjelte
  How do I draw a line, and then delete it using Group2D and Object2D?   -   Myron Meyer
   Re: How do I draw a line, and then delete it using Group2D and Object2D?   -   Peter K. Stys
   Re: How do I draw a line, and then delete it using Group2D and Object2D?   -   Myron Meyer
   Re: How do I draw a line, and then delete it using Group2D and Object2D?   -   Peter K. Stys

How do I draw a line, and then delete it using Group2D and Object2D?
Date: 05.08.11 04:39 (Thu, 4 Aug 2011 20:39:24 -0700)
From: Myron Meyer
I have a program that I am trying to write which has the need for the user
to draw various lines and shapes, and then if the user decides that he/she
doesn’t like the location, be able to delete it with the click of a mouse.

To an experienced programmer this task is probably very simple, but as a
novice I have not found a suitable answer. I am only able to find and
decipher a few of the pieces of the code puzzle. I have not been able to
find an example which has all of necessary pieces from beginning to end. The
Real Software Users Guide and Language Reference either has a lot of missing
pieces, or I simply don’t, as yet, know how to interpret them.

Does anyone know of a third party book that covers the subject of Real
Software, Group2D and Object2D “Working with Vector Graphics” in a complete
and comprehensive manner?

Thank you for any help you might be able to offer. Myron Meyer
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: How do I draw a line, and then delete it using Group2D and Object2D?
Date: 06.08.11 05:09 (Fri, 5 Aug 2011 22:09:29 -0600)
From: Peter K. Stys
Strongly suggest you take the time to learn about classes, subclassing,
etc... It's the foundation of OOP and once you get it, you'll realize how
powerful this approach is and you'll never go back.

Cheers,
P.

On Fri, Aug 5, 2011 at 4:08 PM, Myron Meyer <<email address removed>> wrote:

> Hi Peter,
> Thanks for the response. It appears that you are doing exactly what I need
> to do. Keeping in mind that I am a Novice with no formal programming
> education - I understand the concept that you are describing - but due to
> my
> lack of experience, I am still at a loss as to how to implement your
> suggestions.
> I guess the place to start is for me to learn how to create a new
> subclass, especially since this came up as part of the possible solution
> for
> user Phil Smith’s Cocoa question about how to draw within the Canvas’ Paint
> Event when the command to do it comes from outside of the Paint Event. The
> reason I find this important is because I have been told that drawing
> outside the Canvas’ Paint Event is NO NO in all circumstances, not just
> with
> Cocoa. When I was told this I had the same question “How do I draw within
> the Canvas’ Paint Event when the command to do it comes from outside?”
> Again
> this was a question who’s answer I understood the concept of, but lacked
> the
> experience necessary to make use of the answer.
>
> Thanks again for your help. Myron Meyer
>
> On Thu, Aug 4, 2011 at 10:36 PM, Peter K. Stys <<email address removed>> wrote:
>
> > My app requires the user to draw multiple regions of interest over an
> > image:
> > some rects, some free-hand polygons, some circles, some rotated ellipses.
> > So my solution applies to your problem: the simplest way for you is to
> > simply keep a list of your lines (you can define a struct with 4
> > coordinates
> > to maintain lines as single "entities" if you wish, or as I do, even as
> > classes, complete with methods that know how to draw the line, with their
> > color, path thickness, etc...) in an array of line structs or classes.
> The
> > class approach is powerful because a class method can detect for example
> if
> > the mouse is near or over its line and return a boolean, so the caller
> > doesn't have to worry about the details.
> >
> > When a user deletes, just delete that line struct or class instance from
> > the
> > array, and re-build the entire Group2D from this master array every time.
> > What I do is pass the Group2D to each line class and the line builds then
> > adds its vector graphic to the composite Group2D, which you then draw to
> > the
> > screen. The nice thing about this is if later you want to change the
> > behavior of line detection, drawing, etc... you just modify the line
> class
> > methods and all the calls from the rest of your app don't change, indeed,
> > don't even know, that the line class changed.
> >
> > Classes: the power of OOP.
> >
> > Hope this helps.
> >
> > P.
> >
> >
> > On Thu, Aug 4, 2011 at 9:39 PM, Myron Meyer <<email address removed>>
> wrote:
> >
> > > I have a program that I am trying to write which has the need for the
> > user
> > > to draw various lines and shapes, and then if the user decides that
> > he/she
> > > doesn’t like the location, be able to delete it with the click of a
> > mouse.
> > >
> > > To an experienced programmer this task is probably very simple, but as
> a
> > > novice I have not found a suitable answer. I am only able to find and
> > > decipher a few of the pieces of the code puzzle. I have not been able
> to
> > > find an example which has all of necessary pieces from beginning to
> end.
> > > The
> > > Real Software Users Guide and Language Reference either has a lot of
> > > missing
> > > pieces, or I simply don’t, as yet, know how to interpret them.
> > >
> > > Does anyone know of a third party book that covers the subject of Real
> > > Software, Group2D and Object2D “Working with Vector Graphics” in a
> > complete
> > > and comprehensive manner?
> > >
> > > Thank you for any help you might be able to offer. Myron Meyer
> > > _______________________________________________
> > > Unsubscribe or switch delivery mode:
> > > <http://www.realsoftware.com/support/listmanager/>
> > >
> > > Search the archives:
> > > <http://support.realsoftware.com/listarchives/lists.html>
> > >
> >
> >
> >
> > --
> > ---------------------------------------------
> > Peter K. Stys, MD
> > Dept. of Clinical Neurosciences
> > Hotchkiss Brain Institute
> > University of Calgary
> > tel (403) 210-8646
> > ---------------------------------------------
> > _______________________________________________
> > Unsubscribe or switch delivery mode:
> > <http://www.realsoftware.com/support/listmanager/>
> >
> > Search the archives:
> > <http://support.realsoftware.com/listarchives/lists.html>
> >
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>


--
-------

Re: How do I draw a line, and then delete it using Group2D and Object2D?
Date: 05.08.11 23:08 (Fri, 5 Aug 2011 15:08:28 -0700)
From: Myron Meyer
Hi Peter,
Thanks for the response. It appears that you are doing exactly what I need
to do. Keeping in mind that I am a Novice with no formal programming
education - I understand the concept that you are describing - but due to my
lack of experience, I am still at a loss as to how to implement your
suggestions.
I guess the place to start is for me to learn how to create a new
subclass, especially since this came up as part of the possible solution for
user Phil Smith’s Cocoa question about how to draw within the Canvas’ Paint
Event when the command to do it comes from outside of the Paint Event. The
reason I find this important is because I have been told that drawing
outside the Canvas’ Paint Event is NO NO in all circumstances, not just with
Cocoa. When I was told this I had the same question “How do I draw within
the Canvas’ Paint Event when the command to do it comes from outside?” Again
this was a question who’s answer I understood the concept of, but lacked the
experience necessary to make use of the answer.

Thanks again for your help. Myron Meyer

On Thu, Aug 4, 2011 at 10:36 PM, Peter K. Stys <<email address removed>> wrote:

> My app requires the user to draw multiple regions of interest over an
> image:
> some rects, some free-hand polygons, some circles, some rotated ellipses.
> So my solution applies to your problem: the simplest way for you is to
> simply keep a list of your lines (you can define a struct with 4
> coordinates
> to maintain lines as single "entities" if you wish, or as I do, even as
> classes, complete with methods that know how to draw the line, with their
> color, path thickness, etc...) in an array of line structs or classes. The
> class approach is powerful because a class method can detect for example if
> the mouse is near or over its line and return a boolean, so the caller
> doesn't have to worry about the details.
>
> When a user deletes, just delete that line struct or class instance from
> the
> array, and re-build the entire Group2D from this master array every time.
> What I do is pass the Group2D to each line class and the line builds then
> adds its vector graphic to the composite Group2D, which you then draw to
> the
> screen. The nice thing about this is if later you want to change the
> behavior of line detection, drawing, etc... you just modify the line class
> methods and all the calls from the rest of your app don't change, indeed,
> don't even know, that the line class changed.
>
> Classes: the power of OOP.
>
> Hope this helps.
>
> P.
>
> On Thu, Aug 4, 2011 at 9:39 PM, Myron Meyer <<email address removed>> wrote:
>
> > I have a program that I am trying to write which has the need for the
> user
> > to draw various lines and shapes, and then if the user decides that
> he/she
> > doesn’t like the location, be able to delete it with the click of a
> mouse.
> >
> > To an experienced programmer this task is probably very simple, but as a
> > novice I have not found a suitable answer. I am only able to find and
> > decipher a few of the pieces of the code puzzle. I have not been able to
> > find an example which has all of necessary pieces from beginning to end.
> > The
> > Real Software Users Guide and Language Reference either has a lot of
> > missing
> > pieces, or I simply don’t, as yet, know how to interpret them.
> >
> > Does anyone know of a third party book that covers the subject of Real
> > Software, Group2D and Object2D “Working with Vector Graphics” in a
> complete
> > and comprehensive manner?
> >
> > Thank you for any help you might be able to offer. Myron Meyer
> > _______________________________________________
> > Unsubscribe or switch delivery mode:
> > <http://www.realsoftware.com/support/listmanager/>
> >
> > Search the archives:
> > <http://support.realsoftware.com/listarchives/lists.html>
> >
> --
> ---------------------------------------------
> Peter K. Stys, MD
> Dept. of Clinical Neurosciences
> Hotchkiss Brain Institute
> University of Calgary
> tel (403) 210-8646
> ---------------------------------------------
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: How do I draw a line, and then delete it using Group2D and Object2D?
Date: 05.08.11 06:36 (Thu, 4 Aug 2011 23:36:23 -0600)
From: Peter K. Stys
My app requires the user to draw multiple regions of interest over an image:
some rects, some free-hand polygons, some circles, some rotated ellipses.
So my solution applies to your problem: the simplest way for you is to
simply keep a list of your lines (you can define a struct with 4 coordinates
to maintain lines as single "entities" if you wish, or as I do, even as
classes, complete with methods that know how to draw the line, with their
color, path thickness, etc...) in an array of line structs or classes. The
class approach is powerful because a class method can detect for example if
the mouse is near or over its line and return a boolean, so the caller
doesn't have to worry about the details.

When a user deletes, just delete that line struct or class instance from the
array, and re-build the entire Group2D from this master array every time.
What I do is pass the Group2D to each line class and the line builds then
adds its vector graphic to the composite Group2D, which you then draw to the
screen. The nice thing about this is if later you want to change the
behavior of line detection, drawing, etc... you just modify the line class
methods and all the calls from the rest of your app don't change, indeed,
don't even know, that the line class changed.

Classes: the power of OOP.

Hope this helps.

P.

On Thu, Aug 4, 2011 at 9:39 PM, Myron Meyer <<email address removed>> wrote:

> I have a program that I am trying to write which has the need for the user
> to draw various lines and shapes, and then if the user decides that he/she
> doesn’t like the location, be able to delete it with the click of a mouse.
>
> To an experienced programmer this task is probably very simple, but as a
> novice I have not found a suitable answer. I am only able to find and
> decipher a few of the pieces of the code puzzle. I have not been able to
> find an example which has all of necessary pieces from beginning to end.
> The
> Real Software Users Guide and Language Reference either has a lot of
> missing
> pieces, or I simply don’t, as yet, know how to interpret them.
>
> Does anyone know of a third party book that covers the subject of Real
> Software, Group2D and Object2D “Working with Vector Graphics” in a complete
> and comprehensive manner?
>
> Thank you for any help you might be able to offer. Myron Meyer
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>


--