BBjBatch::addSendMsg

 

In BBj 3.02 and higher, the BBjBatch object is deprecated and replaced with BBjAPI::getConfig().suppressUIAckBack(1), which is no-op'd in BBj 5.0 and higher.

Description

This method adds the selected SENDMSG() function to the specified SysGui batch.

Syntax

Return Value

Method

void

addSendMsg(int objectID, int messageID, int argument1, string argument2)

void

addSendMsg(int objectID, int messageID, int argument1, string argument2, int context)

Parameters

Variable

Description

objectID

For system operations, use a value of -1. Use a value of 0 when referring to the window in the current context. When the context parameter is included, using a value of 0 refers to the window of the specified context (as defined in the SENDMSG() function).

messageID

Specifies the message number (as defined in the SENDMSG() function).

argument1

Four-byte integer containing an argument for a given function (as defined in the SENDMSG() function).

argument2

String argument for a given function (as defined in the SENDMSG() function).

context

Context that contains the specified ID. This parameter is only necessary for objects that do not pertain to the current context (as defined in the SENDMSG() function).

Return Value

None.

Remarks

The arguments are identical to those of the SENDMSG() function except that the first SENDMSG() argument (SysGui channel) is not used.

Example

rem 'Sample program using BBjBatch

rem 'Obtain the instance of the BBjAPI object
let myAPI! = BBjAPI()

rem 'Open the SysGui device
SYSGUI = UNT
OPEN (SYSGUI) "X0"

rem 'Obtain the instance of the BBjSysGui object
let mySysGui! = myAPI!.getSysGui()

rem 'Start buffering writes to SysGui
mySysGui!.bufferWrites()

rem 'Create a window with a title using keyboard navigation in the specified context
CONTEXT = 0
PRINT (SYSGUI)'CONTEXT'(CONTEXT),'WINDOW'(0,0,500,400,"BBj Window",$010000$,$02000000$)

rem 'Add controls on the window
PRINT (SYSGUI)'BUTTON'(101,100,100,90,30,"Red",$$)
PRINT (SYSGUI)'BUTTON'(102,200,100,90,30,"Green",$$)
PRINT (SYSGUI)'BUTTON'(103,300,100,90,30,"Blue",$$)
PRINT (SYSGUI)'CHECKBOX'(201,100,200,90,30,"Red",$0004$)
PRINT (SYSGUI)'CHECKBOX'(202,200,200,90,30,"Green",$0004$)
PRINT (SYSGUI)'CHECKBOX'(203,300,200,90,30,"Blue",$0004$)
PRINT (SYSGUI)'TEXT'(301,100,300,300,30,$$,$$)

rem 'Flush the buffered writes to SysGui
mySysGui!.flushWrites()

rem 'Obtain the instance of the BBjBatch Object
let myBatch! = mySysGui!.getMessageBatch()

rem 'Batch the SendMsg to change keyboard navigation to use ENTER as TAB
myBatch!.addSendMsg(0,1,0,"NAVIGATE = ENTER")

rem 'Process all addSendMsg functions
myBatch!.processAll()

rem 'Get the response from the SendMsg function
OLD_NAV$ = STR(myBatch!.getResponse(0))

rem 'Register the CALLBACK routines
CALLBACK(ON_BUTTON_PUSH,RED_BUTTON_PUSHED,CONTEXT,101)
CALLBACK(ON_BUTTON_PUSH,GREEN_BUTTON_PUSHED,CONTEXT,102)
CALLBACK(ON_BUTTON_PUSH,BLUE_BUTTON_PUSHED,CONTEXT,103)
CALLBACK(ON_CHECK_ON,RED_CHECKBOX_CHECKED,CONTEXT,201)
CALLBACK(ON_CHECK_OFF,RED_CHECKBOX_CHECKED,CONTEXT,201)
CALLBACK(ON_CHECK_ON,GREEN_CHECKBOX_CHECKED,CONTEXT,202)
CALLBACK(ON_CHECK_OFF,GREEN_CHECKBOX_CHECKED,CONTEXT,202)
CALLBACK(ON_CHECK_ON,BLUE_CHECKBOX_CHECKED,CONTEXT,203)
CALLBACK(ON_CHECK_OFF,BLUE_CHECKBOX_CHECKED,CONTEXT,203)
CALLBACK(ON_CLOSE,APP_CLOSE,CONTEXT)

rem 'Process Events
process_events

rem 'Callback routine called when the red button is pressed
RED_BUTTON_PUSHED:
    rem 'Buffer the writes to SysGui
    mySysGui!.bufferWrites()

    rem 'Set the button colors to RED
    PRINT (SYSGUI)'BRUSHCOlOR'(2),'FILL'(1),'COLORSET'(101)
    PRINT (SYSGUI)'BRUSHCOlOR'(2),'FILL'(1),'COLORSET'(102)
    PRINT (SYSGUI)'BRUSHCOlOR'(2),'FILL'(1),'COLORSET'(103)

    rem 'Flush the writes to SysGui
    mySysGui!.flushWrites()
