Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Adding Popup Functionality to a Window ====== The most common use of a Popup is to provide users with a list of choices during data entry. The following procedure will demonstrate how to add a button to an existing form and the Event Handler necessary to execute the Popup and place the results within a data field. 1. Open the CUSTOMERS form and it will load in the Form Designer. 2. Select //Open//, //OpenInsight Forms// from the OpenInsight IDE. Choose the CUSTOMERS form. 3. From the Common Controls tool panel on the left side of the Form Designer select the Push Button control and drag it on to the form. {{MV_111.jpg}} 4. Place the control on the form by moving the mouse cursor to a location on the form where you want to place the control. The mouse cursor changes to the control’s icon with a + appearing to the left and above the icon as soon as the mouse cursor enters the form. The + is used to help position the control. Click the left mouse button where you want to place the control. The control is displayed in the form in the selected state (with handles visible). {{MV_112.jpg?1024x606}} 5. Click on the button. The Push Button Properties window will appear in the Property Panel on the right side of the form. Change the //Name// of the control to “BTN_CHOOSE_CUSTOMER” and the //Text// that is displayed on the control to “Choose Customer”. {{MV_113.jpg?1024x606}} 6. Click on the //Events// Tab on the Property Panel to display the QuickEvent dialog box. Under Action, Click, open the properties for the Click Event. {{MV_114.jpg?1024x606}} 7. The CLICK event will be chosen by default. 8. Click on the Event//Script// check box. This will launch the Event Editor. In the Editor type the following code:\\ \\ declare subroutine Set_Property, Send_Event\\ declare function Popup\\ \\ retval = Popup(@window,"","CUSTOMERS")\\ Set_Property(@window:".EF_CUSTOMERID",”DEFPROP”,retval)\\ Send_Event(@window:".EF_CUSTOMERID","LOSTFOCUS") 9. Select //File, Compile// from the OpenInsight IDE. Any errors will be displayed in the Output Panel at the bottom of the OpenInsight IDE. If the syntax is correct the status line will display “The syntax is correct”. {{MV_115.jpg?1024x589}} This will cause a popup to display when the Choose Customers button is clicked. The user may choose a Customer. The value chosen will be placed into the EF_CUSTOMERID control on the Customers form. When the EF_CUSTOMERID field loses focus a read of the CUSTOMERID placed into the field will occur. 10. Select //File, Save// from the OpenInsight IDE. This will save the code. Click the View Form button on the Toolbar to return to the form. {{MV_116.jpg}} 11. Choose //File, Save// to save the form. 12. Test run the form and click the Choose Customer button to launch the popup. Select a record, click OK and the record will be read and loaded into the form. {{MV_117.jpg?1024x312}} guides/bfs/mv/adding_popup_functionality_to_a_window.txt Last modified: 2023/10/25 10:49by 127.0.0.1