🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #1669

Re: object-oriented drawing program in windows

#1669
From: Tom W. Brown
Date: Fri, 16 Oct 1992 22:17
47 lines
2757 bytes
In article <1992Oct16.061314.17383@emr1.emr.ca>, jagrant@emr1.emr.ca (John Grant) writes:
|> I'm so used to thinking of creating child, popup, overlapped windows, dialog
|> boxes etc, that I just realized I have no idea of how to create other objects
|> that can be picked, moved resized etc.  For example, suppose I have a drawing
|> program where I can pick a tool and draw a circle, ellipse, rectangle etc.
|> Or perhaps a graphics object is created by reading and plotting a data file
|> or a metafile of GDI primitives.
|> 
|> Later how do I 'pick' that object so that I can move it, resize it or whatever.
|> Do I just create an invisible window and draw in its invisible client area?
|> Obviously the easiest way to 'pick' an item is to draw each object in its
|> own window, so hit-testing is not required.

This is fine until your graphic objects start overlapping.


|> 
|> In the GKS world, each graphical item is a segment and you can pick a segment
|> with the cursor (internally I think it just checks the (x,y) point with the
|> (x,y) of all of the items in the display list for each object.  I sure wouldn't
|> want to do that in Windows.

You may have to, although there may be 3rd party graphics libraries out there
that have already done the work for you -- I don't know.


|> 
|> So: 1. how do I draw an object?  In it's own window?  What kind?
|>     2. how do I pick one of these objects?
|> 
|> Life is not just limited to moving and sizing rectangles around the screen.

I think the "every object in its own window" approach only works when no
overlap is allowed (that is, no overlap of the rectangular windows, not just
the drawing inside).  If this is too stringent then I'd recommend that you
simply draw into one window and keep a list of the "objects" that have been
drawn.

This list can be organized into a suitable data structure that will aid hit
testing and you will probably have to do that yourself :-(


----------------------------------------------------------------------------
Tom Brown               |  "Strange women, lying in ponds, distributing
PE Nelson Systems       |   swords is no basis for a system of government."
twbrown@pe-nelson.com   |                    Monty Python and the Holy Grail
----------------------------------------------------------------------------
Technical Details
Message-ID: <643@lax.lax.pe-nelson.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!lax.pe-nelson.com!lax!twbrown
References: <1992Oct16.061314.17383@emr1.emr.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!lax.pe-nelson.com!lax!twbrown
From: twbrown@PE-Nelson.COM (Tom W. Brown)
Newsgroups: comp.os.ms-windows.programmer.misc
Subject: Re: object-oriented drawing program in windows
Message-ID: <643@lax.lax.pe-nelson.com>
Date: 16 Oct 92 22:17:26 GMT
References: <1992Oct16.061314.17383@emr1.emr.ca>
Sender: news@lax.pe-nelson.com
Organization: PE-Nelson
Lines: 48