home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!decwrl!sgi!wdl1!wdl1!mdm
- From: mdm@wdl1.wdl.loral.com (Mike D Marchionna)
- Newsgroups: comp.sys.next.programmer
- Subject: Can't redraw in conentView after resizing window?
- Message-ID: <1992Jul23.180124.108@wdl.loral.com>
- Date: 23 Jul 92 18:01:24 GMT
- Sender: news@wdl.loral.com
- Distribution: usa
- Organization: Loral Western Development Labs
- Lines: 117
-
- Help! I'm stupid.
-
- I have an Application that has a custom View inside a window leaving
- a 2 pixel boarder around custom view. It looks sort of like this:
-
- +------------------+
- | |
- | +--------------+ |<--Window
- | | | |
- | | | |
- | | Custom View | |
- | | | |
- | | | |
- | +--------------+ |
- | Content View |
- +------------------+
-
- I have implemented delegate methods -windowDidBecomeMain: and
- -windowDidResignMain to draw a 2 pixel wide rectangle in the windows content
- view to produce a highlighted border around the Custom View. A black border
- is drawn when the window bocomes main and light gray border is drawn when
- the window resigns main.
-
- The problem is when the I resize the window. I have implemented the
- the -windowDidResize method redraw the border in the content view, but
- it does not seem to work. I use the same code I used to draw the
- border in the -windowDidBecomeMain: method. Try as I might I can't get this
- to work. The custom View is set to auto size with the window, and I use the
- content Views bounds rectangle difine the rectangle to draw. When I dump
- the values for the content View bounds rectangle they seem consistent with
- the windows new size.
-
- So why isn't my border getting redrawn? What the heck am I missing?
- Any help is appreciated. The pertinant code is listed below.
-
- --MDM
-
- /******************************************************************************
- * INSTANCE METHOD:- windowDidBecomeMain: *
- ******************************************************************************/
- - windowDidBecomeMain:sender
-
- { /* Local Variables */
- NXRect bounds;
-
- /* BEGIN - windowDidBecomeMain: */
-
- /* Draw a 2 pixel wide border rectangle around the VdtView in the **
- ** Vdt Window's content view. */
- [contentView getBounds:&bounds];
- [contentView lockFocus];
- PSsetgray(NX_BLACK);
- PSsetlinewidth(2.0);
- PSrectstroke(bounds.origin.x+1.0, bounds.origin.y+1.0,
- bounds.size.width-2.0, bounds.size.height-2.0);
- [contentView unlockFocus];
-
- /* Since the window has become key, make sure the VDT is up to date */
- [IVvdtView updateVdtView:self];
-
- return(self);
- }/* END - windowDidBecomeMain: */
-
- /******************************************************************************
- * INSTANCE METHOD:- windowDidResignMain: *
- ******************************************************************************/
- - windowDidResignMain:sender
-
- { /* Local Variables */
- NXRect bounds;
-
- /* BEGIN - windowDidResignMain: */
-
- /* Clear the 2 pixel wide border rectangle around the VdtView in **
- ** the Vdt Window's content view. */
- [contentView getBounds:&bounds];
- [contentView lockFocus];
- PSsetgray(NX_LTGRAY);
- PSsetlinewidth(2.0);
- PSrectstroke(bounds.origin.x+1.0, bounds.origin.y+1.0,
- bounds.size.width-2.0, bounds.size.height-2.0);
- [contentView unlockFocus];
-
- return(self);
- }/* END - windowDidResignMain: */
-
-
-
- /******************************************************************************
- * INSTANCE METHOD:- windowDidResize: *
- ******************************************************************************/
- - windowDidResize:sender
-
- { /* Local Variables */
- NXRect bounds;
-
- /* BEGIN - windowDidResize: */
-
- /* Redraw a 2 pixel wide border rectangle around the VdtView in the **
- ** Vdt Window's content view. */
- [contentView getBounds:&bounds];
- [contentView lockFocus];
- PSsetgray(NX_BLACK);
- PSsetlinewidth(2.0);
- PSrectstroke(bounds.origin.x+1.0, bounds.origin.y+1.0,
- bounds.size.width-2.0, bounds.size.height-2.0);
- [contentView unlockFocus];
- [contentView display];
-
- return(self);
- }/* END - windowDidResize: */
-
- --
- _________________________________________________________________________
- ( _______________________________ Brain, and brain! What is brain! )
- \________________________________) --Star Trek (Spock's Brain) /
- El_Rayo_X_______________________________________________________________/
-