Info OnKillFocus

Started by mclisp, July 27, 2016, 09:04:55 AM

Previous topic - Next topic

mclisp

Hello
I ask a question for you, probably trivial, but I have little experience.
I have a form Modeless Dialogs with many textbox where switches on the numbers, I manage as follows:
(Defun c: ... / Form1 / TextBox3 # OnKillFocus (/)
OnKillFocus is the best event to use?
I ask this because when I go in texbox continues to maintain focus and repeats continuously when I move the mouse function.
I also tried
(Defun c: ...... / Form1 / TextBox3 # OnEditChanged (NewValue /)
but even this does not seem good, if I insert 512 is run 3 times.
Someone could give examples or explain what is the standard to be used TexBox?
thank you

owenwengerd

Those two events are commonly used. If you don't want to be notified on every change, then KillFocus is appropriate. From your description, I don't understand what the problem is with KillFocus and mouse moves. The event should only fire when the text box loses input focus, but you need to be careful that your handler doesn't interfere with the focus change.
Owen Wengerd (Outside The Box) / ManuSoft

mclisp

Thanks for the reply.
As you can see from the video https://youtu.be/QN1PVexanVE
I open a drawing
Create the first 5 items (1st cycle)
I replace the No. 50 with 55 (2nd cycle)
replace 55 with 30 (3rd cycle)
Total 3 cycles
Actually if use the command cancels
the cycles are 10.

Maybe ended the cycle I have to put the focus elsewhere?
it's possible? If it is possible ask how.
I apologize for my bad english
Thank you

Thanks

owenwengerd

I think your question is about UNDO grouping. Hopefully someone else can help.
Owen Wengerd (Outside The Box) / ManuSoft

Fred Tomke

Hi,

Owen is right: group the undo markers. Because OnKillFocus is also called when you switch between form and drawing without changing anything!
You can set a global variable in the OnEditChanged event to allow "redrawing" within OnKillFocus and reset the variable in the OnKillFocus event. So the entities will only be updated after modifying values.

Code (autolisp) Select

(defun c:proj/form/edtSize#OnEditChanged (strNewValue) (setq ***ValuesModified*** T))

(defun c:proj/form/edtSize#OnKillFocus ()
  (if ***ValuesModified*** (update_model))
  (setq ***ValuesModified*** nil)
); c:proj/form/edtSize#OnKillFocus


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

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