OpenDCL Forums

OpenDCL => Studio/Dialog Editor => Topic started by: mclisp on July 27, 2016, 09:04:55 AM

Title: Info OnKillFocus
Post by: mclisp on July 27, 2016, 09:04:55 AM
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
Title: Re: Info OnKillFocus
Post by: owenwengerd on July 27, 2016, 09:00:37 PM
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.
Title: Re: Info OnKillFocus
Post by: mclisp on July 27, 2016, 10:54:09 PM
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
Title: Re: Info OnKillFocus
Post by: owenwengerd on July 28, 2016, 04:35:57 PM
I think your question is about UNDO grouping. Hopefully someone else can help.
Title: Re: Info OnKillFocus
Post by: Fred Tomke on August 16, 2016, 05:12:46 AM
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