Listing 1

instance variables
long il_x, il_y


STRING ls_create

il_x = xpos
il_y = ypos
idw.modify('destroy size_rect')
ls_create = ' create rectangle(band=foreground x="'+STRING(xpos)
+'" y="'+ STRING(ypos) +'" height="1" width="1"
name=size_rect visible="1" moveable=1 brush.hatch="7"
brush.color="553648127" pen.style="3" pen.width="1"
pen.color="8388608" background.mode="2" background.color="0")'
idw.modify(ls_Create)

Listing 2

long ll_width, ll_height, ll_x, ll_y

If flags = 1 THEN
ll_width = ABS(xpos - il_x)
ll_height = ABS(ypos - il_y)
IF xpos < il_x THEN
ll_x = il_x - ll_width
ELSE
ll_x = il_x
END IF
IF ypos < il_y THEN
ll_y = il_y - ll_height
ELSE
ll_y = il_y
END IF

idw.modify('size_rect.x='+STRING(ll_x)+' size_rect.y='
+STRING(ll_y)+' size_rect.width='+STRING(ll_width) +' size_rect.height='+STRING(ll_height))
END IF

Listing 3

long ll_x, ll_y, ll_width, ll_height

ll_x = LONG(idw.object.size_rect.x)
ll_y = LONG(idw.object.size_rect.y)
ll_width = il_x + LONG(idw.object.size_rect.width)
ll_height = il_y + LONG(idw.object.size_rect.height)

ids_test.setfilter('x + width >= '+STRING(ll_x)+' AND x
<= '+STRING(ll_width)+' AND y + height >= '+STRING(ll_y)
+' AND y <= '+STRING(ll_height))
ids_test.filter().

Listing 4

instance variables
long il_id_array[]

string ls_create
long ll_rows, ll_row

ll_rows = ids_test.rowcount()

IF ll_rows > 0 THEN
FOR ll_row = 1 TO ll_rows
il_id_array[ll_row] = ids_test.object.id[ll_row]
ls_create = ls_create+ il_id_array[ll_row]+'.invert=1 '
NEXT
idw.modify(ls_create)
END IF

Listing 5

string ls_create
long ll_rows, ll_row

ll_rows = upperbound(il_id_array)

IF ll_rows > 0 THEN
FOR ll_row = 1 TO ll_rows
ls_create = ls_create+ il_id_array[ll_row]+'.invert=0 '
NEXT
idw.modify(ls_create)
END IF

Listing 6

instance variables
string is_object
long il_x, il_y

is_object = idw.getobjectatpointer()

IF is_object > '' THEN
is_object = left(is_object,POS(is_object,'~t') - 1)
il_y = ypos - LONG(idw.describe(is_object+'.y'))
il_x = xpos - LONG(idw.describe(is_object+'.x'))
END IF

Listing 7

string ls_object
long ll_row, ll_page_row

ls_object = dw_palette.getobjectatpointer()
IF LEFT(ls_object,POS(ls_object,'~t') - 1) = 'bitmap' THEN
ll_row = LONG(MID(ls_object,POS(ls_object,'~t') + 1, LEN(ls_object) - POS(ls_object,'~t')))

IF ll_row > 0 THEN
//What is the first visible row
ll_page_row = LONG(dw_palette.Object.DataWindow.FirstRowOnPage)

//set the pictures object picturename variable to that of the
image name on the palette
p_1.picturename = dw_palette.object.bitmap[ll_row]

//Find the true y value of the selected image and set the
pictures property to this value
IF ll_row = 1 THEN
p_1.y = 20
ELSEIF ll_page_row = 1 THEN
p_1.y = dw_palette.object.row_height[ll_row - 1] +
dw_palette.object.y[ll_row] + 8
ELSE
p_1.y = (dw_palette.object.row_height[ll_row - 1] - dw_palette.object.row_height[ll_page_row - 1]) +
dw_palette.object.y[ll_row] + 8
END IF
//Set the picture objects x value to that of the
image on the palette
p_1.x = dw_palette.object.pic_x[ll_row]
//Set the originalsize to TRUE, very important
p_1.originalsize = TRUE

//set some instance variables within the picture object
p_1.il_x = (p_1.x + (p_1.width / 2)) - xpos
p_1.il_y = (p_1.y + (p_1.height / 2)) - ypos
//start the drag process
p_1.drag(begin!)
END IF
END IF

