Populating a form from a key delivered from a Popup (OpenInsight Specific)
At 12 OCT 1999 06:02:51PM CT Savell wrote:
Well I never thought about this before, but how can you populate a form with data from a record retrieved with a key delivered from a Popup? I assumed it would automatically happen and was surprised when it didn't.
I have a form with a prompt for entering the key value. If you type in the key, the form is automatically populated with all the data stored in the record. But, if I retrieve the key from a Popup, only the key value is entered into the prompt and none of the corresponding data prompts are populated. I am firing the popup from a button GOTFOCUS event (because I deliver different popups to different prompts),as follows:
declare function get_property, Popup, Set_Property
begin case
case prevfocusid=PRO_ENTRY.PROJECT'This is the record key ans=popup(@WINDOW,
,'PROJECTS') x=Set_Property(PrevFocusId,'TEXT',ans) DO I NEED TO POPULATE ALL THE FIELDS in the form? case prevfocusid=PRO_ENTRY.DEPT' ans=popup(@WINDOW,'','DEPT') x= Set_Property(PrevFocusId,'TEXT',ans) etc. case 1 end case RETURN 0 I hate to think I have to programmatically populate all the data fields on the form. There must be an easier way? Tom </QUOTE> —- === At 12 OCT 1999 07:19PM Don Bakke wrote: === <QUOTE>Tom, Since the Popup is only setting the TEXT property of your key control the window doesn't know one way or another that you want to read the record as well. This is no different than if you entered the key yourself but didn't press the enter key. Also, many people get confused when they do tab out the key control and the window still doesn't read. This is because OI compares two properties of databound controls to see if there has been a change before it fires any relevant events: TEXT and GOTFOCUS_VALUE. Typical Popup results are returned to a control's TEXT property and then the focus is set to this control. Consequently, both properties are now equal to each other (even though technically there was a change) and the system doesn't fire any events like READ. The answer to the second problem is to always set focus to the control before updating its TEXT property. That way the GOTFOCUS_VALUE property will be different from the TEXT property. The answer to the first problem is to issue a Send_Event(@Window, "READ") call right after the key control's TEXT property has been updated with the Popup's returned results. dbakke@srpcs.com SRP Computer Solutions
</QUOTE> —- === At 12 OCT 1999 07:46PM CT Savell wrote: === <QUOTE>Domo Attagato Sensi. I really like the way you answer questions. Thanks Tom </QUOTE> View this thread on the forum...