Property KeepFocus in modeless forms, palettes and dockable forms

Started by Fred Tomke, December 15, 2009, 04:20:57 PM

Previous topic - Next topic

Fred Tomke

Question:
If I set the property KeepFocus of a palette to T I can write text into my textbox, but autocollapsing the palette after moving the mouse off the form does not work.
If I set the property KeepFocus of a palette to nil I cannot write text into my textbox (it will be written at commandline as it is written in the help), but autocollapsing the palette works properly after moving the mouse off the form.
Is it not possible to have both?

Answer:
You can change the property value for KeepFocus in two additional events of the form. In the OnMouseEntered event you activate the KeepFocus property. In the OnMouseOff event you disable it.

Code (autolisp) Select

(defun c:MyProj_MyForm_OnMouseEntered ()
  (dcl_Control_SetKeepFocus MyProj_MyForm T)
); c:MyProj_MyForm_OnMouseEntered

(defun c:MyProj_MyForm_OnMouseOff ()
  (dcl_Control_SetKeepFocus MyProj_MyForm nil)
); c:MyProj_MyForm_OnMouseOff


A sample was published here.

Note: it will cause many calls from the form.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]