BBjInputD::setShowWeeks

Description

In BBj 4.0 and higher, this method sets whether to display week numbers in the popup calendar associated with this BBjInputD control.

Syntax

Return Value

Method

void

setShowWeeks(boolean showWeeks)

Parameters

Variable

Description

showWeeks

Specifies whether to display week numbers in the popup calendar.

0 = Don't show week numbers

1 = Show week numbers

Return Value

None.

Remarks

By default, week numbers are not displayed in the popup calendar.

Example

REM Set the Locale of an InputD control

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 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$,$00010003$)

REM Create list of available locales
Locales$ = stbl("!LOCALES")
count = pos($0a$=locales$,1,0)
pos = pos(stbl("!LOCALE")=Locales$)
index = pos($0a$=Locales$(1,pos),1,0)
dim Locale$:"code["+str(count)+"]:c(1*=10)"
Locale$ = Locales$

Locales! = myWindow!.addListButton(100,50,50,90,100,Locales$)
Locales!.selectIndex(index)

REM Add an InputD control that uses the current default mask, inserting
REM today's date when the user hits the restore key (normally ESCAPE)
myInputD! = myWindow!.addInputD(101,50,100,90,30,$080c$,"",$$,0,0)

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

REM Show Weeks?
ShowWeeks! = myWindow!.addCheckBox(102,50,150,100,30,"Show Weeks?")

gosub setLocale

DIM EVENT$:TMPL(SYSGUI),GENERIC$:NOTICETPL(0,0)

REM Register the CALLBACK routines
CALLBACK(ON_LIST_SELECT,ChangeLocale,mySysGui!.getContext(),Locales!.getID())
CALLBACK(ON_TOOL_BUTTON_PUSH,Calendar,mySysGui!.getContext(),myButton!.getID())
CALLBACK(ON_CHECK_ON,ShowWeeksOn,mySysGui!.getContext(),ShowWeeks!.getID())
CALLBACK(ON_CHECK_OFF,ShowWeeksOff,mySysGui!.getContext(),ShowWeeks!.getID())
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())

REM Process Events
PROCESS_EVENTS

ShowWeeksOn:
myInputD!.setShowWeeks(1)
return

ShowWeeksOff:
myInputD!.setShowWeeks(0)
return

changeLocale:
index = Locales!.getSelectedIndex()
if (index >= 0) gosub setLocale
return

setLocale:
L$=stbl("!LOCALE",Locale.code$[index+1])
token! = new java.util.StringTokenizer(L$,"_")
tokens = token!.countTokens()
languageCode$="",countryCode$="",variantCode$=""
if (tokens > 0) then languageCode$ = token!.nextToken().toLowerCase()
if (tokens > 1) then countryCode$ = token!.nextToken().toUpperCase()
if (tokens > 2) then variantCode$ = token!.nextToken().toUpperCase()
Locale! = new java.util.Locale(languageCode$, countryCode$, variantCode$)
Mask$=STBL("!DATE"),Mask=pos($00$=Mask$),Mask$=Mask$(1,Mask-1)
myInputD!.setLocale(L$)
myInputD!.setMask(Mask$)
i=msgbox("Locale is "+Locale!.getDisplayName()+"; Mask is "+mask$)
return

Calendar:
myInputD!.calendar()
return

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

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.