return

rem 'Callback routine called when the green button is pressed
GREEN_BUTTON_PUSHED:
    rem 'Buffer the writes to SysGui
    mySysGui!.bufferWrites()

    rem 'Set the button colors to GREEN
    PRINT (SYSGUI)'BRUSHCOlOR'(4),'FILL'(1),'COLORSET'(101)
    PRINT (SYSGUI)'BRUSHCOlOR'(4),'FILL'(1),'COLORSET'(102)
    PRINT (SYSGUI)'BRUSHCOlOR'(4),'FILL'(1),'COLORSET'(103)

    rem 'Flush the writes to SysGui
    mySysGui!.flushWrites()
return

rem 'Callback routine called when the blue button is pressed
BLUE_BUTTON_PUSHED:
    rem 'Buffer the writes to SysGui
    mySysGui!.bufferWrites()

    rem 'Set the button colors to BLUE
    PRINT (SYSGUI)'BRUSHCOlOR'(1),'FILL'(1),'COLORSET'(101)
    PRINT (SYSGUI)'BRUSHCOlOR'(1),'FILL'(1),'COLORSET'(102)
    PRINT (SYSGUI)'BRUSHCOlOR'(1),'FILL'(1),'COLORSET'(103)

    rem 'Flush the writes to SysGui
    mySysGui!.flushWrites()
return

rem 'Callback routine called when the red checkbox is checked
RED_CHECKBOX_CHECKED:
    rem 'Buffer the writes to SysGui
    mySysGui!.bufferWrites()

    rem 'Clear the batch
    myBatch!.clearAll()

    rem 'Batch addCtrl functions
    myBatch!.addCtrl(201,2)
    myBatch!.addCtrl(202,2)
    myBatch!.addCtrl(203,2)

    rem 'Process all addCtrol functions
    myBatch!.processAll()

    rem 'Get the responses back from the addCtrl functions
    TEXT$="Clicked Red: "
    TEXT$ = TEXT$+"Red = "+STR(DEC(myBatch!.getResponse(0)))
    TEXT$ = TEXT$+", Green= "+STR(DEC(myBatch!.getResponse(1)))
    TEXT$ = TEXT$+", Blue= "+STR(DEC(myBatch!.getResponse(2)))

    rem 'Display the selected response
    PRINT (SYSGUI)'TITLE'(301,TEXT$)

    rem 'Flush the writes to SysGui
    mySysGui!.flushWrites()
return

rem 'Callback routine called when the green checkbox is checked
GREEN_CHECKBOX_CHECKED:
    rem 'Buffer the writes to SysGui
    mySysGui!.bufferWrites()

    rem 'Clear the batch
    myBatch!.clearAll()

    rem 'Batch addCtrl functions
    myBatch!.addCtrl(201,2)
    myBatch!.addCtrl(202,2)
    myBatch!.addCtrl(203,2)

    rem 'Process all addCtrol functions
    myBatch!.processAll()

    rem 'Get the responses back from the addCtrl functions
    TEXT$="Clicked Green: "
    TEXT$ = TEXT$+"Red = "+STR(DEC(myBatch!.getResponse(0)))
    TEXT$ = TEXT$+", Green= "+STR(DEC(myBatch!.getResponse(1)))
    TEXT$ = TEXT$+", Blue= "+STR(DEC(myBatch!.getResponse(2)))

    rem 'Display the selected response
    PRINT (SYSGUI)'TITLE'(301,TEXT$)

    rem 'Flush the writes to SysGui
    mySysGui!.flushWrites()
return

rem 'Callback routine called when the blue checkbox is checked
BLUE_CHECKBOX_CHECKED:
    rem 'Buffer the writes to SysGui
    mySysGui!.bufferWrites()

    rem 'Clear the batch
    myBatch!.clearAll()

    rem 'Batch addCtrl functions
    myBatch!.addCtrl(201,2)
    myBatch!.addCtrl(202,2)
    myBatch!.addCtrl(203,2)

    rem 'Process all addCtrol functions
    myBatch!.processAll()

    rem 'Get the responses back from the addCtrl functions
    TEXT$="Clicked Blue: "
    TEXT$ = TEXT$+"Red = "+STR(DEC(myBatch!.getResponse(0)))
    TEXT$ = TEXT$+", Green= "+STR(DEC(myBatch!.getResponse(1)))
    TEXT$ = TEXT$+", Blue= "+STR(DEC(myBatch!.getResponse(2)))

    rem 'Display the selected response
    PRINT (SYSGUI)'TITLE'(301,TEXT$)

    rem 'Flush the writes to SysGui
    mySysGui!.flushWrites()
return

rem 'Callback routine called when the user closes the application window
APP_CLOSE:
release

See Also

BBjAPI

BBjSysGui

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