BBjInputT::showTimePicker

Description

In BBj 24.00 and higher, this method pops up a time picker dialog attached to the BBjInputT control.

Syntax

Return Value Method
void showTimePicker()

Parameters

None.

Return Value

None.

BUI logoCSS

The visual appearance of BUI controls is defined using CSS (cascading style sheets) rules. Easily change the default colors, border, and other settings by customizing these rules, all without changing any application code. See CSS API for a high-level overview of BUI CSS.

The time picker popup has a primary style name of .BBjInputT-timePicker.

Remarks

Pops up a time picker next to the BBjInputT control. The user can pick a time and return it to the BBjInputT control, or click the Close/Cancel button to exit with no selection.

The user can interactively bring up the time picker with CTRL+P (GUI client) or down arrow (BUI client).

Example

rem ' BBjInputT::showTimePicker

sysgui = unt
open (sysgui)"X0"
print (sysgui)'scale'(1.5,1.5)
sysgui! = bbjapi().getSysGui()

font! = sysgui!.makeFont("SansSerif",12,0)

window! = sysgui!.addWindow(25,25,300,400,"setLocale",$00090083$,$00E3F007CD$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.addStaticText(200,0,20,100,25,"Locale:",$8000$)
locales! = window!.addListButton(100,110,20,180,300,"")
locales!.setCallback(locales!.ON_LIST_SELECT,"locale")
window!.addStaticText(201,0,60,100,25,"Date:",$8000$)
inputd! = window!.addInputD(101,110,60,130,25)
inputd!.setToolTipText("BBjInputD")
showDatePicker! = window!.addToolButton(301,250,60,25,25,"BITMAP=calendar.png")
showDatePicker!.setFont(font!)
showDatePicker!.setCallback(showDatePicker!.ON_TOOL_BUTTON_PUSH,"showDatePicker")

rem ' https://www.fileformat.info/info/unicode/char/1f4c5/index.htm
calendar! = new String($d83ddcc5$,"UTF-16")
showDatePicker!.setText(calendar!)
showDatePicker!.setToolTipText("showDatePicker")
window!.addStaticText(400,0,100,100,25,"Date Mask:",$8000$)
window!.addStaticText(401,110,100,120,25,"",$$)
window!.addStaticText(202,0,130,105,30,"Show Weeks?",$8000$)
showWeeks! = window!.addCheckBox(102,110,125,30,30,"")
showWeeks!.setCallback(showWeeks!.ON_CHECK_CHANGE,"showWeeks")
window!.addStaticText(501,0,160,100,25,"Time:",$8000$)
inputt! = window!.addInputT(601,110,160,130,25)
inputt!.setToolTipText("BBjInputT")
inputt!.setCallback(inputt!.ON_EDIT_MODIFY,"edit")
showTimePicker! = window!.addToolButton(602,250,160,25,25,"BITMAP=clock.png")
showTimePicker!.setFont(font!)
showTimePicker!.setCallback(showTimePicker!.ON_TOOL_BUTTON_PUSH,"showTimePicker")

rem ' https://www.fileformat.info/info/unicode/char/1f550/index.htm
clock! = new String($d83ddd50$,"UTF-16")
showTimePicker!.setText(clock!)
showTimePicker!.setToolTipText("showTimePicker")
window!.addStaticText(700,0,200,100,25,"Time Mask:",$8000$)
window!.addStaticText(701,110,200,120,25,"",$$)
mask$ = "00:00:00"
inpute! = window!.addInputE(801,110,240,130,25,$0000$,mask$)
inpute!.setToolTipText("BBjInputE mask 00:00:00")

editbox! = window!.addEditBox(802,110,280,140,25,"",$$,"time")
mask$="%Hz:%mz:%sz.000"
editbox!.setToolTipText("BBjEditBox time " + mask$ + " (Browser only)")
editbox!.setAttribute("step","60"); rem ' hh:mm
editbox!.setAttribute("step","1"); rem ' hh:mm:ss
editbox!.setAttribute("step","0.001"); rem ' hh:mm:ss.xxx

window!.addStaticText(900,0,320,100,25,"JavaScript:",$8000$)
intl! = window!.addStaticText(901,110,320,180,40,"",$$)

status! = window!.addStatusBar(99)

gosub setup_locale
gosub locale

process_events

eoj:
release

setup_locale:
    locale$ = stbl("!LOCALE")
    locales$ = stbl("!LOCALES")
    count = pos($0a$=locales$,1,0)
    pos = pos(stbl("!LOCALE")=locales$)
    index = pos($0a$=locales$(1,pos),1,0)
    print (sysgui)'listadd'(100,-1,count),locales$,'listsel'(100,index)
    dim locales$:"code["+str(count)+"]:c(1*=10)"
    locales$ = stbl("!LOCALES")
return

locale:
    Locale$ = stbl("!LOCALE",locales.code$[dec(ctrl(sysgui,100,2,context))+1])
    Locale! = Locale$
    token! = Locale!.split("_", 3)
    tokens = token!.length
    LanguageCode$ = "", CountryCode$ = "", VariantCode$ = ""
    if tokens > 0 then LanguageCode$ = token![0]
    if tokens > 1 then CountryCode$ = token![1]
    if tokens > 2 then VariantCode$ = token![2]
    Locale! = new java.util.Locale(languageCode$, countryCode$, variantCode$)
    print (sysgui)'title'(0,Locale!.getDisplayName()+" - INPUTT")
    DateMask$=stbl("!DATE"),DateMask=pos($00$=DateMask$),DateMask$=DateMask$(1,DateMask-1)
    inputd!.setLocale(Locale$)
    inputd!.setMask(DateMask$)
    inputd!.setValue(0)
    print (sysgui)'title'(401,DateMask$)
    print "!TIME=",stbl("!TIME")
    TimeMask$=stbl("!TIME"),TimeMask=pos($00$=TimeMask$),TimeMask$=TimeMask$(1,TimeMask-1)
    inputt!.setLocale(Locale$)
    inputt!.setMask(TimeMask$)
    inputt!.setValue(tim)
    print "BBjInputT::getValue =",inputt!.getValue()
    inpute!.setText(date(0,tim:"%Hz%mz%sz"))
    time$ = stbl("!TIME")+" "+date(0:TimeMask$)
    print (sysgui)'title'(99,Time$)
    print (sysgui)'title'(701,TimeMask$)

    locale$ = languageCode$
    if (len(variantCode$)) then
        temp$ = variantCode$
        if pos("#"=temp$)=1 then temp$ = temp$(2)
        locale$ = locale$ + "-" + temp$
    endif
    if (len(countryCode$)) then
        locale$ = locale$ + "-" + countryCode$
    endif

    print locale$

    timeStyle$ = iff(pos("%s"=TimeMask$),"medium","short")
    js$ = "dtf = new Intl.DateTimeFormat('"+locale$+"', { timeStyle: '"+timeStyle$+"' }); dtf.format(new Date());"
    intl!.setText("")
    intl!.setToolTipText(js$)
    js! = sysgui!.executeScript(js$)
    print js$," = ",js!
    if (js!=null()) then
        rem ' try without the variant code
        locale$ = languageCode$
        if (len(countryCode$)) then
            locale$ = locale$ + "-" + countryCode$
        endif
        print locale$
        js$ = "dtf = new Intl.DateTimeFormat('"+locale$+"', { timeStyle: '"+timeStyle$+"' }); dtf.format(new Date());"
        intl!.setToolTipText(js$)
        js! = sysgui!.executeScript(js$)
        print js$," = ",js!
    endif
    if (js!<>null()) then
        intl!.setText(js!)
    endif
return

edit:
    event! = sysgui!.getLastEvent()
    text$ = event!.getText()
    time = -1, time = time(text$,err=*next)
    if time < 0 then time$ = "!ERROR="+str(err)+" "+errmes(-1) else time$ = "TIM="+str(time)
    info$ = event!.getEventName()+" '"+text$+"' "+time$
    print info$
    print (sysgui)'title'(99,info$)
return

showDatePicker:
    inputd!.calendar()
return

showTimePicker:
    time = inputt!.getValue()
    mask$ = inputt!.getMask()
    time$ = ""
    if time>=0 then time$ = date(0,time,mask$)
    msg$ = str(time)+" "+time$
    print "BBjInputT::getValue: ",msg$

    rem 'i = msgbox(str(time)+" "+time$,0,"BBjInputT::getValue")
    inputt!.showTimePicker()
return

showWeeks:
    event! = sysgui!.getLastEvent()
    inputd!.setShowWeeks(event!.isChecked())
return

ClosedVersion History

  • BBj 24.00: BBjInputT::showTimePicker added.

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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