PDA

View Full Version : Adding same line to OnKey on 250 forms at once ...


ABC123

drgarytraub
02-10-2005, 05:47 PM
How can this be done: I would like to enter just one line to the OnKey event of over 250 forms. Can this be done with Xbasic?

Any help would be appreciated ...

Gary

Tom Cone Jr
02-11-2005, 04:08 AM
Gary, I'm sorry to say I don't have a good answer for you.

However, if I were tackling this, and if the scripts were identical in many of these forms, I'd write a single global script, store it in the Code page of the Control Panel, and then play it in each form's OnKey event. Since you have to edit each script by hand now doing it the way I suggest would:

a) make it possible later on to edit just one script to make another change throughout these forms; and

b) make the edits easy. You'd select the existing script's text, delete it, and then paste a one line script that plays the global script. Very few key strokes required, if you see what I mean.

Good luck.

-- tom

Alan Sawyer
02-11-2005, 04:51 AM
Gary, on www.learnalpha.com website there is a utility that's titled
"Ron's Improved Form Update Utility"
I don't think it does exactly what you're looking for, but it might give you an idea or two.
Good Luck,
Alan

drgarytraub
02-11-2005, 04:58 AM
Hi Tom,

That is exactly what I was forced to do. I was just wondering if there were an easier way. Thanks for your thoughts.

drgarytraub
02-11-2005, 04:59 AM
Thanks, I'll look into that.

Gary

Jim Chapman
02-11-2005, 12:59 PM
Hello Gary,

Is the onKey event code the same for all 250 forms?

I have not done exactly what you are wanting to do but I think it can be done without a lot of work via Xbasic.

You can, via xbasic, put a form into design mode, then while in design mode you should be able to set the onkey event code to what you want then save the form. Using an enumerate command you should be able to interate through all your forms and make the modification. You will need to use the a5.command() syntax to do this. I am not at my system right now so I can't tell you the exact syntax. Try this out in the interactive window, open a form in design mode, then set the interactive window to the form:

?parentform.code.onkey

You can now set the onkey code via xbasic as well. Just need the command syntax to open, save and close the form as you interate through them.

Good luck,
Jim

CALocklin
02-11-2005, 01:05 PM
I've been thinking of doing something like this. I already have a routine that goes through every script in every layout and adds/deletes passwords so I can probably use that as a starting point. (I also have one that does the same for global scripts/functions.) However, these things take me a lot of time to build and to get finessed enough for general distribution so it probably won't be free but will be in the same range as my other utilities - ~$20. Not free but a bargain when you consider the time savings involved. If there's any interest I will put it on my list of things to do.

Cal Locklin
www.aimsdc.net

CALocklin
02-11-2005, 01:09 PM
Yes, that's basically all you need to do. I was thinking of added the ability to select other events, layout types, etc. if I were to build a generic routine for adding standard scripts to layout events.

drgarytraub
02-11-2005, 01:43 PM
Hi Jim,

Sounds rather complicated, but sounds like it can be done.

And, Cal, are you kidding, for 20 something bucks, that would be an awesome utility!

Gary