Re: How to close a Property Sheet after deferred Save activity?

"Jim Barry" <[email protected]>
Newsgroups gmane.comp.windows.wtl
Message-ID <642A1F3F17C94595B560938A443C63EF@TTX>
Dick Dievendorff wrote:
> I have a property sheet and a property page that has some number of
> edit controls.  When the user presses OK or Apply I need to write the
> "dirty" control values to an external device (via a serial port) when
> the user clicks the "Apply" or "OK" buttons.  My routines that send
> the values to the external device are asynchronous.  I start a
> request and when the request is complete I receive an "event
> complete" sort of windows message. 
> 
> When I reach OnApply, I'm able to start the asynchronous "save"
> operation and respond with PSNRET_INVALID_NOCHANGEPAGE to keep the
> page from terminating immediately.

I think this approach is very problematic. For one thing, the user could start messing around with the dialog and click the "Apply" or "Cancel" button while you are doing your asynchronous transaction. Two possible solutions: 

1) Make your transaction synchronous by moving it to a secondary thread, which your OnApply handler waits for.

2) Perform the transaction outside of the property sheet, i.e. after it has closed.

-- 
Jim Barry, Microsoft MVP


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.