Add Event Programatically? (None Specified)
At 16 NOV 1998 06:40:40PM Joel Tesdall wrote:
Does anyone know a way to add an event programatically to a window? I have tried to manipulate the Windows source and object with no success.
At 17 NOV 1998 10:37AM Oystein Reigem wrote:
Joel,
I haven't got a general solution, just suggestions. Perhaps somebody with in-depth knowledge can come up with a general way to do it:
Do you know beforehand where you want your events? Then you can perhaps place some general quick- or user events there already when you design the windows. If you don't know where exactly you can perhaps make some promoted events that cover the places you might possibly want your events.
Perhaps the solution also depends if you want to add events to a window already running. If not you might perhaps add events by making/manipulating the window row yourself, and compile it afterwards (that can be done - I've seen it described on one of the lists).
The next problem would be to get these general events to do exactly what you want. Is it like you want to generate the code at runtime? Somebody recently explained how to do Eval-like things in OI (but I don't remember on which list and I haven't saved a bookmark). I guess you could also write your generated code to SYSPROCS, compile it (I've seen how to do that too, …no wait a minute, that was how to compile windows, not stored procedures…, but probably it can be done) and run it with the Function function.
- Oystein -
At 17 NOV 1998 11:53AM [email protected] - [url=http://www.sprezzatura.com]Sprezzatura, Inc.[/url] wrote:
The answer really depends on the hows, whats, wheres and whens of what you're trying to accomplish.
Just creating the event, then recompiling the event and window will add them. You can add them it the window, if you know the right structure and calling conventions, but it helps if all the repos stuff is in place.
You could also have a generic event there, an omni-event, and just recompile on the fly as needed.
You could have an event that then calls @ProgName, and have the program generated on the fly as well.
A very open-ended question. Clarification might allow us to give you a more specific answer.
At 18 NOV 1998 01:51PM Joel Tesdall wrote:
Thanks Aaron,
More specifically what I want to do:
We have written a routine that will provide us with resolution independance, re-size windows and controls. This routine is called by the SIZE event from a window. If you remember MAPCON and DFM Systems, we have a very large App. We have 200-300 screens already in place for about 60 clients who may or may not have modified the windows themselves.
What I want to do for our next upgrade is give them the resolution independance feature without replacing the window object code for all windows, which potentially will destroy their customizations. It would also save us alot of time adding this feature to our development system programatically instead of using the form designer for all windows and recompiling them.
Hope this is enough info, I greatly appreciate your help. We also have a great God of programming named Aaron.
Thanks
Joel
I have attempted to modify the Window source and object code records programatically to add the size event without success.
At 18 NOV 1998 04:49PM [email protected] - [url=http://www.sprezzatura.com]Sprezzatura, Inc.[/url] wrote:
I don't have a copy of OI handy, so someone else might be able to correct this, but…
All you should need to do is find a window with a size event. Look in the window event properties section of the form for the information. It should be something like SIZE*APPNAME*3*something else. At least that's how it is in the EXE record. Can't remember
what it is in the source record, but it's as easily recognizable.
Best thing is to modify the source then add in a recompile. If you create a few window events for the window (like READ, LOSTFOCUS and ACTIVATED) you'll be able to see exactly where to put it.
If that doesn't help, try looking at the OIWIN_EQUATES record or something like that. It and a few others have some helpfull clues on the structures of the windows, though these might be for compiled windows only.
If this isn't exactly it, post back and I'll get you an exact answer.
At 18 NOV 1998 06:12PM Cameron Purdy wrote:
Joel,
Are you trying to make a promoted event? Or an event for each window?
Cameron Purdy
Revelation Software
At 18 NOV 1998 06:22PM Joel Tesdall wrote:
I need a the Size event for each Window to call a program. I do not know what a promoted event is.
Thank you for any help you can give!
At 21 NOV 1998 09:23AM Donald Bakke wrote:
Joel,
Normal events (the kind we access via the Form Designer) are control specific events. For example, if you create a READ event for Window A, then that event is specific to Window A only and not available to Window B. Using this method, you would need to create an event for every window in your application.
Promoted events are such that they be applied generically throughout your application. For instance, you can create a single promoted SIZE event and it will apply to every window in your application without the need to create multiple events for each window. Using promoted events you can create an event for every window in the application, every control in the application, every type of a specific control (e.g. editlines) in the application, or even any of the above for ALL applications! The secret is understanding the naming convention that has to be given to these events.
Creating promoted events seems to be a black art with regards to normal documentation but the best resource I've seen for this is in SENL Volume 1 Issue 7. If I formatted this correctly you should be able to download directly from this link.
After reading this let us know if you have any questions. It sounds to me like this approach will accomplish what you want with minimal effort.