S 
		
				
			
		Siliot Mawire
Guest
Here is my code: session
ATA-ENTRY-RETURN = TRUE. DEFINE QUERY qry-dbsgr FOR dbsgr scrolling. DEF VAR Current-Record AS ROWID. DEF VAR method-status AS LOGICAL. DEF BROWSE brw-dbsgr QUERY qry-dbsgr     DISPLAY Sgrp  Ctrledger Descrip WIDTH 80     /* ENABLE Sgrp Descrip Ctrledger */     WITH 20 DOWN SEPARATORS. DEF BUTTON btn-Add   LABEL "ADD". DEF BUTTON btn-del   LABEL "DELETE". DEF BUTTON btn-exit  LABEL "CLOSE". DEF BUTTON btn-Edit  LABEL "EDIT". DEF BUTTON btn-close LABEL "CLOSE". DEF BUTTON btn-ok    LABEL "OK". define rectangle rect-1      edge-pixels 2 graphic-edge  no-fill      size 116 by 2.3. define rectangle rect-2      edge-pixels 2 graphic-edge  no-fill      size 116 by 18.5. define frame frm-input     dbsgr.sgrp        colon 30 label "Service Code"     dbsgr.descrip    colon 30 label "Description"     dbsgr.Ctrledger   colon 30 label "Control Ledger"     skip(0.5)     btn-ok colon 5     btn-close colon 60     with view-as dialog-box keep-tab-order no-validate          side-labels no-underline three-d scrollable.     DEF FRAME frm-dbsgr     brw-dbsgr AT ROW 2 COL 5     btn-add AT ROW 20.7 COL 5     Space(20) btn-edit     space(20) btn-del     space(20) btn-exit SKIP(1)     rect-2 AT ROW 1.4 COL 3     rect-1 AT ROW 20 COL 3     WITH 1 DOWN OVERLAY SIDE-LABELS CENTERED THREE-D     ROW 2 SIZE 150 BY 22     TITLE "Services Control Data Capture". ON LEAVE OF dbsgr.sgrp DO:     IF INPUT dbsgr.sgrp <> 0 THEN DO:         FIND FIRST dbsgr WHERE dbsgr.sgrp = INPUT sgrp NO-ERROR.         IF AVAILABLE dbsgr THEN DO:             MESSAGE "Record already exist" VIEW-AS ALERT-BOX.             RETURN NO-APPLY.         END.     END.    END. ON CHOOSE OF btn-Add DO: /* Method-Status = brw-dbsgr:INSERT-ROW("AFTER"). */     view frame frm-input.     clear frame frm-input no-pause.     enable all with frame frm-input.     CREATE dbsgr.     UPDATE Sgrp Descrip Ctrledger WITH FRAME frm-input.     APPLY 'entry' TO dbsgr.sgrp.     WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW FOCUS DBSGR.SGRP. END. on 'choose' of btn-close or     'window-close','esc','f4' of frame frm-input do:     hide frame frm-input no-pause.     view FRAME frm-dbsgr.     OPEN QUERY qry-dbsgr FOR EACH dbsgr NO-LOCK.     ENABLE ALL WITH FRAME Frm-dbsgr.     WAIT-FOR CHOOSE OF btn-Exit OR close of THIS-PROCEDURE. end. /* ON CHOOSE OF btn-ok DO:      CREATE dbsgr.       ASSIGN dbsgr.sgrp = int(sgrp:SCREEN-VALUE)              dbsgr.descrip = STRING(descrip:SCREEN-VALUE)              dbsgr.ctrledger = dec(ctrledger:SCREEN-VALUE).       CLEAR FRAME frm-input NO-PAUSE.     RETURN. END.  */ on 'choose':u of btn-ok do:                do transaction:              create dbsgr.               pause 0.              release dbsgr.              end.              MESSAGE "Yes" VIEW-AS ALERT-BOX.              HIDE FRAME frm-input.                 apply 'close' to frame frm-input.             END.      ON ROW-LEAVE OF BROWSE brw-dbsgr DO:     IF brw-dbsgr:NEW-ROW IN FRAME frm-dbsgr THEN DO:         CREATE dbsgr.         ASSIGN INPUT BROWSE brw-dbsgr Sgrp Descrip Ctrledger.         /*7*/ Method-Status = brw-dbsgr:CREATE-RESULT-LIST-ENTRY().         /*8 DISPLAY Item-Num WITH BROWSE Item-Browse. */     END. END. ON CHOOSE OF btn-Del DO:     GET CURRENT qry-dbsgr EXCLUSIVE-LOCK NO-WAIT.     DELETE dbsgr.     Method-Status = brw-dbsgr
ELETE-SELECTED-ROWS(). END. /********** MAIN LOGIC **********/ OPEN QUERY qry-dbsgr FOR EACH dbsgr NO-LOCK. ENABLE ALL WITH FRAME Frm-dbsgr. WAIT-FOR CHOOSE OF btn-Exit OR close of THIS-PROCEDURE IN FRAME frm-dbsgr. CLOSE QUERY qry-dbsgr. HIDE FRAME frm-dbsgr. Please help. Siliot
Continue reading...
				
			Continue reading...