Re: Best practise: Kommunikation modeless Dialog und View

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hallo Peter!

1.) Lediglich Speicherung der Dialogdaten im Dialog-Objekt und der Code für die "Aktion" im View?

Würde ich so sehen.

2.) Verarbeitung der Results direkt im Dialog? Dann muss ich Funktionen des Views aufrufen, z.B.:
a) dynamic_cast<CMyView*>(GetParent())->Navigate(m_strUrl);

Vorsicht! GetParent ist eben nicht der View. Der ist en Child Window und Child-Windows können kein Parent sein. Der echte Parent ist das Main Wnd! Schau Dir den Zeiger im Debugger an!

Mit DYNAMIC_CAST oder STATIC_CAST hättest Du einen ASSERT bekommen! Ich bervorzuge in diesem Fall immer die MFC Macros vor den C++ Varianten!

b) GetParent()->SendMessage(WM_USER + 101, 0, m_strUrl);

Gute Methode!

c) ...

c. Wie wäre es mit einem Funktions-Interface, dass dem modalen Dialog übergeben wird und das als zusätzlich im CView mit abgeleitet wird.
d. Wie wäre es mit Funktionszeigern?
e. Delegator Konzept

Variante 2.a. habe ich gerade versucht, das führt zu unreproduzierbaren Abstürzen und assertion fails...

s.o.

--
Martin Richter [MVP] WWJD http://blog.m-ri.de
"A well-written program is its own heaven; a poorly written
program is its own hell!" The Tao of Programming
FAQ: http://www.mpdvc.de Samples: http://www.codeproject.com
.



Relevant Pages

  • Re: [ptrace] please review follow fork/exec changes
    ... The SIGHUP I mentioned is due to the fact that the parent exits immediately. ... I think it will be easier if the flag is different from PL_FLAG_FORKED. ... PT_FOLLOW_EXEC is easy to implement, but my question is, how can debugger ... ignores the notification when the invalidation shall be done, ...
    (freebsd-current)
  • Re: [ptrace] please review follow fork/exec changes
    ... zombie and confusing debugger. ... and the real parent with get the child back into the children's list ... Not the debugger loop, the kern_waitloop. ...
    (freebsd-current)
  • Re: [ptrace] please review follow fork/exec changes
    ... can detach from the old process and attach to the new one. ... Yes, the debugger gets SIGTRAPs. ... parent of the forked process has the code to collect termination ... instead a new link list data structure should be ...
    (freebsd-current)
  • Re: [ptrace] please review follow fork/exec changes
    ... zombie and confusing debugger. ... and the real parent with get the child back into the children's list ...
    (freebsd-current)
  • Re: [ptrace] please review follow fork/exec changes
    ... zombie and confusing debugger. ... and the real parent with get the child back into the children's list while ... Next, the wait4() call from debugger gets an error, and zombie will be ...
    (freebsd-current)