Listing 8

uo_pic lp
long ll_x, ll_y
string ls_id

lp = source

ll_x = idw.pointerx() + lp.il_x
ll_y = idw.pointery() + lp.il_y

dw_canvas.modify('create bitmap(band=foreground filename="
'+ lp.picturename +'" border="0" x="' +STRING(ll_x)+'
" y="'+STRING(ll_y)+'" height="'+STRING(lp.height)+'
" width="'+STRING(lp.width)+'" name='+ls_id+' )')

Listing 9

string dw_cmd, ls_name, ls_bomb
long xloc, startx, pix, cnt, cnt2

//Create the ellipse objects representing the mines

FOR cnt = 1 TO num_of_rects
xloc = startx + (cnt * 14)
pix = pixelstounits(xloc,xpixelstounits!)
ls_name = 't'+STRING(cnt)
dw_cmd = 'create ellipse(band=detail x="'+string(pix)+'
" y="4" height="44" width="50" name=oval'+
STRING(cnt)+' visible="0~tLONG(MID(bomb,'
+STRING(cnt)+',1))" brush.hatch="6" brush.color="255"
pen.style="0" pen.width="5" pen.color="0"
background.mode="2" background.color="255" )'

dw_minesweep.modify(dw_cmd)
NEXT

//Load the ellipse visibility column called 'bomb'

FOR cnt = 1 TO num_of_rows
FOR cnt2 = 1 TO num_of_rects
//Randomly generate string of 1's and 0's to indicate
and place into minesweep datawindow
ls_bomb = ls_bomb+//random 0 or 1
NEXT
dw_minesweep.insertrow(0)
dw_minesweep.object.bomb[dw_minesweep.rowcount()] = ls_bomb
NEXT

Listing 10

//Create the object
…..
dw_cmd = dw_cmd+'create compute(band=detail alignment="2" expression="MID(text,'+STRING(cnt)+',1)" name='+ls_name+
' border="6" color="30013682" x="'+string(pix)+'" y="0" visible="0~tLONG(MID(vis,'+STRING(cnt)+ ',1))" height="46"
width="48" font.face="Arial" font.height="-12"
font.weight="700" font.family="2" font.pitch="2"
font.charset="0" background.mode="2"
background.color="16711680" )'
…..

//Manipulate the object in the oe_lbd event.

string ls_object, ls_vis

ls_object = this.getobjectatpointer()

IF LEFT(ls_object,1) = 't' THEN //compute object
//get the row of the clicked object
row = LONG(right(ls_object,len(ls_object) - pos(ls_object,'~t')))
//strip out the object name
ls_object = left(ls_object,pos(ls_object,'~t'))
//Determine the sequence of the object
ll_seq = LONG(RIGHT(ls_object,LEN(ls_object) - 1))

//Extract the visibility metadata
ls_vis = this.object.vis[row]
// Set to not visible and replace the visibility metadata
this.object.vis[row] = REPLACE(ls_vis,ll_seq,1,'0')
END IF

Listing 11
…..
dw_cmd = dw_cmd+'create compute(band=detail alignment="2" expression="MID(text,'+STRING(cnt)+',1)" name='+ls_name+
' border="6" color="0~tLONG(MID(color,'+STRING
((cnt * 8) - 7)+',8))" x="'+string(pix)+'" y="0"
visible="1" height="46" width="48" font.face="Arial"
font.height="-12" font.weight="700" font.family="2"
font.pitch="2" font.charset="0" background.mode="2"
background.color="16711680" )'
……

Listing 12

key8 = 89
key6 = 67
key = 11

dw_cmd = ' create rectangle(band=detail name=t11
x="0~tlong(mid(x,'+key+',6))" y="0~tlong(mid(y,'+key+',6))" visible="'0~tlong(mid(vis,'+key+',1))" '" height="36" width="0~tlong(trim(mid(w,'+key+',6)))" brush.hatch=
"0~tlong(mid(btype,'+key+',1))" brush.color=
"0~tlong(if(long(mid(btype,'+key+',1)) =
6,mid(color,'+key8+',8), mid(bcolor,'+key8+',8)))
" pen.style="0" pen.width="2" pen.color="0" background.mode="0" background.color="0~tlong(if(long(mid(btype,'+key+',1)) = 6,mid(bcolor,'+key8+',8),mid(color,'+key8+',8)))" )'