OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: VovKa on December 20, 2011, 09:03:56 AM

Title: unexpected OnKillFocus event inside grid
Post by: VovKa on December 20, 2011, 09:03:56 AM
the attached files are slightly modified versions of sample files
i've switched on OnKillFocus event and  added
Code (autolisp) Select
(defun c:Grid_Dcl-1_grid1_OnKillFocus (/) (princ "OnKillFocus ") (princ))
OnKillFocus triggers whenever you try to edit grid cells with "drop-down capability" (type 18, 36, 37...), in this example rows 4-5-6-7
Title: Re: unexpected OnKillFocus event inside grid
Post by: owenwengerd on December 20, 2011, 09:41:37 AM
I didn't look at your code, but I would expect the grid control to lose focus when the dropdown control gains focus.
Title: Re: unexpected OnKillFocus event inside grid
Post by: VovKa on December 20, 2011, 12:48:20 PM
dropdown (or combo strings) control being a cell is a part of a grid.
why should the grid lose focus then?

ps the code attached to the first post is not mine it's a sample from opendcl package.
Title: Re: unexpected OnKillFocus event inside grid
Post by: Fred Tomke on December 20, 2011, 11:59:19 PM
Hi, VovKa,

the grid looses the control because any control that is shown when a cell is going to be edited is an other control but not the grid itself.

Regards, Fred
Title: Re: unexpected OnKillFocus event inside grid
Post by: Fred Tomke on December 21, 2011, 12:04:53 AM
You can embed the code which shall be executed in the KillFocus event from the GridEditState. Just catch the OnStartCellEdit event and set a variable to T (for example) and set it to nil during OnEndCellEdit. Within OnKillFocus you can ask the state of the variable. That's all.

Regards, Fred
Title: Re: unexpected OnKillFocus event inside grid
Post by: VovKa on December 21, 2011, 08:06:35 AM
i just thought it was a bug
now i understand
thank you Fred