rem ' TextControl::setDisabledTextColor
begin
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(100,100,300,500,"setDisabledTextColor",$00090003$,$ffffffff$)
data "Item 0","Item 1","Item 2","Item 3","Item 4"
list! = bbjapi().makeVector()
list$ = ""
while 1
dread item$,end=*break
list!.add(item$)
list$ = list$ + item$ + $0a$
wend
rem ' BBjInputE
mask$="XXX-000-AAA-aaa--ZZZ-zzz-UUU"
control! = window!.addInputE(101,10,10,125,25,$0000$,mask$," ",0,"","")
control!.setToolTipText("BBjInputE mask="+mask$)
rem ' BBjInputESpinner
control! = window!.addInputESpinner(102,145,10,145,25,list!)
control!.setToolTipText("BBjInputESpinner")
rem ' BBjInputN
mask$="###,###,###.##CR"
control! = window!.addInputN(103,10,40,125,25,$0000$,mask$,$00$,-123,-123)
control!.setToolTipText("BBjInputN mask="+mask$)
rem ' BBjInputNSpinner
mask$="-###,###,###.##"
control! = window!.addInputNSpinner(104,145,40,145,25,$0000$,mask$,$00$,0,0)
control!.setToolTipText("BBjInputNSpinner mask="+mask$)
rem ' BBjInputD
rem 'locale$ = stbl("!LOCALE","de_DE")
control! = window!.addInputD(105,10,70,125,25,$0000$,"",$00$,0,0)
control!.setToolTipText("BBjInputD locale="+stbl("!LOCALE")+" mask="+control!.getMask())
rem ' BBjInputDSpinner
control! = window!.addInputDSpinner(106,145,70,145,25,$0000$,"",$00$,0,0)
control!.setToolTipText("BBjInputDSpinner locale="+stbl("!LOCALE")+" mask="+control!.getMask())
rem ' BBjEditBox
control! = window!.addEditBox(107,10,100,125,25,"EditBox",$0000$)
control!.setToolTipText("BBjEditBox")
rem ' BBjEditBoxSpinner
control! = window!.addEditBoxSpinner(108,145,100,145,25,list!)
control!.setToolTipText("BBjEditBoxSpinner")
rem ' BBjEditBox (Password)
control! = window!.addEditBox(109,10,130,125,25,"xyzzy",$0400$)
control!.setToolTipText("BBjEditBox (Password)")
rem ' BBjListEdit
control! = window!.addListEdit(110,145,130,145,145,list$)
control!.selectIndex(0)
control!.setFieldHeight(25)
control!.setToolTipText("BBjListEdit")
rem ' BBjCEdit
control! = window!.addCEdit(111,10,160,280,130,list$,$0104$)
control!.setToolTipText("BBjCEdit")
rem ' BBjStaticText
control! = window!.addStaticText(112,10,300,125,25,"BBjStaticText",$$)
control!.setToolTipText("BBjStaticText")
rem ' BBjListButton
control! = window!.addListButton(113,145,300,125,145,list$,$$)
control!.selectIndex(0)
control!.setToolTipText("BBjListButton")
rem ' BBjCheckBox
control! = window!.addCheckBox(114,10,330,125,30,"BBjCheckBox",$$)
control!.setToolTipText("BBjCheckBox")
rem ' BBjRadioButton
control! = window!.addRadioButton(115,145,330,125,25,"BBjRadioButton",$$)
control!.setToolTipText("BBjRadioButton")
rem ' BBjTabCtrl
tabctrl! = window!.addTabCtrl(116,10,360,280,80,$00000008$)
for tab = 1 to 9
id = 200 + tab
child! = window!.addChildWindow(id,0,0,275,70,"",$00010010$,id,$$)
child!.addEditBox(101,tab*10,5,100,25,"BBjEditBox")
tabctrl!.addTab(str(tab-1),child!)
next tab
rem ' Editable
control! = window!.addCheckBox(117,10,450,125,25,"Editable",$0004$)
control!.setToolTipText("Make all text fields editable")
rem ' Enabled
control! = window!.addCheckBox(118,145,450,125,25,"Enabled",$0004$)
control!.setToolTipText("Enable all text fields")
rem ' Events
dim event$:tmpl(sysgui),generic$:noticetpl(0,0)
e = 0
color! = sysgui!.makeColor(0,0,255)
for id=101 to 116
control! = window!.getControl(id)
print control!.getDisabledTextColor(err=*next)," ",
control!.setDisabledTextColor(color!,err=*next);print control!," ",color!
next id
repeat
readrecord(sysgui,siz=10)event$
if event.code$="t" then continue; rem ' *** need to filter this! ***
e = e + 1, e! = sysgui!.getLastEvent(), e$ = e!.toString(), e$ = e$(1,pos("@"=e$)-1)
print str(e)," ",e$," code=",event.code$," context=",str(event.context)," id=",str(event.id)," flags=",str(event.flags)," x=",str(event.x)," y=",str(event.y)
if event.code$="x" then print " Spin text: ",e!.getText()
if event.code$="N" then gosub notify
if event.code$="c" and event.id=117 then gosub editable
if event.code$="c" and event.id=118 then gosub enabled
until event.code$="X"
release
editable:
for id=101 to 116
window!.getControl(id).setEditable(event.flags,err=*next)
next id
return
enabled:
for id=101 to 116
window!.getControl(id).setEnabled(event.flags)
next id
return
notify:
generic$ = notice(sysgui,event.x)
dim notice$:noticetpl(generic.objtype,event.flags)
notice$ = generic$
fields = pos($0a$=fattr(notice$,""),1,0)
dim field$:"name["+str(fields)+"]:c(1*)"
let field$=fattr(notice$,"")
for field=1 to fields
name$ = field.name$[field]
info$ = fattr(notice$,name$,$$)
print " ",name$,"=",
if asc(info$)=1 then print field(notice$,name$), else print str(nfield(notice$,name$)),
next field
print ""
return
keypress:
e! = sysgui!.getLastEvent()
x$ = x$+iff(e!.isAltDown(),"ALT ","")
x$ = x$+iff(e!.isCmdDown(),"CMD ","")
x$ = x$+iff(e!.isControlDown(),"CTRL ","")
x$ = x$+iff(e!.isShiftDown(),"SHIFT ","")
x$ = x$+" char="+Character.toString(e!.getKeyChar())+" "+str(e!.getKeyChar())+" code="+str(e!.getKeyCode())
gosub event
return
|