Simulate window main while in Response - Powerbuilder - powerbuilder

Is it possible to simulate window main while window response is active? I want my code in window main running.

It sounds like you need a popup window instead of a response window. Response windows are modal and will halt the execution of any code in your main window.

You can do this by passing a reference to your main window when you open the response window. See the OpenWithParm function in the help. This is not very good from an object-oriented perspective because in PowerBuilder all of the controls and events in the window are public. It would be best to put the code you want to run in a non-visual object that the window uses and pass a reference to that object.

Related

MFC IE embedded web browser wackiness

I have this modeless MFC dialog which embeds an Internet Explorer web browser control.
The control is derived straight from CWnd with ActiveX wrappers generated by Visual Studio, and I map it to the CDialog using only a DDX_Control(pDX, IDC_EXPLORER, m_explorer);.
I have 2 problems.
Problem #1:
Being modeless, I start and stop the dialog at my own pleasure using new/Create(), then DestroyWindow()/delete(in PostNcDestroy).
Trouble begins when the IE control starts loading a Flash video (regular YouTube stuff): when one closes, thus destroying the dialog, the video still loads! Right until fully cached. The Flash ActiveX thread still lingers and continues to run even when the parent dialog has passed PostNcDestroy and all memory was freed.
What to do? How do you trully 'kill' that child web control and all its threads?
Problem #2:
The web browser control covers the whole area of the dialog. I cannot intercept any OnMouseMove() - in the parent dialog or in the web browser mapping class! What gives?
Thanks!
"Cleanup"
"delete this" in PostNcDestroy() - and calling the base func of course. Should it be more? What? Shouldn't the dialog gracefully take care of its children?
I tried to explicitly call DestroyWindow on the web control, or send/post him messages like WM_DESTROY, WM_CLOSE, even WM_QUIT - but nothing - same deal.
Problem #2:
No, like indented, the control takes all space and it's on top so I guess any mouse action doesn't get transmitted 'bellow' :)? But then why doesn't his own OnMouseMove get called? Because it goes straight from CWnd? I'm lost...
problem 1) try myBrowser.navigate("about:blank") before destroying the window.

Window refresh After Other Window close

How can I refresh a window when clicking the close button of a other window?
The other window is a Response Window.
I use PowerBuilder 12.5
The best way is to pass a reference into the response window for the “other window” (if you’re already passing in a parameter, you can pass in multiple parameters in a custom powerobject), store it in an instance variable, then fire off a “refresh” event (iw_OtherWindow.TriggerEvent()) on the other window at an appropriate time during the close logic of your response window.
Good luck.
Try to check the valid status of refresh required window in close query event of that closing window.
If the valid status is true then do the refresh code.
Best of luck.

Can I allow opening windows from everywhere in Qt?

I have the following situations where I would like to display some widgets.
My main windows is mostly a text editor.
I have an action called 'Run', which interprets the text and does something.
One of the possible results is that a window needs to be opened.
It works, but the window is only displayed after the run function (which I have as a slot)returns.
Another situation I have to open a window is that I want to be abe to same interpreter to run from console input.
But opening the window in this case results in errors like:
QObject: Cannot create children for a parent that is in a different thread.
(Parent is Oxygen::WidgetStateEngine(0xee2d90), parent's thread is QThread(0xda53b0), current thread is QThread(0x7f2178004000)
QObject::installEventFilter(): Cannot filter events for objects in a different thread.
What can I do to somehow 'centralize' window operations so that this does not happen ?
All GUI objects are to be created within your main thread. You can get access to QMainWindow instance from any place in your code using static method QApplication::topLevelWidgets()

C++ Win32 API GetMessage From Awesomium In Separate Thread

Hello and thank you taking the time to view my question.
I am making a C++ program which uses the Win32 API to create the initial program window. I then create a thread which creates a child window and I attach my Awesomium WebView to this child window.
I understand Awesomium is not thread safe but the documentation states that it is thread safe to the point that it allows you to use Awesomium in an alternate thread as long as you are using it in the thread it was created in.
Now for the issue. I have a problem receiving input from this thread back into the WinProc. If I attempt to click my mouse inside Awesomium which is parented to this child window then I can no longer drag the main window around the screen or use the minimize/maximize/close button nor does actually clicking on anything inside the awesomium window have any effect.
I've done a lot of research and found AttachThreadInput() but that does not seem to help.
Does anyone know how I can send/receive messages to/from this thread into WinProc?
The current code is here: http://pastebin.com/i4kNHcch
Thank you very much your time is greatly appreciated.
Your problem could have nothing to do with the Awesomium being not thread safe. With a main window in one thread and a child window in another thread Windows can deadlock. The parent and child windows need to communicate with each other (inside the OS) and they are not designed to communicate out-of-thread.

Create two windows in one application?

It might be a simple question, but I don't know where to start the search for the answer. How do I create two individual windows interface in one application using native winapi? Do I put two CreateWindow() functions using same HINSTANCE? What if I want a login screen windows and the content page such that login screen comes first, and after I press the button, the login screen is destroyed, and the content page appears. How do I do such trick?
I was thinking of using DestroyWindow and then CreateWindow inside the button click message. However, this would mean the main while loop (for translate/dispatch msg) in WinMain will exit its loop and cause the whole program to exit. Another way is to pre-create it in WinMain, but how would I notify the WinMain if the button was clicked and enter the second loop instead of exiting the program?
You're over-thinking it. To create two windows, call CreateWindow twice. It's just that simple.
Calling DestroyWindow does not cause your program to exit its message pump. Calling PostQuitMessage is what does that. So don't do that.
When the button is clicked, destroy the one window and create the other. There are no tricks. The message pump delivers messages to all windows (unless you're doing it wrong by explicitly requesting messages for one window, but you shouldn't do that).

Resources