tbmdem32.bas

来自「汇编语言编的关于TBWINDOW的小程序」· BAS 代码 · 共 115 行

BAS
115
字号
$include "TBWINDO.INC"

out &H03d9,7
call qfill(1,1,25,80,32,fnattr(0,7))
call mainmenu
out &H03d9,0

sub mainmenu
shared item$(),itemcount,startpos
shared curntpos,done
done = 0
curntpos = 0
call makewindow(5,20,7,40,fnattr%(15,1),2,2,0)
call titlewindow(2,"[ MAIN MENU ]")
while not done
  oldcurntpos = curntpos
  item$(1) = "Pop Screen 1"
  item$(2) = "Pop Screen 2"
  item$(3) = "Pop Screen 3"
  item$(4) = "Second Menu Demo"
  item$(5) = "Exit"
  itemcount = 5
  startpos = 1
  call makemenu
  select case curntpos
    case 1 'screen 1
      call popscreen1
    case 2 ' screen 2
      call popscreen2
    case 3 ' screen 3
      call popscreen3
    case 4 ' second menu
      call secondmenu
    case else
      call removewindow
      curntpos = oldcurntpos
      out &H03d9,1
      call qfill(1,1,25,80,32,fnattr(15,1))
      color 0,7
      call makewindow(9,16,8,52,fnattr(0,7),2,0,0)
      locate 10,18:print "Please see the source code and documentation"
      locate 11,18:print "for how to create and use menu windows in"
      locate 12,18:print "your programs...."
      delay 5
      done = -1
    end select
wend 'done
call removewindow
end sub

sub popscreen1
call makewindow(8,10,7,60,fnattr(0,6),2,1,1)
call titlewindow(2,"[ SELECTION 1 ]")
call qprintc(10,10,70,"This is selection no. 1",fnattr(0,6))
call qprintc(11,10,70,"Press enter to return to main menu...",fnattr(15,6))
while not instat
wend
a$=inkey$
call removewindow
end sub

sub popscreen2
call makewindow(8,10,7,60,fnattr(0,3),2,1,1)
call titlewindow(2,"[ SELECTION 2 ]")
call qprintc(10,10,70,"This is selection no. 2",fnattr(0,3))
call qprintc(11,10,70,"Press enter to return to main menu...",fnattr(0,3))
while not instat
wend
a$=inkey$
call removewindow
end sub

sub popscreen3
call makewindow(8,10,7,60,fnattr(14,5),2,1,1)
call titlewindow(2,"[ SELECTION 3 ]")
call qprintc(10,10,70,"This is selection no. 3",fnattr(14,5))
call qprintc(11,10,70,"Press enter to return to main menu...",fnattr(14,5))
while not instat
wend
a$=inkey$
call removewindow
end sub

sub secondmenu
shared item$(),itemcount,startpos
shared curntpos,done
call makewindow(7,25,6,40,fnattr%(14,2),2,2,0)
call titlewindow(2,"[ SECOND MENU DEMO ]")
done = 0
oldcurntpos = curntpos
curntpos = 0
while not done
  item$(1) = "Pop Screen 1"
  item$(2) = "Pop Screen 2"
  item$(3) = "Pop Screen 3"
  item$(4) = "Exit"
  itemcount = 4
  startpos = 3
  call makemenu
  select case curntpos
    case 1 'screen 1
      call popscreen1
    case 2 ' screen 2
      call popscreen2
    case 3 ' screen 3
      call popscreen3
    case else
      call removewindow
      curntpos = oldcurntpos
      done = -1
  end select
wend 'done
done = 0
end sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?