Board index » cppbuilder » HWND of Object Inspector from a property editor

HWND of Object Inspector from a property editor

How does one get the HWND of the Object Inspector from within a property
editor ?
 

Re:HWND of Object Inspector from a property editor


There is no direct way to do that from the VCL.  You'll have to use the
Win32 API function FindWindow() or FindWindowEx() instead.

Why do you need this?

Gambit

Quote
"Edward Diener" <eddie...@tropicsoft.com> wrote in message

news:3ccc6c2f$1_2@dnews...
Quote
> How does one get the HWND of the Object Inspector from within a
> property editor ?

Re:HWND of Object Inspector from a property editor


"Remy Lebeau [TeamB]" <gambi...@yahoo.com> wrote in message
news:3cccd7e5$1_1@dnews...

Quote
> There is no direct way to do that from the VCL.  You'll have to use the
> Win32 API function FindWindow() or FindWindowEx() instead.

> Why do you need this?

My TPropertyEditor::Edit routine is going to call a modal dialog box routine
and I wanted a parent window for the modal dialog box. Of course I can call
it with no parent but I tend not to do that for modal dialog boxes.

Doesn't it seem reasonable, however, that a property editor should be able
to easily get the HWND of the Object Inspector ?

Re:HWND of Object Inspector from a property editor


Quote
"Edward Diener" <eddie...@tropicsoft.com> wrote in message

news:3ccce484$1_1@dnews...

Quote
> My TPropertyEditor::Edit routine is going to call a modal dialog box
> routine and I wanted a parent window for the modal dialog box. Of
> course I can call it with no parent but I tend not to do that for modal
> dialog boxes.

You could try using Application->Handle for that.

Quote
> Doesn't it seem reasonable, however, that a property editor should
> be able to easily get the HWND of the Object Inspector ?

No, because it's never needed, thus not provided for.  Property Editors are
not supposed to modify or otherwise interact with the Object Inspector
directly, only provide the data it requests of them.

Gambit

Re:HWND of Object Inspector from a property editor


"Remy Lebeau [TeamB]" <gambi...@yahoo.com> wrote in message
news:3ccd806f$1_2@dnews...

Quote

> "Edward Diener" <eddie...@tropicsoft.com> wrote in message
> news:3ccce484$1_1@dnews...

> > My TPropertyEditor::Edit routine is going to call a modal dialog box
> > routine and I wanted a parent window for the modal dialog box. Of
> > course I can call it with no parent but I tend not to do that for modal
> > dialog boxes.

> You could try using Application->Handle for that.

> > Doesn't it seem reasonable, however, that a property editor should
> > be able to easily get the HWND of the Object Inspector ?

> No, because it's never needed, thus not provided for.  Property Editors
are
> not supposed to modify or otherwise interact with the Object Inspector
> directly, only provide the data it requests of them.

I have given a case where it would be convenient, not to interact with the
IO but to use it as a dialog parent since this is where a published property
visually resides in the IDE. So in creating a property editor's Edit()
method, it would be the most logical thing to use the place where that
property visually exists as the parent to the modal dialog.

It is a moot point, and merely a design issue, as I can use 0 or
Application->Handle, as you suggest, for the parent window.

Re:HWND of Object Inspector from a property editor


If you're creating your own dialogs, then chances are you're basing them on
TForm in which case knowing a parent window for modality is irrelavant, just
use the ShowModal() method and let the form handle the rest for you.

The only API dialog I can think of you using is MessageBox(), in which case
you can use Application->MessageBox() instead an let it handle parent
modality for you.

Gambit

Quote
"Edward Diener" <eddie...@tropicsoft.com> wrote in message

news:3ccd94ac$1_2@dnews...
Quote
> I have given a case where it would be convenient, not to interact with
> the IO but to use it as a dialog parent since this is where a published
> property visually resides in the IDE. So in creating a property editor's
> Edit() method, it would be the most logical thing to use the place where
> that property visually exists as the parent to the modal dialog.

Re:HWND of Object Inspector from a property editor


"Remy Lebeau [TeamB]" <gambi...@yahoo.com> wrote in message
news:3ccdac92_1@dnews...

Quote
> If you're creating your own dialogs, then chances are you're basing them
on
> TForm in which case knowing a parent window for modality is irrelavant,
just
> use the ShowModal() method and let the form handle the rest for you.

> The only API dialog I can think of you using is MessageBox(), in which
case
> you can use Application->MessageBox() instead an let it handle parent
> modality for you.

How about if I need to create a wide character dialog box ? The VCL doesn't
do this so I must do it manually myself via DialogBoxParamW. The VCL is very
good but it doesn't handle the entire Windows API so one must go outside of
it sometimes.
Quote

> Gambit

> "Edward Diener" <eddie...@tropicsoft.com> wrote in message
> news:3ccd94ac$1_2@dnews...

> > I have given a case where it would be convenient, not to interact with
> > the IO but to use it as a dialog parent since this is where a published
> > property visually resides in the IDE. So in creating a property editor's
> > Edit() method, it would be the most logical thing to use the place where
> > that property visually exists as the parent to the modal dialog.

Re:HWND of Object Inspector from a property editor


Get third-party Unicode-aware components, then you're back to TForm :-)

Gambit

Quote
"Edward Diener" <eddie...@tropicsoft.com> wrote in message

news:3ccde2a1$1_1@dnews...
Quote
> How about if I need to create a wide character dialog box ? The
> VCL doesn't do this so I must do it manually myself via
> DialogBoxParamW. The VCL is very good but it doesn't handle the
> entire Windows API so one must go outside of it sometimes.

Re:HWND of Object Inspector from a property editor


"Remy Lebeau [TeamB]" <gambi...@yahoo.com> wrote in message
news:3ccde452$1_2@dnews...

Quote
> Get third-party Unicode-aware components, then you're back to TForm :-)

I find it much easier to just call the native Windows API myself rather than
have to buy or download a 3rd party component in this case <g>.

Other Threads