fb:porticula NoPaste
total simples menu
Uploader: | MilkFreeze |
Datum/Zeit: | 26.12.2011 19:01:52 |
'sorry, hab das einfach straight runtergeschrieben, deswegen nicht sehr sauber
type t_menu_entry
text as string
f_ptr as sub()
id as ubyte
end type
sub foo()
print "foo ausgewählt"
end sub
sub bar()
print "Bar ausgewählt"
end sub
sub fooBar()
print "FooBar ausgewählt"
end sub
dim menu(1 to 3) as t_menu_entry
with menu(1)
.text = "Foo"
.f_ptr = @foo
.id = 1
end with
with menu(2)
.text = "Bar"
.f_ptr = @bar
.id = 2
end with
with menu(3)
.text = "Foo"
.f_ptr = @foobar
.id = 3
end with
dim key as string
dim selected as integer = 1
for i as integer = 1 to ubound(menu)
if (i = selected) then
print "->";
else
print " ";
end if
print menu(i).text
next
do
do
sleep 1,1
key = inkey
loop until key <> ""
select case key[1]
case 72
if (selected > 1) then
selected -= 1
end if
case 80
if (selected < ubound(menu)) then
selected += 1
end if
end select
cls
for i as integer = 1 to ubound(menu)
if (i = selected) then
print "->";
else
print " ";
end if
print menu(i).text
next
loop until key = "q"