.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to force Command Line Focus

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
1667 Views, 4 Replies

How to force Command Line Focus

Hi,

 

How does one programmatically set the command line to have keyboard focus?

 

I'm programmatically setting an active/focused PaletteSet's visibility to false.

 

_paletteSet.Visible = false;

 

I would like to follow this line with code that sets the command line to receive focus.

 

The PaletteSet for other reasons has KeepFocus = true.

 

Thanks!

 

I've tried various Win32 APIs (SwitchToThisWindow, SetForegroundWindow, SetActiveWindow) to no avail.  I also tried SendCommand() and SendStringToExecute(activate=true,..) , etc.

 

I imagine there's a way to do this with the native APIs.

 

Any ideas?  THANKS

4 REPLIES 4
Message 2 of 5
fieldguy
in reply to: Anonymous

Try this.

 

Autodesk.AutoCAD.Internal.Utils.PostCommandPrompt()

Message 3 of 5
Anonymous
in reply to: fieldguy

Thanks...but the command-line still isn't getting the focus.

Message 4 of 5
fieldguy
in reply to: Anonymous

Can you set keepfocus to false before visble = false?  When you show the palette again, set keepfocus to true. 

 

I don't understand why you would keep focus on a palette that is not visible. 

 

Can you post some code we can try?    

Message 5 of 5
joantopo
in reply to: fieldguy

I do this:

 

   Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView();

 

Paletteset lose focus and you can write in command line.

 

 

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta