KB#00393-Program demonstrating the use of fonts for GUI controls
Title:
Program demonstrating the use of fonts for GUI controls
Description:
REM Setup sysgui device window
open(100) "X0"
dim e$:tmpl(100)
dim s$:tmpl(100,IND=0)
s$=fin(100)
print(100)'window'((s.screen_width-470)/2,50,470,180,"Font Example",$02$,$03000000$)
REM Read in font families for menu
fonts$=ctrl(100,0,9)
a$=ctrl(100,0,10)
cur_font$=a$(10)
REM Print the menu and controls
print(100)'text'(20,10,20,70,20,"Font Size:",$8000$)
print(100)'listbutton'(21,90,15,40,150,"",$$)
print(100)'button'(22,150,15,80,20,"Normal",$$)
print(100)'checkbox'(23,150,35,80,20,"Bold",$$)
print(100)'checkbox'(24,150,55,80,20,"Italic",$$)
print(100)'checkbox'(25,150,75,80,20,"Underline",$$)
print(100)'rect'(5,5,265,100)
print(100)'edit'(7,10,110,250,60,"Edit Control",$$)
print(100)'listbox'(26,270,10,190,160,"",$01000000$)
font_style=-1
REM Parse out font string into list box
while pos($0a$=fonts$)>0
f$=fonts$(1,pos($0a$=fonts$)-1)
print(100)'listadd'(26,-1,f$)
fonts$=fonts$(pos($0a$=fonts$)+1)
wend
REM Fill in the listbutton, highlight current size
for i = 1 to 50
print(100)'listadd'(21,-1,str(i))
next i
a$=ctrl(100,0,10)
fs=dec(a$(6,2))-1
print(100)'listsel'(21,fs)
REM event loop
event_loop:
read record(100,siz=len(e$))e$
switch dec(e.code$)
case 88; end; REM closed the window
case 108; REM changed font or size
if e.id=26 then which_font$=ctrl(100,26,1)
gosub set_font
break
case 66; REM back to normal font
print(100)'uncheck'(23),'uncheck'(24),'uncheck'(25)
font_style=0
gosub set_font
break
case 99; REM changed look of font
font_style=0
if ctrl(100,23,2)=$01$ then font_style=font_style+1
if ctrl(100,24,2)=$01$ then font_style=font_style+2
if ctrl(100,25,2)=$01$ then font_style=font_style+16
gosub set_font
break
swend
goto event_loop
REM set fontname and fontsize
set_font:
print (100)'font'(7,which_font$,num(ctrl(100,21,1)),font_style)
return
Last Modified: 12/24/1997 Product: Visual PRO/5 Operating System: Windows
BASIS structures five components of their technology into the BBx Generations.