image\bbj40.gif BBjInputD::calendar


Description

In BBj 4.0 and higher, this method pops up a calendar dialog attached to the BBjInputD control.

Syntax

Return Value

Method

void

calendar()

Parameters

None.

Return Values

None.

Remarks

Pops up a calendar underneath the InputD control. The user can pick a date from the calendar and return it to the InputD control, or click the Close box to exit with no selection.

Example

REM Popup an InputD calendar

REM Obtain the instance of the BBjAPI object
LET myAPI!=BBjAPI()

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

REM Create data structures for keypress event handler
DIM EVENT$:TMPL(SYSGUI),GENERIC$:NOTICETPL(0,0)

REM Obtain the instance of the BBjSysGui object
LET mySysGui!=myAPI!.getSysGui()

REM Set addWindow param values
X=10
Y=10
WIDTH=200
HEIGHT=200
TITLE$="BBj Window"

REM Set the current context
mySysGui!.setContext(0)

REM Create a window
myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$,$00010002$)

Text! = myWindow!.addStaticText(100,50,60,90,30,"Press [F2] for a popup calendar")

REM Create an InputD control
myInputD! = myWindow!.addInputD(101,50,100,90,30)

REM Create a button control for popping up the calendar
myButton! = myWindow!.addToolButton(1,140,100,30,30,"BITMAP=calendar.png")

REM Focus on the InputD control
myInputD!.focus()

REM Register the CALLBACK routines
CALLBACK(ON_INPUT_KEYPRESS,KEYPRESS,mySysGui!.getContext(),myInputD!.getID())
CALLBACK(ON_TOOL_BUTTON_PUSH,PopupCalendar,mySysGui!.getContext(),myButton!.getID())
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())

REM Process Events
PROCESS_EVENTS

REM Callback routine called when the user closes the application window
APP_CLOSE:
RELEASE
RETURN

REM Popup calendar if F2 key is pressed
KEYPRESS:
EVENT$=mySysGui!.getLastEventString()
GENERIC$=NOTICE(SYSGUI,EVENT.X)
DIM NOTICE$:NOTICETPL(GENERIC.OBJTYPE,EVENT.FLAGS)
NOTICE$=GENERIC$
IF NOTICE.KEY$=$014C$ THEN gosub PopupCalendar
RETURN

PopupCalendar:
myInputD!.calendar()
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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