BBjWindow::setScribble

Description

In BBj 11.0 and higher, this method toggles scribble mode on the window (see SCRIBBLE Mnemonic).

Syntax

Return Value

Method

void

setScribble(boolean scribble)

Parameters

Variable

Description

scribble

Specifies whether scribble mode is enabled:

 

0=

Disable scribble mode.

 

1=

Enable scribble mode.

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 PENWIDTH, PENCOLOR, PATTERN, and DRAWMODE settings. This mode is typically used to facilitate signature capture and similar features. Caveat: The server knows nothing about lines drawn directly on the client, so they are discarded if the draw panel is reset from the server with the REDRAW command.

Example

rem ' Signature capture sample

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
x = 50, y = 50, w = 400, h = 250, title$ = "Signature"
window! = sysgui!.addWindow(x,y,w,h,title$,$00090883$,$$)
window!.setCallback(window!.ON_CLOSE,"eoj")
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")
print (sysgui)'clear'(255,255,240)
print (sysgui)'pencolor'(0,0,255)
print (sysgui)'penwidth'(3)
print (sysgui)'scribble'(1)
print (sysgui)'track'(0)
format$ = "png"
process_events

eoj:
release

wipe:
    print (sysgui)'clear'
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

BBjWindow

Object Variables

SCRIBBLE Mnemonic

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