Author Topic: Property KeepFocus in modeless forms, palettes and dockable forms  (Read 5669 times)

Fred Tomke

  • OpenDCL Technician
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2062
  • [ Mr. Bad Guy ]
    • Kommunale Entwicklungsplanung auf digitaler Basis - digital landscape and urban design
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]