🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.programmer
1 messages
1 total messages Started by Mike D Marchionna Thu, 23 Jul 1992 18:01
Can't redraw in conentView after resizing window?
#202
Author: Mike D Marchionna
Date: Thu, 23 Jul 1992 18:01
117 lines
4656 bytes
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_______________________________________________________________/ 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads