OpenDCL Forums

OpenDCL => FAQs => Topic started by: Fred Tomke on December 15, 2009, 04:20:57 PM

Title: Property KeepFocus in modeless forms, palettes and dockable forms
Post by: Fred Tomke on December 15, 2009, 04:20:57 PM
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 (http://www.opendcl.com/HelpFiles/index.php?page=Reference/Property/KeepFocus.htm)), 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 (http://www.opendcl.com/forum/index.php?topic=1064.msg5559#msg5559).

Note: it will cause many calls from the form.

Fred