BBjDrawPanel::setTextColor

Description

In BBj 16.0 and higher, this method sets the color of text drawn to the BBjDrawPanel using BBjDrawPanel::drawText.

Syntax

Return Value

Method

void

setTextColor(BBjColor color)

Parameters

Variable

Description

color

Text color for BBjDrawPanel::drawText.

Return Value

None.

Remarks

None.

Example

rem ' BBjDrawPanel::setTextColor
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
fonts! = sysgui!.getSystemMetrics().getFontFamilies()
width = 450, height = 600
title$ = "BBjDrawPanel::setTextColor"
window! = sysgui!.addWindow(20,20,width,height,title$,$00090083$)
window!.setTrack(0)
window!.setCallback(window!.ON_CLOSE,"eoj")
font! = sysgui!.makeFont(fonts!.get(rnd(fonts!.size())),rnd(72),rnd(4))
chooser! = window!.addFontChooser(101,25,25,400,300,font!)
chooser!.setCallback(chooser!.ON_FONTCHOOSER_CHANGE,"font")
chooser!.setCallback(chooser!.ON_FONTCHOOSER_APPROVE,"font")
button! = window!.addButton(1,345,330,80,25,"Random",$$)
button!.setCallback(button!.ON_BUTTON_PUSH,"random")
drawpanel! = window!.getDrawPanel()
gosub drawText
process_events
eoj:
  release
random:
  font! = sysgui!.makeFont(fonts!.get(rnd(fonts!.size())),rnd(72),rnd(4))
  print "setSelectedFont ",font!
  chooser!.setSelectedFont(font!)
  gosub drawText
return
font:
  event! = sysgui!.getLastEvent()
  event$ = event!.toString(), event$ = event$(1,pos("@"=event$)-1)
  font! = event!.getFont()
  print event$,": ",font!
  gosub drawText
return
drawText:
  font$ = font!.getName()+" "+str(font!.getSize())
  style$ = chr(font!.getStyle())
  if dec(and(style$,$01$)) then font$ = font$ + " bold"
  if dec(and(style$,$02$)) then font$ = font$ + " italic"
  if dec(and(style$,$10$)) then font$ = font$ + " underline"
  window!.setFont(font!)
  color! = sysgui!.makeColor(rnd(255),rnd(255),rnd(255))
  drawpanel!.setTextColor(color!)
  drawpanel!.clearDrawing()
  drawpanel!.drawText(10,500,font$) 
  print "BBjDrawPanel::getTextColor = ",drawpanel!.getTextColor()
return

See Also

BBjAPI

BBjSysGui

BBjWindow

BBjDrawPanel

TEXTCOLOR Mnemonic - Set SYSGUI Text Color

BBjDrawPanel::getTextColor()

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.