BBjDrawPanel::setScribble

Description

In BBj 16.0 and higher, this method toggles scribble mode on the draw panel.

Syntax

Return Value

Method

void

setScribble(boolean scribble)

Parameters

Variable

Description

scribble

A boolean value indicating whether scribble mode is enabled.

Return Value

None .

Remarks

When scribble mode is enabled, the draw panel intercepts the relevant mouse or touch events and draws lines using the current BBjDrawPanel::setPenWidthBBjDrawPanel::setPenColorBBjDrawPanel::setPattern, and BBjDrawPanel::setDrawMode settings. This mode is typically used to facilitate signature capture and similar features.

Example

rem ' BBjDrawPanel::setScribble

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
x = 50, y = 50, w = 400, h = 250
title$ = "BBjDrawPanel::setScribble"
window! = sysgui!.addWindow(x,y,w,h,title$,$00090883$,$$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setTrack(0)
menu! = window!.addMenuBar()
file! = menu!.addMenu(100,"&File")
wipe! = file!.addMenuItem(101,"&New")
wipe!.setCallback(wipe!.ON_MENU_ITEM_SELECT,"wipe")
save! = file!.addMenuItem(102,"Save &As...")
save!.setCallback(wipe!.ON_MENU_ITEM_SELECT,"save")
exit! = file!.addMenuItem(199,"E&xit")
exit!.setCallback(exit!.ON_MENU_ITEM_SELECT,"eoj")
pen! = menu!.addMenu(200,"&Pen")
black! = pen!.addMenuItem(201,"Blac&k")
black!.setCallback(black!.ON_MENU_ITEM_SELECT,"black")
blue! = pen!.addMenuItem(202,"&Blue")
blue!.setCallback(black!.ON_MENU_ITEM_SELECT,"blue")
red! = pen!.addMenuItem(203,"&Red")
red!.setCallback(red!.ON_MENU_ITEM_SELECT,"red")
magenta! = pen!.addMenuItem(204,"&Magenta")
magenta!.setCallback(magenta!.ON_MENU_ITEM_SELECT,"magenta")
green! = pen!.addMenuItem(205,"&Green")
green!.setCallback(green!.ON_MENU_ITEM_SELECT,"green")
drawpanel! = window!.getDrawPanel()
drawpanel!.setScribble(1)
color! = sysgui!.makeColor(255,255,240)
drawpanel!.clearDrawing(color!)
drawpanel!.setPenColor(BBjColor.BLUE)
drawpanel!.setPenWidth(3)
format$ = "png"
process_events

eoj:
release

wipe:
    drawpanel!.clearDrawing()
return

black:
    drawpanel!.setPenColor(BBjColor.BLACK)
return

blue:
    drawpanel!.setPenColor(BBjColor.BLUE)
return

red:
    drawpanel!.setPenColor(BBjColor.RED)
return

magenta:
    drawpanel!.setPenColor(BBjColor.MAGENTA)
return

green:
    drawpanel!.setPenColor(BBjColor.GREEN)
return

save:
    file$ = "Signature."+format$
    file$ = filesave("Save Signature",dsk("")+dir(""),file$,"")
    if pos("::"=file$) then return
    file! = new java.io.File(file$)
    file$ = file!.getCanonicalPath()
    path! = file!.getCanonicalPath().toLowerCase()
    if path!.endsWith(".gif") then format$ = "gif"
    if path!.endsWith(".png") then format$ = "png"
    if path!.endsWith(".jpg") then format$ = "jpg"
    if path!.endsWith(".jpeg") then format$ = "jpeg"
    image! = window!.getDrawPanelImage()
    image$ = image!.getBytes(format$,err = failed)
    image = unt
    open (image,mode="O_CREATE,O_TRUNC")file$
    writerecord (image)image$
    close (image)
    i = msgbox(file$,0,"Signature image file created")
return

failed:
    i = msgbox(errmes(-1),16,"Signature image file failed")
return

See Also

BBjAPI

BBjSysGui

BBjWindow

BBjDrawPanel

SCRIBBLE Mnemonic - Toggle Scribble On/Off (SYSGUI)

BBjWindow::setScribble

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