Hi,
We have a promoted GOTFOCUS event that gets the ORIG_STRUCT property of a control. For example:
Events=Get_Property(CtrlEntId, "ORIG_STRUCT")
We then check to see if OPTIONS exists as one of the events in this control. If so, we enable a button on our toolbar that the end user can click on to activate this event. This works well for us.
Now I'm trying to be clever (maybe a little too clever) and create a User Defined Conversion replacement for . What I want to do is first see if the row exists in the target table and if not, see if an OPTIONS event exists. If one does exists, then the UDC will ask the user if they want to view the available options and proceed to call this event if they do.
My problem is that the above ORIG_STRUCT property returns different results than my promoted event. In the promoted event the results (as seen in the debugger) look like this:
: OPTIONS*2*SYSPROG*OPTIONS..OIWIN*
: GOTFOCUS*3*EPSISIBS*GOTFOCUS..OIWIN*
: LOSTFOCUS*4*EPSISIBS*LOSTFOCUS..OIWIN*
But in my UDC I get this:
: GOTFOCUS*3*EPSISIBS*GOTFOCUS..OIWIN*
: LOSTFOCUS*4*EPSISIBS*LOSTFOCUS..OIWIN*
Why is this happening? Is there another approach? Am I just trying to make a UDC perform some very non-standard operations?
Thanks,
dbakke@srpcs.com
Don,
It looks like your CtrlEntId is different in those two cases. In the case with promoted event it is passed on you, but how do you get it in the case of UDC?
Gene
Hi Gene,
…but how do you get it in the case of UDC?
Good question. We just perform the following logic in the UDC:
Focus=Get_Property(@Window, "FOCUS")
Events=Get_Property(Focus, "ORIG_STRUCT")
When we debug this we always get the correct CtrlEntId but a slightly different ORIG_STRUCT property result.
Thanks,
dbakke@srpcs.com
Don,
The logic in Get_Property(…, "ORIG_STRUCT") is so straightforward that I cannot see how the result could be different. There must be something very simple that messes it up… Could you retrieve the entire ORIG_STRUCT property (not just field 21), save it to SYSLISTS and e-mail those two records to me?
Gene
Hi Gene,
Well your instincts were right and I should have looked a little closer. Since the UDC is getting the FOCUS property of @WINDOW, the actual focus has already shifted to the next control in the tab order. I didn't catch this because the name of the control is very similar to the one that I am validating. We added a user defined property, @PREV_FOCUS, and that has fixed our problem.
Thanks Gene for helping me isolate this.
dbakke@srpcs.com