Post by kokenge on Mar 23, 2009 9:05:06 GMT -5
We all read the JavaScript code needed to create a tabbed menu bar to run applications. Usually it's huge, and complex.
It's simple in RB.
No JS needed.
Maybe someone will publish this in the RB Wiki.
It's simple in RB.
No JS needed.
Maybe someone will publish this in the RB Wiki.
' -------------------------------------
' Menu Tab Bar
' -------------------------------------
bf$ = "<SPAN STYLE='font-family:Arial; font-weight:700; font-size:10pt'>"
cssclass "#ta", "td { border-width: medium; border-bottom : 2px solid black; }"
CSSClass "a.close", "{
Text-Align : Center;
border-top : 2px solid black;
border-left : 2px solid black;
border-right : 2px solid black;
border-bottom : 2px solid black;
Font-Size : 10pt;
Font-Weight : Bold;
Font-Family : Arial;
Text-Decoration : None;}"
CSSClass "a.open", "{
Text-Align :Center;
background-color: tan;
border-top : 2px solid black;
border-left : 2px solid black;
border-right : 2px solid black;
border-bottom : 2px solid tan;
Font-Size : 10pt;
Font-Weight : Bold;
Font-Family : Arial;
Text-Decoration : None;}"
menuNum = 0
[main]
cls
div ta
html bf$;"<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 width=100% ><TR align=center>"
for i = 1 to 10
html "<TD>"
link #h, " Menu ";i;" ", [doMenu]
if menuNum <> i then
#h CSSClass("close")
else
#h CSSClass("open")
end if
html "</TD>"
#h setkey(str$(i))
next i
html "</TR><TR bgcolor=tan align=center>"
for i = 1 to 10
html "<TD>"
if menuNum = i then
for j = 1 to 5
prog$ = " Program";i;j
button #runit, prog$, [runIt]
#runit setkey(prog$)
next j
end if
html " </TD>"
next i
html "</TR></TABLE>"
end div
wait
[doMenu]
menuNum = val(EventKey$)
goto [main]
wait
' -------------------------------------------
' Run program
' -------------------------------------------
[runIt]
cls
prog$ = EventKey$ + ".bas"
html "<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 WIDTH=100% bgcolor=wheat><TR><TD align=center>"
button #rtna, "Exit ";prog$ ,[main]
html "</TD></TR></TABLE>"
' commented out actual run commands
'run prog$,#r
'render #r
html bf$;"RUN :";prog$
wait