Hi all,
after stepping through the smalltalk code, window messages and API calls
I discovered that modal dialog work best against shell views.
As the hwnd of the View I'm getting does not belong to a shell I tried
it's top view (using View>>topView) which didn't work either. It seems
that the application I'm getting the hwnd from is wrapping shells into a
container of it's own which is then child of the desktop :-(
I added a methods to View and Dialog which solves the whole thing (at
least as far as I can tell) and works fine for my purposes:
View>>topShellView
| topMost topMostShellView |
topMost := self.
topMostShellView := nil.
[topMost isTopView] whileFalse:
[(topMost isKindOf: ShellView) ifTrue: [topMostShellView := topMost].
topMost := topMost parentView].
^topMostShellView
Dialog class>>showModalTo: aView
"Creates a default instance of the receiver with a default view and
displays it modal to the current active window.
Answers the result of the dialog if confirmed or nil otherwise"
^self create showModalTo: aView
Dialog>>showModalTo: aView
^self view showModalTo: aView
Using this method I can write
aDialog showModalTo: (View fromHandle: hwnd) topShellView
which will present a dialog modal to hwnd's shell even if hwnd is in
another proccess.
CU,
Udo
Udo Schneider wrote:
> Hello,
>
> I'm having quite a problem here getting a Dolphin Dialog modal to a
> non-Dolphin (external proccess) view.
>
> I'm getting the hwnd of an external window. I'm trying to display a
> Dolphin dialog modal to it with something like "DialogView>>showModalTo:
> (View fromHandle: theExternalHwnd).
>
> Although the dialog apears it's not modal to the given hwnd.
>
> Any hints?
>
> CU,
>
> Udo
>
>