15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


closing modeless CPropertySheet

William W. Whiting -- billw@usa.net
Friday, May 10, 1996

Env: VC4.1/Win95 & WinNT 3.51

How do I gracefully handle an OK button event from a modeless property =
sheet when that sheet is using it's own doc/view and is created in a =
CMiniFrameWnd rather than a CMDIChildWnd? I seem to be either missing =
the notification or leaking memory. When OK is pressed I need to do my =
"apply" actions for each property page which is modified. I have created =
several CTypedPtrArray objects which need to be cleaned up. I am =
currently doing this in the document's DeleteContents virtual function. =
Currently I can only get what I want done my pressing the apply button =
and then closing the miniframe using its system menu or close button.

Thanks.

Bill Whiting




David W. Gillett -- DGILLETT@expertedge.com
Monday, May 13, 1996

> Env: VC4.1/Win95 & WinNT 3.51
> 
> How do I gracefully handle an OK button event from a modeless
> property sheet when that sheet is using it's own doc/view and is
> created in a CMiniFrameWnd rather than a CMDIChildWnd? I seem to be
> either missing the notification or leaking memory. When OK is
> pressed I need to do my "apply" actions for each property page
> which is modified. I have created several CTypedPtrArray objects
> which need to be cleaned up. I am currently doing this in the
> document's DeleteContents virtual function. Currently I can only
> get what I want done my pressing the apply button and then closing
> the miniframe using its system menu or close button.

  By default, a modeless property sheet has its buttons hidden and 
outside its frame.  It's tempting to "simply" extend the frame and 
unhide the buttons, but in this case you want the OK click to trigger 
both actions in the sheet *and* the frame.
  You could invoke the frame's "close" command by posting it a 
WM_SYSCOMMAND message from your OK and Cancel handlers (in your own 
class derived from CPropertySheet).  Or you could create your own 
OK/Cancel buttons as siblings of the sheet, and call 
CPropertySheet::PressButton() from their handlers to notify the sheet 
and its pages.

Dave





| Вернуться в корень Архива |