BBj grid tutorial problems
Side note: I couldn't find tags for BASIS or the BBj language, so I didn't know what to tag. Hopefully someone can help with that.
Trying to learn BBj using the Grid Tutorial located here. Unfortunately however the code that I've copied from the website doesn't seem to work. I'm getting an error code !error=27 indicating that there is an invalid Return/Retry/Next... on a specific line. Error code from BASIS documentation here. The error in the code is indicated by a bunch of dashes.
The code:
REM Open SYSGUI Channel and Window
LET SYSGUI=UNT
OPEN (SYSGUI)"X0"
REM create window with event loop for check event
PRINT (SYSGUI)'WINDOW'(100,100,600,300,"Grid Tutorial 2",$$,$02000000$)
REM SET_CASE_SENSITIVITY_ON not really needed for this tutorial but it helps
REM make the method names more readable
SET_CASE_SENSITIVE_ON
REM Get Window and SysGui Objects
LET BBJ! = BBjAPI()
LET SYSGUI! = BBJ!.getSysGui()
LET WINDOW! = SYSGUI!.getWindow(0)
REM Set true/false constants
LET TRUE=1
LET FALSE=0
REM Initialize variables
LET GRID=100
LET COLID=101
LET ROWID=102
LET NUMROW=7
LET NUMCOL=9
LET CONTEXT = 0
LET EDITABLE=TRUE; REM option to set grid editable
PRINT (SYSGUI)'TEXT'(97,10,5,150,25,"Weather Forecast",$$)
PRINT (SYSGUI)'FONT'(97,"",12,DEC($01$))
PRINT (SYSGUI)'TEXT'(98,160,10,200,25,"Temperature in Degrees Fahrenheit",$$)
REM Display a checkbox to allow Grid editing to be toggled
LET CHECK_FLAGS$=$$
IF EDITABLE THEN
LET CHECK_FLAGS$=$04$
FI
PRINT (SYSGUI)'CHECKBOX'(99,450,5,100,25,"Grid Editable",CHECK_FLAGS$)
REM Create grid using Object Syntax
LET GRID!=WINDOW!.addGrid(GRID,20,30,544,230,$8856$,NUMROW,NUMCOL)
GRID!.setFitToGrid(TRUE)
REM Set some properties on the grid
GRID!.setRowHeaderWidth(100)
REM Set header titles using setColumnHeaderCellText()
REM First create a BBjVector and add header strings to it
LET VECTOR!=SYSGUI!.makeVector()
VECTOR!.add("8 AM")
VECTOR!.add("9 AM")
VECTOR!.add("10 AM")
VECTOR!.add("11 AM")
VECTOR!.add("12 PM")
VECTOR!.add("1 PM")
VECTOR!.add("2 PM")
VECTOR!.add("3 PM")
VECTOR!.add("Rain")
GRID!.setColumnHeaderText(VECTOR!)
VECTOR!.clear()
VECTOR!.add("Sunday")
VECTOR!.add("Monday")
VECTOR!.add("Tuesday")
VECTOR!.add("Wednesday")
VECTOR!.add("Thursday")
VECTOR!.add("Friday")
VECTOR!.add("Saturday")
GRID!.setRowHeaderText(VECTOR!)
REM set style of last column to checkbox
GRID!.setColumnStyle(NUMCOL-1,8)
REM set the style of a couple checkboxes to checked
GRID!.setCellStyle(1,NUMCOL-1,4)
GRID!.setCellStyle(4,NUMCOL-1,4)
REM set column colors
FOR COL=0 TO NUMCOL-1
IF COL<3 THEN
LET COLOR!=SYSGUI!.makeColor("green")
ELSE
IF COL<6 THEN
LET COLOR!=SYSGUI!.makeColor("yellow")
ELSE
IF COL<8 THEN
LET COLOR!=SYSGUI!.makeColor(255,50,50)
ELSE
LET COLOR!=SYSGUI!.makeColor("blue")
FI
FI
FI
GRID!.setColumnBackColor(COL,COLOR!)
NEXT COL
REM Set text in cells using setCellText(BBjVector)
REM First load the vector. Cells are loaded in rows starting from
REM row 0, column 0 for as many strings are in the BBjVector
VECTOR!.clear()
FOR ROW=0 TO NUMROW-1
FOR COL=0 TO NUMCOL-1
Side note: I couldn't find tags for BASIS or the BBj language, so I didn't know what to tag. Hopefully someone can help with that.
Trying to learn BBj using the Grid Tutorial located here. Unfortunately however the code that I've copied from the website doesn't seem to work. I'm getting an error code !error=27 indicating that there is an invalid Return/Retry/Next... on a specific line. Error code from BASIS documentation here. The error in the code is indicated by a bunch of dashes.
The code:
REM Open SYSGUI Channel and Window
LET SYSGUI=UNT
OPEN (SYSGUI)"X0"
REM create window with event loop for check event
PRINT (SYSGUI)'WINDOW'(100,100,600,300,"Grid Tutorial 2",$$,$02000000$)
REM SET_CASE_SENSITIVITY_ON not really needed for this tutorial but it helps
REM make the method names more readable
SET_CASE_SENSITIVE_ON
REM Get Window and SysGui Objects
LET BBJ! = BBjAPI()
LET SYSGUI! = BBJ!.getSysGui()
LET WINDOW! = SYSGUI!.getWindow(0)
REM Set true/false constants
LET TRUE=1
LET FALSE=0
REM Initialize variables
LET GRID=100
LET COLID=101
LET ROWID=102
LET NUMROW=7
LET NUMCOL=9
LET CONTEXT = 0
LET EDITABLE=TRUE; REM option to set grid editable
PRINT (SYSGUI)'TEXT'(97,10,5,150,25,"Weather Forecast",$$)
PRINT (SYSGUI)'FONT'(97,"",12,DEC($01$))
PRINT (SYSGUI)'TEXT'(98,160,10,200,25,"Temperature in Degrees Fahrenheit",$$)
REM Display a checkbox to allow Grid editing to be toggled
LET CHECK_FLAGS$=$$
IF EDITABLE THEN
LET CHECK_FLAGS$=$04$
FI
PRINT (SYSGUI)'CHECKBOX'(99,450,5,100,25,"Grid Editable",CHECK_FLAGS$)
REM Create grid using Object Syntax
LET GRID!=WINDOW!.addGrid(GRID,20,30,544,230,$8856$,NUMROW,NUMCOL)
GRID!.setFitToGrid(TRUE)
REM Set some properties on the grid
GRID!.setRowHeaderWidth(100)
REM Set header titles using setColumnHeaderCellText()
REM First create a BBjVector and add header strings to it
LET VECTOR!=SYSGUI!.makeVector()
VECTOR!.add("8 AM")
VECTOR!.add("9 AM")
VECTOR!.add("10 AM")
VECTOR!.add("11 AM")
VECTOR!.add("12 PM")
VECTOR!.add("1 PM")
VECTOR!.add("2 PM")
VECTOR!.add("3 PM")
VECTOR!.add("Rain")
GRID!.setColumnHeaderText(VECTOR!)
VECTOR!.clear()
VECTOR!.add("Sunday")
VECTOR!.add("Monday")
VECTOR!.add("Tuesday")
VECTOR!.add("Wednesday")
VECTOR!.add("Thursday")
VECTOR!.add("Friday")
VECTOR!.add("Saturday")
GRID!.setRowHeaderText(VECTOR!)
REM set style of last column to checkbox
GRID!.setColumnStyle(NUMCOL-1,8)
REM set the style of a couple checkboxes to checked
GRID!.setCellStyle(1,NUMCOL-1,4)
GRID!.setCellStyle(4,NUMCOL-1,4)
REM set column colors
FOR COL=0 TO NUMCOL-1
IF COL<3 THEN
LET COLOR!=SYSGUI!.makeColor("green")
ELSE
IF COL<6 THEN
LET COLOR!=SYSGUI!.makeColor("yellow")
ELSE
IF COL<8 THEN
LET COLOR!=SYSGUI!.makeColor(255,50,50)
ELSE
LET COLOR!=SYSGUI!.makeColor("blue")
FI
FI
FI
GRID!.setColumnBackColor(COL,COLOR!)
NEXT COL
REM Set text in cells using setCellText(BBjVector)
REM First load the vector. Cells are loaded in rows starting from
REM row 0, column 0 for as many strings are in the BBjVector
VECTOR!.clear()
FOR ROW=0 TO NUMROW-1
FOR COL=0 TO NUMCOL-1
No comments:
Post a Comment