Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / July 2005

Tip: Looking for answers? Try searching our database.

Trapping double click in a property editor

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BRCEWANE - 31 May 2005 17:26 GMT
We are currently creating our own Tab in the "Properties" property
editor using "System.Windows.Forms.Design.PropertyTab" and then
implementing our properties using the "PropertyDescriptor" for a custom
control on our custom designer.

This all works fine and the tab does become visible and shows for our
control when selected in the designer.

Where our problem lies, is that we want to be able to trap the double
click on the property in our tab much like double clicking an event for
a button via the "Events" tab.

We have yet to be able to find a way to trap this but know that it is
possible since VS is doing it.  They however are doing it via internal
classes that are not accessible to us.

We have tried to get a handle to the the Properties window via an
IVSWindowFrame, Much like getting a CodeWindow interface, but cannot
get down to any attributes to find out what is going on in the
properties editor.

The only way we can think of trapping the DoubleClick is by doing a
global Mouse Handler and then finding where they double clicked.

Any help would be appreciated.
BRCEWANE - 31 May 2005 22:01 GMT
Well, couldn't find an easy way to do it because everything used
internal classes, so one of the guys here came up with a "superhack".

Basically he got the hwnd of the main VS.NET application and then was
able to traverse through all the internal windows of VS.NET.

When he came across the "Properties" window he was able to do a
ControlFromHwnd to get an actual VS control object for the properties
window..

He was then able to traverse down through all of the windows inside
that one to get access to all the internal conrols/classes that were
being used.  That way we were able to actually get a handle to the
TextBox controls that are used in the Property Grid.  We then added a
DoubleClick handler to all the textbox controls.

>From that point we were able to get the selected PropertyDescriptor by
using a type.InvokeMember method to invoke the built in
SelectedPropertyDescriptor attribute to get the actual custom
PropertyDescriptor object that we created that was currently selected
and had just been double clicked.

Seems like a whole lot of work for something that would seem intirely
simple, but what can you do :)

We're sure that some day we will come across a 2 line solution for what
we are trying to do... LOL
DarenYong - 10 Jul 2005 22:56 GMT
Hello,

I want to implement functionality similar to the Windows Forms Designer for
the Events tab, where double clicking on a property triggers an event.

I found an older post about a "super-hack" to make this work by BRCEWANE.
I'm hoping someone can help me here with a code sample...

Best Regards,
Daren.

POST BY BRCEWANE:
================

Well, couldn't find an easy way to do it because everything used internal
classes, so one of the guys here came up with a "superhack".

Basically he got the hwnd of the main VS.NET application and then was able
to traverse through all the internal windows of VS.NET.

When he came across the "Properties" window he was able to do a ControlFromHwnd
to get an actual VS control object for the properties window..

He was then able to traverse down through all of the windows inside that
one to get access to all the internal conrols/classes that were being used.
That way we were able to actually get a handle to the TextBox controls that
are used in the Property Grid. We then added a DoubleClick handler to all
the textbox controls.

> From that point we were able to get the selected PropertyDescriptor by


using a type.InvokeMember method to invoke the built in SelectedPropertyDescriptor
attribute to get the actual custom PropertyDescriptor object that we created
that was currently selected and had just been double clicked.

Seems like a whole lot of work for something that would seem intirely simple,
but what can you do :)

We're sure that some day we will come across a 2 line solution for what we
are trying to do... LOL

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.