home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_BAS / DNALIB59.ZIP / EDITBOX.BAS < prev    next >
BASIC Source File  |  1993-11-17  |  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. CalcByte Attr%,FGround%,BGround%
  13. CalcByte ButtonAttr%,BtFG%,BtBG%
  14.  
  15. IF Mouse% THEN HideCursor
  16.  
  17. Finished% = 0
  18.  
  19. LeftColumn% = 40 - ((LEN(Prompt$) + LEN(Text$) + 5) \ 2)
  20. RightColumn% = LeftColumn% + (LEN(Prompt$) + LEN(Text$) + 4)
  21.  
  22. SaveScreen EdScreen$,Location%,LeftColumn%,Location% + 5,RightColumn%,Shadow%
  23.  
  24. Popwind Title$,Location%,LeftColumn%,Location% + 5,RightColumn%,Attr%,Shadow%,Border%
  25.  
  26. COLOR FGround%,BGround%
  27. LOCATE Location% + 1,LeftColumn% + 2,0
  28. PRINT Prompt$;
  29.  
  30. Row% = Location% + 3
  31. Col% = LeftColumn% + 3
  32.  
  33. IF Mouse% THEN
  34.   COLOR FGround%,BGround%
  35.   LOCATE Location%,LeftColumn% + 2,0
  36.   PRINT CHR$(91,254,93);
  37. END IF
  38.  
  39.  COLOR BtFG%,BtBG%
  40.  LOCATE Row%, Col%,0
  41.  PRINT " Ok ";
  42.  COLOR 0,BGround%
  43.  LOCATE Row%, Col% + 4,0
  44.  PRINT "▄";
  45.  COLOR 0,BGround%
  46.  LOCATE Row% + 1,Col% + 1,0
  47.  PRINT "▀▀▀▀";
  48.  
  49.  COLOR BtFG%,BtBG%
  50.  LOCATE Row%,Col% + 9,0
  51.  PRINT " Esc ";
  52.  COLOR 0,BGround%
  53.  LOCATE Row%,Col% + 14,0
  54.  PRINT "▄";
  55.  COLOR 0,BGround%
  56.  LOCATE Row% + 1,Col% + 10,0
  57.  PRINT "▀▀▀▀▀"
  58.  
  59. DO
  60.  
  61. LineEdit Allow$,Text$,Mouse%,MouseRow%,MouseCol%,Fill%,Location% + 1,LeftColumn% + LEN(Prompt$) + 3,EditKey%,TextAttr%
  62.  
  63. IF Mouse% THEN  'stop here and check if exit was with mouse
  64.   ShowCursor
  65.   IF Row% = MouseRow% THEN
  66.     SELECT CASE MouseCol%
  67.  
  68.       CASE Col% TO Col% + 3
  69.         Editkey% = 13
  70.         Finished% = 1
  71.  
  72.       CASE Col% + 9 TO Col% + 13
  73.         Editkey% = 27
  74.         Finished% = 1
  75.  
  76.     END SELECT
  77.   ELSEIF Location% = MouseRow% THEN
  78.     IF MouseCol% = LeftColumn% + 3 THEN
  79.       Editkey% = 27
  80.       Finished% = 1
  81.     END IF
  82.   ELSE
  83.    IF Editkey% = 13 OR Editkey% = 27 THEN
  84.      Finished% = 1
  85.    END IF
  86.   END IF
  87. ELSE
  88.   IF Editkey% = 13 OR Editkey% = 27 THEN Finished% = 1
  89. END IF
  90.  
  91. LOOP UNTIL Finished%
  92.  
  93. SELECT CASE Editkey%
  94.  
  95.     CASE 13 'Ok
  96.           IF Mouse% THEN HideCursor
  97.           COLOR FGround%,BGround%
  98.           LOCATE Row%,Col%,0
  99.           PRINT " ";
  100.           LOCATE Row% + 1,Col% + 1,0
  101.           PRINT "    ";
  102.       COLOR BtFG%,BtBG%
  103.           LOCATE Row%,Col% + 1,0
  104.           PRINT " Ok "
  105.  
  106.     CASE 27 'Esc
  107.           IF Mouse% THEN HideCursor
  108.           COLOR FGround%,BGround%
  109.           LOCATE Row%,Col% + 9,0
  110.           PRINT " ";
  111.           LOCATE Row% + 1,Col% + 10,0
  112.           PRINT "      ";
  113.       COLOR BtFG%,BtBG%
  114.           LOCATE Row%,Col% + 10,0
  115.           PRINT " Esc "
  116.  
  117. END SELECT
  118.  
  119. IF Mouse% THEN ShowCursor
  120. DELAY .5
  121. IF Mouse% THEN HideCursor
  122. RestoreScreen EdScreen$,Location%,LeftColumn%
  123.  
  124. END SUB
  125.  
  126.