Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question re IC4 properties dialog #8

Open
g40 opened this issue May 14, 2024 · 4 comments
Open

Question re IC4 properties dialog #8

g40 opened this issue May 14, 2024 · 4 comments

Comments

@g40
Copy link

g40 commented May 14, 2024

Hello.

Is the properties dialog running its own message loop in its own thread?

I ask as the minimal Win32 based example shown below will continue to allow update the incoming image as the various properties are modified without any problem.

But I've got one case where a DirectX9 based framework is in use and the properties dialog appears to block all messages whilst it is visible. This means modified property values are not visibly applied until the dialog is dismissed. Which is, of course, not what is required.

Any comments welcomed.

Many thanks.

image

@TIS-Tim
Copy link
Contributor

TIS-Tim commented May 14, 2024

Hello Jerry,

it is running as a modal dialog, so there is definitely some kind of message loop in there, but no extra thread.

However, ic4's builtin display does create its own render thread and therefore can update in the background.

I did a quick test where I compare the messages I get when the property dialog is open versus the messages I get when I call ::MessageBox with the main window as the parent -- at least for WM_PAINT and WM_MOUSEMOVE it seems like I do not get any messages for either while a modal dialog is displayed.

Is there a specific message where you see different behavior between the property dialog and a basic message box?

Tim

@g40
Copy link
Author

g40 commented May 14, 2024

Hello Tim,

Thanks. I have worked around the problem by running the properties dialog in its own thread. This is a perfectly satisfactory solution for the time being.

An optional and slightly more complex API that did something like this might also be useful. Not sure. Threads are easy these days.

Jerry.

/*
	An absolutely minimal modeless example ...
*/

// create and display the property window
ic4::WindowHandle hProperties = createDeviceWindow(hParent,grabber);
if (hProperties)
{
	// do work.
	
	// clean up
	destroyDeviceWindow(hProperties);
}

@TIS-Tim
Copy link
Contributor

TIS-Tim commented May 15, 2024

You are right, that this kind of thing could be useful as part of the public API.

Adds some new questions though; like the grabber closing and opening a new device while the dialog is opened etc.

@g40
Copy link
Author

g40 commented May 15, 2024

Hi Tim,

One more thing re the threaded solution. I have assumed that the root property dialog window is created during execution of ic4gui::showPropertyDialog(). Is this correct?

The one other thing that might be useful for the modal dialog is a flag to enable both OK and Cancel buttons - which is what would generally be expected in the modal context.

Thanks again,

Jerry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants