1: 2: 3: rem 4: rem THIS PROGRAM DEMONSTRATES THE USE OF INVISIBLE BUTTONS 5: rem 6: rem If a mouse is present invisible buttons are used to direct 7: rem the program to the right area of code. 8: rem 9: rem If a mouse is not present invisible buttons are used to allow the 10: rem up and down arrow to be used to direct the program. 11: rem 12: rem This program works the same under DOS or Windows. 13: rem 14: 15: fc=7 16: bc=1 17: color fc,bc 18: cls 19: x=mouseon 20: 21: 22: IF X<>0 THEN 23: rem 24: rem Come here if we have a mouse 25: rem Define 2 areas as invisible buttons. These buttons are centered 26: rem over two areas of the screen we are using as input areas. 27: rem INPUT statements are terminated when a button is pushed. 28: rem Then we do an INKEY$ function to get button keycode. 29: rem 30: CBUTTON "Input 1",1059,0,"Invisible",0,30,5,20,1,7,1 31: CBUTTON "Input 2",1060,0,"Invisible",0,30,7,20,1,7,4 32: cbutton "input 3",1061,0,"Invisible",0,30,9,20,1,7,1 33: CBUTTON "EXIT",1068,0,"PUSH",0,60,14,8,3,7,4 34: 35: ELSE 36: rem 37: rem Come here if we have no mouse 38: rem We are defining invisible buttons using the keycodes for 39: rem up/down arrow. This will allow these keys to terminate 40: rem an INPUT statement. 41: rem 42: CBUTTON "UP ARROW",1072,0,"INVISIBLE",0,0,0,0,0,0,0 43: cbutton "DOWN ARROW",1080,0,"INVISIBLE",0,0,0,0,0,0,0 44: CBUTTON "F10-EXIT",1068,0,"PUSH",0,60,14,10,3,7,1 45: 46: END IF 47: 48: 49: 50 50: rem 51: rem layout screen 52: rem 53: 54: locate 2,21 55: color fc+8,bc 56: print "Invisible Button Demonstration Program"; 57: color fc,bc 58: locate 5,19 59: print " Name: "; 60: locate 5,30 61: ' color bc,fc 62: print space$(20); 63: locate 7,19 64: color fc,bc 65: print " Address: "; 66: locate 7,30 67: color bc,fc 68: print space$(20); 69: color fc,bc 70: 71: 72: 73: rem 74: rem Get input for name 75: rem 76: 77: 100 78: locate 5,30 79: ' color bc,fc 80: savename$=name$ 81: input "", name$ 82: if name$="" then name$=savename$ 83: locate 5,30 84: l=len(name$) 85: if l<20 then 86: name$=name$+space$(20-l) 87: end if 88: print name$; 89: color fc,bc 90: 91: rem 92: rem check for any buttons (invisible or otherwise) 93: rem 94: a$=inkey$ 95: if len(a$)>1 then 96: a=asc(right$(a$,1)) 97: if a=59 or a=72 then goto 100 98: if a=60 or a=80 then goto 200 99: stop 100: end if 101: 102: 103: 104: rem 105: rem get input for address 106: rem 107: 108: 200 109: locate 7,30 110: color bc,fc 111: saveaddress$=address$ 112: input "", address$ 113: if address$="" then address$=saveaddress$ 114: locate 7,30 115: l=len(address$) 116: if l<20 then 117: address$=address$+space$(20-l) 118: end if 119: print address$; 120: color fc,bc 121: a$=inkey$ 122: if len(a$)>1 then 123: a=asc(right$(a$,1)) 124: if a=59 or a=72 then goto 100 125: if a=60 or a=80 then goto 200 126: stop 127: end if 128: goto 100 129: 130: 131: |