Stack Overflow w/Send_Event to LostFocus (OpenInsight Specific)
At 07 SEP 2000 02:45:37AM [email protected] wrote:
To all,
This should be simple, but I am encountering a couple of problems. I want to leave an EditTable programmatically when the value of "NONE" is entered in Column 1 of the EditTable. There are three columns: 1) Location; 2) Area Code; and 3) Phone.
My code to exit is shown below. It is called from POSCHANGED of the EditTable (PHONE_ET):
* pCol=Column 1 and determined earlier
if pCol eq 1 Then
If Data Ne "NONE" thenNullEnd Else
Entered "NONE"
leave EditTable for Next Prompt[b]NextPrompt=Get_Property(CtrlEntId,'NEXT')[/b]
NextPrompt= 'PAT_REG.EMAIL'Set_Property('SYSTEM','FOCUS',NextPrompt)
let's try these linesxx=Send_Event(NextPrompt,"GOTFOCUS")[b]xx=Send_Event(CtrlEntId,"LOSTFOCUS"[/b]EndEnd
* End of Code *
I am encountering these two problems:
1) The Get_Property(CtrlEntId,'NEXT') is returning an invalid value for NextPrompt. That is, it is returning a val=PUB_EDT. I don't have such a control in my form. Honest, I've looked and looked. I have also checked my Tab Order. The Next control should be "EMAIL".
Does anyone have any ideas why the correct "NEXT" control is not being returned? and where this bogus control name is coming from?
2) To leave the EditTable, I had to add this line:
xx=Send_Event(CtrlEntId,"LOSTFOCUS")However, when I do, it cause a Stack Overflow, but it will let me leave the EditTable. I can see that the cursor is now on column 2, but it looks like it's flickering. I guess that's what will cause the overflow. If I take out the Send_Event "lostfocus", I don't get the stack overflow problem, but the cursor stays in the EditTable. Am I happy or am I sad?
Any wild ideas or kind explanation would be appreciated.
Thanks. I will also post this on the otherside.
[email protected] onmouseover=window.status=imagine … ;return(true)"
Ray Chan ~ Symmetry Info
At 07 SEP 2000 03:48AM Simon wrote:
Ray,
I am not sure why the Next is returning the incorrect column (have you tried editting the WinExe in System editor to check for the Pub_Edt control ??), but I would recommend replacing the Send_Event to Gotfocus with a Post_Event.
Simon Wilmot
Rebus Software
At 07 SEP 2000 08:52AM Don Bakke wrote:
Ray,
I definitely know the answer to #1 and I think I know the answer to #2. Here goes nothing :
1) You do have a control called PUB_EDT. This is your drop down button that is created with the Create_Cell_Button routine.
2) I believe the Stack Overslow is happening because you are creating an infinite looping with your code. Sending a LOSTFOCUS event to the edittable effectively calls the POSCHANGED event which calls the LOSTFOCUS event again and so on. I don't understand the need to use Sent_Event in your code since the LOSTFOCUS/GOTFOCUS events should fire on their own anyway based on the way you are changing the FOCUS.
At 07 SEP 2000 09:16AM X wrote:
If you get Overslow it's time for another cup of coffee.
At 07 SEP 2000 01:22PM [email protected] wrote:
Don and Simon,
Thanks for your response. Bottomline, I fixed this situation.
1)Problem #1: Bogus Control (PUB_EDT see Don's comment). To work around this, I just issued another Get_Property for "Next". That is:
NextPrompt=Get_Property(CtrlEntId,'NEXT')
NextPrompt=Get_Property(NextPrompt,'NEXT')
2)Problem #2: Convoluted, extraneous Send_Event statement needed to Lose focus, but caused Stack OverFlow. Well I finally debugged the culprit. I also have a POSCHANGED in my Promoted Event which "interfered" with my intent . After I discovered this, my simple solution was to assigned a value of "0" to the return code in the POSCHANGED event when the user entered "NONE".
Now the code is straightforward (as you would expect) and no Stack Overflow!!
Thanks for your help.
[email protected] onmouseover=window.status=imagine … ;return(true)"
Ray Chan ~ Symmetry Info