IF (MOUSEX>MUL(dx%,chrbb%) AND MOUSEX<ADD(MUL(dx%,chrbb%),x3%)) AND (MOUSEY>SUB(MUL(dy%,chrbh%),18) AND MOUSEY<MUL(dy%,chrbh%))
' Invert found button
' -------------------
GET xpos%(posit%)+MUL(dx%,chrbb%),ypos%(posit%)+PRED(MUL(dy%,chrbh%))+20,xpos%(posit%)+ADD(MUL(dx%,chrbb%),x3%),ypos%(posit%)+PRED(MUL(dy%,chrbh%))+34,s$
PUT xpos%(posit%)+MUL(dx%,chrbb%),ypos%(posit%)+MUL(dy%,chrbh%)+20,s$,10
GOSUB process_button(loop%)
ENDIF
CASE "G"
IF (MOUSEX>SUB(dx%,5) AND MOUSEX<ADD(ADD(dx%,x3%),5)) AND (MOUSEY>SUB(dy%,4) AND MOUSEY<SUB(ADD(dy%,y3%),3))
' Invert found button
' -------------------
GET xpos%(posit%)+SUB(dx%,3),ypos%(posit%)+dy%+34,xpos%(posit%)+ADD(ADD(dx%,x3%),5),ypos%(posit%)+ADD(dy%,y3%)+33,s$
PUT xpos%(posit%)+SUB(dx%,3),ypos%(posit%)+dy%+34,s$,10
GOSUB process_button(loop%)
ENDIF
ENDSELECT
ENDIF
NEXT loop%
ENDIF
RETURN
'
> PROCEDURE process_button(index%)
' PURPOSE : Process button for correct event.
'
GOSUB modified_text
IF head%(posit%,index%)=0
IF type$(posit%)="T" OR type$(posit%)="G"
GOSUB add_window(index%)
ENDIF
ELSE
GOSUB display_next(index%)
ENDIF
RETURN
'
> PROCEDURE add_window(index%)
' PURPOSE : Draw dialog box to allow the user to select a
' Text window, Graphic window or play a Sample.
'
LOCAL tree%,dx%,dy%,dw%,dh%,button%
SPRITE cursor$
~RSRC_GADDR(0,2,tree%)
~FORM_CENTER(tree%,dx%,dy%,dw%,dh%)
~OBJC_CHANGE(tree%,10,0,dx%,dy%,dw%,dh%,0,0)
~OBJC_CHANGE(tree%,11,0,dx%,dy%,dw%,dh%,0,0)
~FORM_DIAL(0,dx%,dy%,dw%,dh%,dx%,dy%,dw%,dh%)
~OBJC_DRAW(tree%,0,3,dx%,dy%,dw%,dh%)
LET button%=FORM_DO(tree%,0)
~FORM_DIAL(3,dx%,dy%,dw%,dh%,dx%,dy%,dw%,dh%)
IF button%=10
GOSUB add_window2(index%,tree%)
ENDIF
ON MENU
GOSUB do_redraw(0)
RETURN
'
> PROCEDURE add_window2(index%,tree%)
' PURPOSE : Allows the user to load the next window event.
'
LET crea_date$(posit%)=DATE$
LET crea_time$(posit%)=TIME$
GOSUB find_slot
IF posit%=256
ALERT 1,"WINDOW LIMIT REACHED!|You have reached the window limit!",1," Sorry! ",button%
' PURPOSE : Locate and erase button which was clicked.
'
LET found!=FALSE
ALERT 1,"REMOVE EXISTING BUTTON!|Please Click on button to|remove. It will also remove|any connecting windows|to this button.",2," Abort! | Ok! ",button%
IF button%=2
ALERT 2,"WARNING - This operation will|remove all windows linked|to this button.",2," Abort! | Do it! ",button%