Electron parent and child window conflict while using modal window - window

I am new to Electron and have freshly started an Electron project in our company.
Using Electron the way to create a modal window is to: set the parent for that new child browser window and by setting the modal type to true.
This works well and fine.
My case is, we have so many modal windows that needs to be popped up, that is being achieved by making a synchronous call from the renderer to the main, where main.js opens up the new modal window.
I am passing a variable called parent from the renderer(: remote.getCurrentWindow()) and in my main on ipcMain i am fetching that parent variable and setting it as the parent of the child window and by setting the modal to true,
This doesn't seem to work as the more and more windows are getting called from renderer, the browser window even though setting the parent attribute as obtained from the renderer doesn't act as a modal window, i.e., it gets closed when the focus is moved away.
In this case how do i come to know that which is the parent window of this new browser window which is about to open up?
How do i overcome this??

Related

CefSharp: force re-render

There is a Managed C++ application. Some of its C++ (MFC) views host a WinForm's version of CefSharp. It shows everything OK.
But, there is annoying bug: when Cefsharp's window where hidden by another window, and then that window are closed, then CefSharp's window becomes completely blank. If try to resize this window or move it then CefSharp engine re-draw html content and everything is OK. But if we do nothing it stays blank forever. Is it possible somehow to force CefSharp to re-draw content on Activate or so event?
I tried to google, bot not successed ...

WinAPI changing parent of a ListView control

I'm developing an application with tab controls. After clicking on an icon in a tab, a popup window opens and the contents of the tab are moved to the popup window.
What I do is simple - change parent of each control within the tab to the popup window (using SetParent()). Everything works great except for listview controls (virtual listview).
After changing the parent, the listview no longer sends WM_NOTIFY notifications.
I've also tested it with non-virtual listview and the same happens.
I've searched all over google and came up with nothing, so any ideas would be appreciated.
UPDATE
After changing the parent, the listview keeps sending WM_NOTIFY notifications to its previous parent. Is this a bug in common controls?
A lot of the common controls cache their parents when they are created. There's nothing you can really do about this except to create them with the right parent in the first place.
One workaround is to register a dummy window class that does nothing more than host the common control in question, and forward messages back and forwards to it. Then you can reparent that window rather than the control itself.

JavaFX 2: Passing mouse events through to other windows?

I created a PopUp which is draggable across the screen, like a photoshop palette independent of the main window.
However, I would like the main window to react when I drag this PopUp over it, i.e. receive the mouse events from the drag.
The problem seems to be that since the PopUp is a Window itself, it consumes the dragging mouse events, and the main window never gets them.
I tried making the main windows the owner of the PopUp, however it still doesn't get them.
Is there any way to get around this ? Thanks

Debugging SHDocVw.InternetExplorer.Quit not closing iexplore.exe process

I think there's no definite answer so how would you approach debugging this problem?:
My main app (a MicroStation plugin) launces IE using the SHDocVw.InternetExplorer COM wrapper, interacts with it, hides it when it is not used (e.g. intercepts when the user closes the window and sets InternetExplorer.Visible to false).
When the main app is closed the plugin closes IE by calling InternetExplorer.Quit but the iexplore process is left running (the IE is hidden at the moment the main app is closed).
What I have tried:
Calling System.Runtime.InteropServices.Marshal.FinalReleaseComObject on the InternetExplorer object after calling Quit
Setting the reference to the InternetExplorer object to null after Quit and FinalReleaseComObject
Making sure the parent managed objects gets GC'd (checking if Finalize is called) before the main app exits
Creating a test console app and trying to reproduce the problem there. E.g. trying to call Quit when IE is in the hidden state. (I could not reproduce the problem, IE gets closed as soon as the app exits)
What is also interesting, I could not reproduce the problem calling Quit within the same main app (MicroStation plugin) but while the main app is running, not in the exit event handling code. When called in that other place Quit closes IE as expected.
Otherwise the InternetExplorer object is opaque to me.
Are there other ways to debug this problem?
Edit: It may be worth noting that the main app creates a UserControl and makes the IE window a child of this UserControl (using SetWindowLong to change the GWL_STYLE to allow the window to be a child and SetParent to set the UserControl as parent). But when the IE is hidden (which it is when the Quit attempt fails) the parent window is set to 0.
Thanks!

Accept mouse clicks without activating the application?

I am working on a utility application that controls other running applications. On certain input event my application displays a window, user can pick some operation from the window, the window disappears and control returns to the previous app. My problem is that clicking in my app’s window activates my application, thus removing focus from the previous application’s window. I can re-activate the previous application when my window closes, but I’d rather keep the original application activated all the time. Is that possible?
It's quite easy to to, just make your window an instance of NSPanel (a subclass of NSWindow), and set it as non-activating in Xcode/IB (or create it programatically, with NSNonactivatingPanelMask in the style mask).
One idea would be: while your app is running, try to keept track of the active window in the system.
After you activate your app and click the command button, restore the previous active window.
This is only an idea, I don't know how to do it on mac.

Resources