[futurebasic] re [FB] renumberEF.solved

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 1999 : Group Archive : Group : All Groups

From: SVANVOORST@...
Date: Wed, 15 Sep 1999 19:44:09 EDT
The following code will delete edit fields and renumber them.  Thanks to 
Alain for his help.

COMPILE 0, _caseInsensitive

LOCAL FN renumEF(closeID)
  fieldHndl& = [WNDBLK + WINDOW(WINDOW(_activeWnd))*16 + 4]
  WHILE fieldHndl&
    efNum = {[fieldHndl&]+4}
    LONG IF efNum > closeID 
      %[fieldHndl&]+4,efNum-1
      efNum = {[fieldHndl&]+4}
    END IF
    EDIT$(efNum) = STR$(efNum)
    fieldHndl& = [[fieldHndl&]]
  WEND
END FN

LOCAL FN buildWnd
  WINDOW#1,"renumberEF",(30,40)-(330,330),_docNoGrow
  PRINT%(30,25)"Select EF then delete with ShiftTab."
  FOR x = 1 TO 10
    tmp$ = STR$(x)
    EDIT FIELD#x,tmp$,(100,20*x+20)-(180,20*x+35),_framed,_centerJust
  NEXT
  EDIT FIELD(0)
END FN

LOCAL FN doDialog
  evnt=DIALOG(0)
  id=DIALOG(evnt)
  SELECT evnt
    CASE _efShiftTab
      SELECT id
          EDIT FIELD CLOSE(id)
          FN renumEF(id)
      END SELECT
    CASE _wndClose
      END
  END SELECT
END FN

FN buildWnd
ON DIALOG FN doDialog
DO
  HANDLEEVENTS
UNTIL 0

Steve Van Voorst