I am reviewing a lot of old code and looking at ways to make it more modular etc. One way will be using promoted events. Some exist and need some cleaning and new ones need to be created.
For example, there is a got/lost focus event on almost every control .. traping bg color and changing in on focus. This is true in most every window. But is it better form to create a "WINDOW" level PE instead of a "EVENT" level PE. it would seem to me that a Window level pe would better.
Also, in the PE_COMMUTER is there a preferred standard on the calling params? ie PE_COMMUTER(EVENT,CTLRENTID,CTRLCLASSID,PARAM1…. or the ctrlentid first?
I know i am being anal but want to be sure that just about anyone could pick this up and run with it.
I forgot to ask .. if creating a window level PE, does it make sense to use the windows commuter module for code or do you use a seperate PE_COMMUTER module? It seems to me that the window commuter module would be better as it then encapsulates all the event code for the form. But what do you think. If you use the windows commuter module then do you change the name of the event .. say pegotfocus .. you might have a quick event handling other event process say
Hi Dave,
If you're creating an event that only applies to controls on that window then it should be at the WINDOW level (though I've never had a reason to do this ;)
e.g.
MYAPP*GOTFOCUS*MYWIN
However, your example appears to suggest that this is a feature that is global to your application in which case it should be EVENT specific?
e.g.
MYAPP*GOTFOCUS..OIWIN*
One pitfall to beware of in PE handlers is coding for specific controls/windows - this leads to a maintenance nightmare if you're not careful. It's not so bad in WINDOW level handlers because they are related to a specific window, but for a global handler it's not such a good idea. It's better to set some sort of flag on a control (e.g. with an '@'property) and look for that instead when you need to allow for different behavior.
Also, in the PE_COMMUTER is there a preferred standard on the calling params? ie PE_COMMUTER(EVENT,CTLRENTID,CTRLCLASSID,PARAM1…. or the ctrlentid first?
I use (ctrlEntID, event, p1…. etc), i.e. putting the control first which is the way most commuter module code I've seen does it. I wouldn't mix the the two styles. Having said that the Sprezz PE layer was written before Rev put any PE/Commuter module tools in OI so it's not based on what's there now :)
cpates@sprezzatura.com
Battlestar Sprezzatura - BSG 77
Colonial leaders in all things RevSoft
I'd have the PE handler call the window commuter module with a modified name.
cpates@sprezzatura.com
Battlestar Sprezzatura - BSG 77
Colonial leaders in all things RevSoft
If 'MYAPP*GOTFOCUS*MYWIN' is a window specific (all controls) PE for gotfocus event .. why would 'MYAPP*GOTFOCUS..OIWIN*' be for all windows (all controls). I get the OIWIN being for all windows but what are the '..' for in the name. would it make more sense if it was 'MYAPP*GOTFOCUS*OIWIN'. Just asking …
Also, it sounds like you make PE for 'global' events .. ex GOTFOCUS for all windows all controls (MYAPP*GOTFOCUS..OIWIN*). In this case you wouldn't try to use a windows commuter module but would use a PE_GOTFOCUS commuter module. Yes …
Becoming clear as mud but starting to remember this stuff. Been away way too long
Hi Dave,
If 'MYAPP*GOTFOCUS*MYWIN' is a window specific (all controls) PE for gotfocus event .. why would 'MYAPP*GOTFOCUS..OIWIN*' be for all windows (all controls). I get the OIWIN being for all windows but what are the '..' for in the name. would it make more sense if it was 'MYAPP*GOTFOCUS*OIWIN'. Just asking …
Actually - no idea - this was all written by the original OI 2.0 team way back when … but as a guess - what would happen if you created a window called "OIWIN"? I suspect the ".." and "*" characters are so that it doesn't get applied to a single window as they are illegal in window IDs.
Also, it sounds like you make PE for 'global' events .. ex GOTFOCUS for all windows all controls (MYAPP*GOTFOCUS..OIWIN*). In this case you wouldn't try to use a windows commuter module but would use a PE_GOTFOCUS commuter module. Yes …
Yes.
Becoming clear as mud but starting to remember this stuff. Been away way too long
I agree - you have :) If it helps here's a good starting point with promoted events - Read the "X-Events" on page 16 …
cpates@sprezzatura.com
Battlestar Sprezzatura - BSG 77
Colonial leaders in all things RevSoft
I did read that and Don's at srpcs .. the problem is when i read something my brain always say "why?" or "would this work" and then i a start asking questions. It was easier when I worked at the lab and could go in and ask Brie or MikeI about stuff
Thanks for hanging in there