/* QueryBinding.p
Bind to a Customer query and display the entire table in an Infragistics UltraWinGrid */ /* USING statements must be the first in the procedure. Note that you could have USING statements for the OpenEdge classes also.*/ USING System.Windows.Forms.*. USING Infragistics.Win.UltraWinGrid.*. DEFINE VARIABLE rMainForm AS Progress.Windows.Form NO-UNDO. DEFINE VARIABLE rCustGrid AS UltraGrid NO-UNDO. DEFINE VARIABLE rBindS AS Progress.Data.BindingSource NO-UNDO. DEFINE VARIABLE controls AS Control+ControlCollection NO-UNDO. DEFINE VARIABLE hCustQuery AS HANDLE NO-UNDO. CREATE QUERY hCustQuery.hCustQuery:SET-BUFFERS(BUFFER Customer:HANDLE). hCustQuery:QUERY-PREPARE("PRESELECT EACH Customer"). hCustQuery:QUERY-OPEN. /* This will display all of the Customer fields in the grid. */ rBindS = NEW Progress.Data.BindingSource(hCustQuery). /* Alternately, specify fields using the optional include-fields and except-fields lists. */ /* rBindS = NEW Progress.Data.BindingSource(hCustQuery, "CustNum,Name,Address,City,PostalCode,Phone,Contact,Salesrep",""). */ /* Disable editing because procedure does not include event logic to handle changes. */ rBindS:AllowEdit = FALSE. rBindS:AllowRemove = FALSE. /* Main block */ IF VALID-OBJECT(rBindS) THEN DO ON ERROR UNDO, LEAVE: rMainForm = NEW Progress.Windows.Form(). rMainForm:Width = 840. rMainForm:Height = 500. rMainForm:Text = "Customer Form". rCustGrid = NEW UltraGrid(). rCustGrid:Left = 10. rCustGrid:Top = 10. rCustGrid:Width = 810. rCustGrid:Height = 420. rCustGrid:Name = "CustomerGrid". rCustGrid:Text = "Customer Grid". rCustGrid:DataSource = rBindS. rCustGrid:TabIndex = 1. controls = rMainForm:Controls. controls:Add(rCustGrid). WAIT-FOR Application:RUN(rMainForm). END. /* Main block */ |