.NET

Reply
*Expert Elite*
Jeff_M
Posts: 4,424
Registered: ‎07-22-2003
Message 1 of 5 (228 Views)
Accepted Solution

PaletteSet, use Keyboard when Editor has focus

228 Views, 4 Replies
08-21-2013 09:03 PM

OK, not sure if the Subject says it well, but what I have is a PaletteSet that is displayed during a command in order to show some data as well as containing options for the command. Once it is displayed I set the focus back to the Editor so the user can select objects. When the cursor moves over the Palette focus is automatically switched so the mouse can select the options thereon, then switches back to the Editor as the cursor moves off the Palette. This all works fine & dandy.

 

What I am trying to do is allow the user to use the keyboard to 'press' buttons on the Palette form via a Hotkey approach. The entire time that the Editor has focus, the Editor.GetEntity() method is in use to allow the user to select an object.

Can anyone point me in the right direction for such a task?

 

Thanks!

Jeff_M, also a frequent Swamper

The solution turned out to be simple enough. Instead of using the PaletteSet.Handle to pass to the constructor I used the UserControl.Handle and all works as desired. I posted the sample project to theSwamp's .NET forum.

*Expert Elite*
Jeff_M
Posts: 4,424
Registered: ‎07-22-2003
Message 2 of 5 (199 Views)

Re: PaletteSet, use Keyboard when Editor has focus

08-22-2013 12:06 PM in reply to: Jeff_M

Well, I've adapted some HotKey code from HERE that almost works. It was written for a Form whereas my form is actually a UserControl on a PaletteSet. So even though the HotKey is defined, I used CTRL + S since I want to save something, when run that key combination does nothing (normally this would bring up the Save Drawing dialog). I think that this is due to the Palette vs Form and I cannot see how to get the WndProc event to fire with the PaletteSet.

 

I will put together a small sample project, hopefully someone can lend a hand.

Jeff_M, also a frequent Swamper
Distinguished Mentor
BlackBox_
Posts: 785
Registered: ‎02-25-2013
Message 3 of 5 (185 Views)

Re: PaletteSet, use Keyboard when Editor has focus

08-23-2013 09:49 AM in reply to: Jeff_M

FWIW, Jeff - 

 

As I understand it, Civil 3D now 'owns' the Ctrl button for hotkeys, which is why this has never worked for any version of Civil 3D I've used, but will work for vanilla AutoCAD.

 

Cheers



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security


AutoCAD® 2014, and Civil 3D® 2014 Certified Professional ~ Autodesk® Authorized Developer

*Expert Elite*
Jeff_M
Posts: 4,424
Registered: ‎07-22-2003
Message 4 of 5 (174 Views)

Re: PaletteSet, use Keyboard when Editor has focus

08-23-2013 04:49 PM in reply to: BlackBox_

That program works for me in C3D2012, including the CTRL key combination.

Jeff_M, also a frequent Swamper
*Expert Elite*
Jeff_M
Posts: 4,424
Registered: ‎07-22-2003
Message 5 of 5 (149 Views)

Re: PaletteSet, use Keyboard when Editor has focus

08-25-2013 09:48 AM in reply to: Jeff_M

The solution turned out to be simple enough. Instead of using the PaletteSet.Handle to pass to the constructor I used the UserControl.Handle and all works as desired. I posted the sample project to theSwamp's .NET forum.

Jeff_M, also a frequent Swamper
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.