EditValue problem

P

pyda001

Hi yall!

I have created an image selection dropdown editor for use in a
PropertyGrid. My selector form is called dropdown by a
IWindowsFormsEditorService and so far it's all sweet.

On my selector form I have placed a lot of pictures the user can select
from. I have also placed a button with "From File..." that opens an
OpenFileDialog (Remember that this is still in the dropdown dialog form
of the PropertyGrid). The problem is that when the "From File..."
button is clicked, ShowDialog() is called, the OpenFileDialog opens and
gets focus, and the selector form DISAPPEARS. As a second effect, the
OpenFileDialog stays topmost, yet the application can be used
underneath.

How can I keep the dropdown UITypeEditor visible after the
OpenFileDialog.ShowDialog() call, and yet make both controls disappear
if the user clicks somewhere else on the screen or presses esc?

Thanks!


- Peder -
 
H

http://www.bit-kit.com

Nope, that don't work. I suspect the reason is that
IWindowsFormsEditorService somehow strips the selector form for all
events and key variables. This results in that even if the form is set
as the owner of the OpenFileDialog, the editor service unsets it so it
becomes modal with no owner. The selector form is still disposed of,
but without any events firing.

The way I ended up handling it was to keep a static variable to the
bottommost non-mdi form, and setting this as the owner programatically
in ShowDialog(). That way the application is locked until the user
either clicks Ok or Cancel on the OpenFileDialog. It might not be the
cleanest solution I could think of, but it works.


- Peder -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top