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
RETURN

See Also

BBjAPI

BBjSysGui

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