home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / dnalib7a.zip / EDITBOX.BAS < prev    next >
BASIC Source File  |  1994-05-14  |  3KB  |  126 lines

  1. DECLARE SUB LineEdit(Allow$,Text$,Mouse%,MouseRow%,MouseCol%,Fill%,Row%,Col%,EditKey%,Attr%)
  2. DECLARE SUB Popwind(Title$,Toprow%,Leftcolumn%,Bottomrow%,Rightcolumn%,Attr%,Shadow%,Border%)
  3. DECLARE SUB RestoreScreen(ScreenID$,TopRow%,LeftColumn%)
  4. DECLARE SUB SaveScreen(ScreenID$,TopRow%,LeftColumn%,BottomRow%,RightColumn%,Shadow%)
  5. DECLARE SUB CalcByte(Attr%,LowByte%,HiByte%)
  6. DECLARE SUB Clicked(Rgt%,Lft%,Row%,Col%)
  7. DECLARE SUB HideCursor()
  8. DECLARE SUB ShowCursor()
  9.  
  10. SUB EditBox(Prompt$,Text$,Allow$,Mouse%,Fill%,Location%,ButtonAttr%,TextAttr%,Attr%,Shadow%,Border%)PUBLIC
  11.  
  12. $CODE SEG "DNASEG1"
  13.  
  14. CalcByte Attr%,FGround%,BGround%
  15. CalcByte ButtonAttr%,BtFG%,BtBG%
  16.  
  17. IF Mouse% THEN HideCursor
  18.  
  19. Finished% = 0
  20.  
  21. LeftColumn% = 40 - ((LEN(Prompt$) + LEN(Text$) + 5) \ 2)
  22. RightColumn% = LeftColumn% + (LEN(Prompt$) + LEN(Text$) + 4)
  23.  
  24. SaveScreen EdScreen$,Location%,LeftColumn%,Location% + 5,RightColumn%,Shadow%
  25.  
  26. Popwind Title$,Location%,LeftColumn%,Location% + 5,RightColumn%,Attr%,Shadow%,Border%
  27.  
  28. COLOR FGround%,BGround%
  29. LOCATE Location% + 1,LeftColumn% + 2,0
  30. PRINT Prompt$;
  31.  
  32. Row% = Location% + 3
  33. Col% = LeftColumn% + 3
  34.  
  35. IF Mouse% THEN
  36.   COLOR FGround%,BGround%
  37.   LOCATE Location%,LeftColumn% + 1,0
  38.   PRINT CHR$(91,254,93);
  39. END IF
  40.  
  41.  COLOR BtFG%,BtBG%
  42.  LOCATE Row%, Col%,0
  43.  PRINT " Ok ";
  44.  COLOR 0,BGround%
  45.  LOCATE Row%, Col% + 4,0
  46.  PRINT "▄";
  47.  COLOR 0,BGround%
  48.  LOCATE Row% + 1,Col% + 1,0
  49.  PRINT "▀▀▀▀";
  50.  
  51.  COLOR BtFG%,BtBG%
  52.  LOCATE Row%,Col% + 9,0
  53.  PRINT " Esc ";
  54.  COLOR 0,BGround%
  55.  LOCATE Row%,Col% + 14,0
  56.  PRINT "▄";
  57.  COLOR 0,BGround%
  58.  LOCATE Row% + 1,Col% + 10,0
  59.  PRINT "▀▀▀▀▀"
  60.  
  61. DO
  62.  
  63. LineEdit Allow$,Text$,Mouse%,MouseRow%,MouseCol%,Fill%,Location% + 1,LeftColumn% + LEN(Prompt$) + 3,EditKey%,TextAttr%
  64.  
  65. IF Mouse% THEN  'stop here and check if exit was with mouse
  66.   ShowCursor
  67.   IF Row% = MouseRow% THEN
  68.     SELECT CASE MouseCol%
  69.  
  70.       CASE Col% TO Col% + 3
  71.         Editkey% = 13
  72.         Finished% = 1
  73.  
  74.       CASE Col% + 9 TO Col% + 13
  75.         Editkey% = 27
  76.         Finished% = 1
  77.  
  78.     END SELECT
  79.   ELSEIF Location% = MouseRow% THEN
  80.     IF MouseCol% = LeftColumn% + 2 THEN
  81.       Editkey% = 27
  82.       Finished% = 1
  83.     END IF
  84.   ELSE
  85.    IF Editkey% = 13 OR Editkey% = 27 THEN
  86.      Finished% = 1
  87.    END IF
  88.   END IF
  89. ELSE
  90.   IF Editkey% = 13 OR Editkey% = 27 THEN Finished% = 1
  91. END IF
  92.  
  93. LOOP UNTIL Finished%
  94.  
  95. SELECT CASE Editkey%
  96.  
  97.     CASE 13 'Ok
  98.           IF Mouse% THEN HideCursor
  99.           COLOR FGround%,BGround%
  100.           LOCATE Row%,Col%,0
  101.           PRINT " ";
  102.           LOCATE Row% + 1,Col% + 1,0
  103.           PRINT "    ";
  104.       COLOR BtFG%,BtBG%
  105.           LOCATE Row%,Col% + 1,0
  106.           PRINT " Ok "
  107.  
  108.     CASE 27 'Esc
  109.           IF Mouse% THEN HideCursor
  110.           COLOR FGround%,BGround%
  111.           LOCATE Row%,Col% + 9,0
  112.           PRINT " ";
  113.           LOCATE Row% + 1,Col% + 10,0
  114.           PRINT "      ";
  115.       COLOR BtFG%,BtBG%
  116.           LOCATE Row%,Col% + 10,0
  117.           PRINT " Esc "
  118.  
  119. END SELECT
  120.  
  121. IF Mouse% THEN ShowCursor
  122. DELAY .5
  123. IF Mouse% THEN HideCursor
  124. RestoreScreen EdScreen$,Location%,LeftColumn%
  125.  
  126. END SUB