Getting new data in Edit box (Dialog)

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
nodochau
Pro Scripter
Posts: 131
Joined: Wed Jan 16, 2019 12:59 pm

Getting new data in Edit box (Dialog)

Post by nodochau » Wed Dec 18, 2019 1:47 pm

Hello all,
I am trying to make a dialog with 2 Edit Boxes and set them up as X1 and X2. Then show the dialog and wait until the operator input a new data in Edit box 1 then box 2. There are some problems I need your help:
1. How to create a loop so that it will look at the data in the boxes and if it sees the data is not X1 in box1 and not X2 in box 2 it will do something then set them back to X1 in box 1 and X2 in box 2. Dialog should be always shown on the screen.
2. We are using the digital measurement devices to populate the data into edit boxes (by pressing a button on the device) so how to avoid the operator press TAB key in the key board to move to the box2 after he/she finished populating data in box1. I think this problem should be solved if we can solve the problem 1 :)
I created a dialog with 2 edit boxes and set X1, x2 by setdialogproperty but don't know how to make a loop when the new data is in
I appreciate your help.

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Getting new data in Edit box (Dialog)

Post by Marcus Tettmar » Sat Dec 21, 2019 1:27 pm

Hi,

To do this I would set up an event handler for the text boxes onChange event. No need for a loop, just have your onChange subroutine check for the conditions. For 1 it can compare and if no data is present, set it back, for 2 I would check the length of the text. This assumes the data is always a set length as otherwise I don't know how you'd know that the user has finished entering something. When it reaches that length you can proceed so that there's no need for the user to press tab/enter or whatever.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

nodochau
Pro Scripter
Posts: 131
Joined: Wed Jan 16, 2019 12:59 pm

Re: Getting new data in Edit box (Dialog)

Post by nodochau » Mon Dec 23, 2019 2:07 pm

Hi Marcus,
Thank you for your help. I added a handler method onChange and I understood how it worked. It is very interested. But as soon as the first number is entered then the change is captured at no time. How to let it waits until the completed number is entered?
For Ex: I set Edit box 1 at 501
AddDialogHandler>Dialog1,Edit1,onChange,Data_changed
SRT>Data_changed
if>v1<>501
mdl>Data changed
GetDialogProperty>Dialog1,Edit1,MaxLength,Mlen
mdl>%Mlen%
endif
END>Data_changed
As soon as I type 0 then the mdl is executed. The whole number is 0.2564

nodochau
Pro Scripter
Posts: 131
Joined: Wed Jan 16, 2019 12:59 pm

Re: Getting new data in Edit box (Dialog)

Post by nodochau » Mon Dec 23, 2019 2:32 pm

I got it Marcus :)
Just set time delay for it.
Thanks again. Merry Christmas!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts