PROMPT() Function - Prompt For String Value

Syntax

PROMPT(message{,default{,title{,expr}}}{,MODE="options"}{,TIM=int}{,ERR=lineref})

Description

In BBj 22.13 and higher, the PROMPT() function prompts the user to type a value into a dialog box, then returns that string to the application. If the user cancels the dialog by clicking Cancel or pressing Esc, it returns "::CANCEL::", like the FILEOPEN() and FILESAVE() functions.

Parameters

Parameter

Description

message

Dialog box message text. Lines are automatically broken at the right edge of the dialog box. To force a line break, insert a line-feed character ($0A$) before the first character of a line.

In BBj 23.03 and higher, set STBL("!PROMPT_SPLIT",str(integer)) to break a long message text into chunks of the specified maximum number of characters.

default

Default value. If not specified, the default value is "".

title

Dialog box title text. If not specified, the program name is used as the title.

expr

Numeric expression that adds an optional icon to the dialog. 

Value

Icon

BBjSysGui Constant

0

None

MSGBOX_ICON_NONE

16

Stop Sign

MSGBOX_ICON_STOP

32

Question Mark

MSGBOX_ICON_QUESTION

48

Exclamation Point

MSGBOX_ICON_EXCLAMATION

64

Information Symbol

MSGBOX_ICON_INFORMATION

 

MDI (BBj 23.05 and higher)

Value

Icon

131072 If the current window is contained within an MDI desktop, limit the PROMPT dialog to the MDI desktop. Ignored if not in MDI.
ERR=lineref Branch to be taken if an error occurs during execution.
MODE="STYLE=name" An optional style name, equivalent to BBjControl::addStyle.
MODE="X=int,Y=int" Displays the dialog at a specific screen location. Either or both may be specified. By default, the dialog is centered.
MODE="W=int,H=int" Specifies the maximum width and height of the dialog window. Either or both may be specified. The dialog size is also limited by the size of the screen or browser.
MODE="SPLIT=int" In BBj 23.03 and higher, the optional SPLIT value specifies the maximum number of characters to show on a line before inserting a line break. This value overrides the STBL("!PROMPT_SPLIT") setting. The default is 100 characters.
MODE="attr=value" DWC logoThe mode string can specify selected DWC component attributes (e.g. "theme=primary, blurred=true"). DWC button attributes can be applied to the OK and Cancel buttons using the format "button-0-theme=success, button-1-theme=danger".
MODE="button-#-label=value" In BBj 24.10 and higher, the [OK] and [Cancel] button labels can be customized in all three clients (GUI, BUI, DWC). For example, "button-0-label=Login,button-1-label=Exit" sets the [OK] button label to "Login" and the [Cancel] button label to "Exit".
MODE="input-type=type"

In BBj 23.03 and higher, the input-type attribute can specify an alternative input type. If a specified type is unsupported in the current client, the default "text" is used.

 

Input-Type Description GUI BUI DWC
color Color Chooser
date Date Input
datetime-local Date/Time Input
email Email Address Input
file Client File Chooser
month Month Input
number Number Input
password Password Input
range Range Input
search Text Input for Search
tel Telephone Number Input
text Text Input (Default)
time Time Input
url URL Input
week Week Input

 

MODE="property=value" DWC logoThe mode string can specify arbitrary DWC properties (e.g. "theme=info"). Themes can also be applied to individual buttons (e.g. "button-0-theme=success, button-1-theme=danger").

MODE="ICON=imagefile

MODE="ICON=url"

The optional ICON value specifies a custom icon image, either an image file or a URL that will be reachable from the client (e.g. a DATA URL).
MODE="ICONWIDTH=int" The optional ICONWIDTH value specifies an integer width to scale the specified ICON.
MODE="ICONHEIGHT=int" The optional ICONHEIGHT value specifies an integer height to scale the specified ICON.
TIM=int The optional TIM=int option will cause the PROMPT dialog to timeout, returning the default value, if the user does not make a selection within int seconds. TIM=0 is equivalent to not specifying the TIM=int option at all; it will not timeout.
ERR=lineref Branch to be taken if an error occurs during execution.

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.

Here is a sample prompt dialog:

name$ = prompt("Enter your name","John Doe","Name",64)

The PROMPT() function defines the following style names:

.BBjPrompt the top level of the dialog window
.BBjPrompt-title the title bar
.BBjPrompt-panel the body area
.BBjPrompt-message-panel a horizontal panel that contains the icon and message
.BBjPrompt-icon the icon
.BBjPrompt-icon-error stop sign / error icon (16)
.BBjPrompt-icon-question question icon (32)
.BBjPrompt-icon-warning warning / exclamation icon (48)
.BBjPrompt-icon-info info icon (64)
.BBjPrompt-message the message
.BBjPrompt-input the text input field
.BBjPrompt-button-panel a horizontal panel that contains the buttons
.BBjPrompt-button an individual button

With the default CSS styles, the prompt looks like this:

And with the CSS file below, the same prompt looks like this:

.BBjPrompt
{
    border-width: 0px !important;
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 10px;
    border: 1px solid black;
    -webkit-box-shadow: #C6C6C6 2px 2px 2px;
    -moz-box-shadow: #C6C6C6 2px 2px 2px;
    box-shadow: #C6C6C6 2px 2px 2px;
}
.BBjPrompt-title
{
}
.BBjPrompt-icon
{
}
.BBjPrompt-message
{
}
.BBjPrompt-button
{
background: rgb(255,255,255);
background: -moz-linear-gradient(top,  rgba(255,255,255,1) 0%, rgba(229,229,229,1) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(229,229,229,1)));
background: -webkit-linear-gradient(top,  rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%);
background: -o-linear-gradient(top,  rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%);
background: -ms-linear-gradient(top,  rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%);
background: linear-gradient(to bottom,  rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5e5e5',GradientType=0 );
}
.BBjPrompt-button-panel
{
}
.BBjPrompt .dialogContent
{
background: rgb(206,220,231);
background: -moz-linear-gradient(top,  rgba(206,220,231,1) 0%, rgba(89,106,114,1) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(206,220,231,1)), color-stop(100%,rgba(89,106,114,1)));
background: -webkit-linear-gradient(top,  rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%);
background: -o-linear-gradient(top,  rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%);
background: -ms-linear-gradient(top,  rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%);
background: linear-gradient(to bottom,  rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cedce7', endColorstr='#596a72',GradientType=0 );
}

Examples

Example 1

The following creates a dialog with a prompt value of "Enter your name", a title of the program name, an input field for the user to type a name, an OK button and a Cancel button:

let name$ = prompt("Enter your name")

Example 2

The following creates a dialog with a prompt value of "Enter your name", a title of the program name, an input field for the user to type a name, an OK button and a Cancel button. The input field is initialized to the specified default value of "John Doe":

let name$ = prompt("Enter your name","John Doe")

Example 3

The following creates a dialog with a prompt value of "Enter your name", a title of "Customer Name", an input field for the user to type a name, an OK button and a Cancel button. The input field is initialized to the specified default value of "John Doe":

let name$ = prompt("Enter your name","John Doe","Customer Name")

Example 4

The following creates a dialog with an information icon, a prompt value of "Enter your name", a title of "Customer Name", an input field for the user to type a name, an OK button and a Cancel button. The input field is initialized to the specified default value of "John Doe":

let name$ = prompt("Enter your name","John Doe","Customer Name",64)

Example 5

The following creates a dialog with a prompt value of "Enter your name", a title of "Customer Name", an input field for the user to type a name, an OK button and a Cancel button. The input field is initialized to the specified default value of "John Doe". If the user doesn't click OK within 10 seconds, the current value of the input field is returned.

let name$ = prompt("Enter your name","John Doe","Customer Name",TIM=10)

Example 6

In BBj 23.03 and higher, the following creates a dialog with a prompt value of "Enter your password", a title of the program name, a password input field for the user to type a password, an OK button and a Cancel button:

let password$ = prompt("Enter your password",mode="input-type=password")

Example 7

The prompt function works very much like the msgbox function, and accepts some of the same options. The following test program can be used to interactively test various options with both functions.

rem ' msgbox & prompt

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(10,10,730,525,"MSGBOX & PROMPT",$00090083$)
window!.setCallback(window!.ON_CLOSE,"eoj")
LocaleBox! = window!.addListBox(100,10,10,350,340,$$,$$)

x$ = "", y$ = "", w$ = $$, h$ = $$, html = 0
window!.addStaticText(101,0,365,25,25,"&X:",$8000$)
x! = window!.addEditBox(102,30,360,50,25,"",$$)
x!.setToolTipText("X location of dialog")
x!.setCallback(x!.ON_EDIT_MODIFY,"x")
window!.addStaticText(103,90,365,25,25,"&Y:",$8000$)
y! = window!.addEditBox(104,120,360,50,25,"",$$)
y!.setToolTipText("Y location of dialog")
y!.setCallback(y!.ON_EDIT_MODIFY,"y")
window!.addStaticText(105,180,365,25,25,"&W:",$8000$)
w! = window!.addEditBox(106,210,360,50,25,"",$$)
w!.setToolTipText("Maximum width of content")
w!.setCallback(w!.ON_EDIT_MODIFY,"w")
window!.addStaticText(107,270,365,25,25,"&H:",$8000$)
h! = window!.addEditBox(108,300,360,50,25,"",$$)
h!.setToolTipText("Maximum height of content")
h!.setCallback(h!.ON_EDIT_MODIFY,"h")

window!.addStaticText(109,360,365,75,25,"Extra &rows:",$8000$)
rows! = window!.addInputNSpinner(110,440,360,75,25,0,5000)
rows!.setCallback(rows!.ON_SPIN,"rows")
rows!.setToolTipText("Extra rows of content")
rows!.setCallback(rows!.ON_EDIT_MODIFY,"rows")
rows = 0

window!.addStaticText(111,525,365,75,25,"Extra &cols:",$8000$)
cols! = window!.addInputNSpinner(112,605,360,75,25,0,2000)
cols!.setCallback(cols!.ON_SPIN,"cols")
cols!.setToolTipText("Extra columns of content")
cols!.setCallback(cols!.ON_EDIT_MODIFY,"cols")
cols = 0

rem ' config.bbx: SET !OPTIONS=NATIVE_BROWSER_MSGBOX=TRUE
native_dialog$ = stbl("!OPTIONS","NATIVE_BROWSER_MSGBOX")
native_dialog = sgn(pos("TRUE"=native_dialog$))
flags$ = iff(native_dialog,$0004$,$0000$)
native_dialog! = window!.addCheckBox(113,10,400,110,25,"&Native dialog",flags$)
native_dialog!.setToolTipText("BUI: Use native browser dialog for OK and OK/Cancel")
native_dialog!.setCallback(native_dialog!.ON_CHECK_ON,"native_dialog_true")
native_dialog!.setCallback(native_dialog!.ON_CHECK_OFF,"native_dialog_false")

use_html! = window!.addCheckBox(114,120,400,120,25,"HTML content",$0000$)
use_html!.setToolTipText("Always set MSGBOX content using html")
use_html!.setCallback(use_html!.ON_CHECK_ON,"use_html_true")
use_html!.setCallback(use_html!.ON_CHECK_OFF,"use_html_false")

window!.addStaticText(115,245,405,60,25,"&Timeout:",$8000$)
timeout! = window!.addInputNSpinner(116,310,400,50,25,0,10)
timeout!.setCallback(timeout!.ON_SPIN,"timeout")
timeout!.setCallback(timeout!.ON_EDIT_MODIFY,"timeout")
timeout!.setToolTipText("MSGBOX timeout (seconds)")
timeout = 0

mdi_desktop! = window!.addCheckBox(117,10,435,120,25,"&MDI Desktop",$0000$)
mdi_desktop!.setToolTipText("Restrict dialogue to the MDI desktop")
mdi_desktop!.setCallback(mdi_desktop!.ON_CHECK_ON,"mdi_desktop_true")
mdi_desktop!.setCallback(mdi_desktop!.ON_CHECK_OFF,"mdi_desktop_false")

disable_html! = window!.addCheckBox(118,120,435,120,25,"&Disable HTML",$0000$)
disable_html!.setToolTipText("Render HTML content as raw text")
disable_html!.setCallback(disable_html!.ON_CHECK_ON,"disable_html_true")
disable_html!.setCallback(disable_html!.ON_CHECK_OFF,"disable_html_false")

window!.addStaticText(119,245,440,60,25,"&Modes:",$8000$)
modes$ = "theme=primary"
mode! = window!.addEditBox(120,310,430,410,25,modes$,$$)
mode!.setToolTipText("Add comma-separated modes/attributes here.")

window!.addGroupBox(200,380,10,130,190,"Icon",$$)
Icon0! = window!.addRadioButton(201,390,40,110,25,"No Icon",$0004$)
Icon16! = window!.addRadioButton(202,390,70,110,25,"Stop Sign",$$)
Icon32! = window!.addRadioButton(203,390,100,110,25,"Question",$$)
Icon48! = window!.addRadioButton(204,390,130,110,25,"Exclamation",$$)
Icon64! = window!.addRadioButton(205,390,160,110,25,"Information",$$)
IconGroup! = window!.addRadioGroup()
IconGroup!.add(Icon0!)
IconGroup!.add(Icon16!)
IconGroup!.add(Icon32!)
IconGroup!.add(Icon48!)
IconGroup!.add(Icon64!)

window!.addGroupBox(300,380,220,130,130,"Default Button",$$)
Default0! = window!.addRadioButton(301,390,250,110,25,"First",$0004$)
Default256! = window!.addRadioButton(302,390,280,110,25,"Second",$$)
Default512! = window!.addRadioButton(303,390,310,110,25,"Third",$$)
DefaultGroup! = window!.addRadioGroup()
DefaultGroup!.add(Default0!)
DefaultGroup!.add(Default256!)
DefaultGroup!.add(Default512!)

window!.addGroupBox(400,530,10,190,340,"Buttons",$$)
Buttons0! = window!.addRadioButton(401,540,40,160,25,"OK",$0004$)
Buttons1! = window!.addRadioButton(402,540,70,160,25,"OK/Cancel",$$)
Buttons2! = window!.addRadioButton(403,540,100,160,25,"Abort/Retry/Ignore",$$)
Buttons3! = window!.addRadioButton(404,540,130,160,25,"Yes/No/Cancel",$$)
Buttons4! = window!.addRadioButton(405,540,160,160,25,"Yes/No",$$)
Buttons5! = window!.addRadioButton(406,540,190,160,25,"Retry/Cancel",$$)
Buttons7! = window!.addRadioButton(407,540,220,160,25,"Custom",$$)
ButtonsGroup! = window!.addRadioGroup()
ButtonsGroup!.add(Buttons0!)
ButtonsGroup!.add(Buttons1!)
ButtonsGroup!.add(Buttons2!)
ButtonsGroup!.add(Buttons3!)
ButtonsGroup!.add(Buttons4!)
ButtonsGroup!.add(Buttons5!)
ButtonsGroup!.add(Buttons7!)

Custom1! = window!.addEditBox(501,540,250,170,25,"&1",$$)
Custom2! = window!.addEditBox(502,540,280,170,25,"&2",$$)
Custom3! = window!.addEditBox(503,540,310,170,25,"&3",$$)

Close! = window!.addButton(2,380,400,100,25,"Close")
Close!.setCallback(Close!.ON_BUTTON_PUSH,"eoj")
Msgbox! = window!.addButton(1,490,400,110,25,"MSGBOX()")
Msgbox!.setCallback(Msgbox!.ON_BUTTON_PUSH,"msgbox")
Prompt! = window!.addButton(3,610,400,110,25,"PROMPT()")
Prompt!.setCallback(Prompt!.ON_BUTTON_PUSH,"prompt")

imagefile! = window!.addButton(121,10,470,120,25,"Image File",$$)
imagefile!.setCallback(imagefile!.ON_BUTTON_PUSH,"imagefile")

iconwidth! = window!.addEditBox(122,140,470,50,25,"",$$)
iconwidth!.setToolTipText("Scaled icon width")
iconheight! = window!.addEditBox(123,200,470,50,25,"",$$)
iconheight!.setToolTipText("Scaled icon height")

window!.addStaticText(128,250,470,50,25,"Icon:",$8000$)
icon$ = ""
icon! = window!.addEditBox(129,310,470,410,25,icon$,$$)
icon!.setToolTipText("Specify a custom icon here.")

status! = window!.addStatusBar(99)

gosub init

process_events

eoj:
release

native_dialog_true:
    native_dialog$="TRUE"
    native_dialog$ = stbl("!OPTIONS","NATIVE_BROWSER_MSGBOX="+native_dialog$)
return

native_dialog_false:
    native_dialog$="FALSE"
    native_dialog$ = stbl("!OPTIONS","NATIVE_BROWSER_MSGBOX="+native_dialog$)
return

use_html_true:
    html = 1
return

use_html_false:
    html = 0
return

disable_html_true:
    disable_html = 1
return

disable_html_false:
    disable_html = 0
return

mdi_desktop_true:
    mdi_desktop = 1
return

mdi_desktop_false:
    mdi_desktop = 0
return

msgbox:
    Locale = LocaleBox!.getSelectedIndex()
    if (Locale<0) then
        Locale$ = stbl("!LOCALE",Locale.getDefault().toString())
        Locale! = Locale.getDefault()
        Message! = Locale!.getDisplayName(Locale!)
        Title! = Locale!.getDisplayName()
    else
        Locale$ = stbl("!LOCALE",Locales!.get(Locale))
        Locale! = LocaleList!.get(Locale)
        Message! = localNameList!.get(Locale)
        Title! = defaultNameList!.get(Locale)
    endif

    Title$ = fnhtml$(Title!,html)

    if (rows) then
        for i = 1 to rows
            extra$ = fill(cols,"row"+str(i)+",")
            Message! = Message!.concat($0a$).concat(extra$)
        next i
    endif

    Message$ = fnhtml$(Message!,html)
    expr = 0, custom = 0
    switch ButtonsGroup!.getSelected().getID()
        case Buttons0!.getID(); break
        case Buttons1!.getID(); expr=1; break
        case Buttons2!.getID(); expr=2; break
        case Buttons3!.getID(); expr=3; break
        case Buttons4!.getID(); expr=4; break
        case Buttons5!.getID(); expr=5; break
        case Buttons7!.getID(); expr=7,custom=1; break
        case default; escape
    swend

    switch IconGroup!.getSelected().getID()
        case Icon0!.getID(); break
        case Icon16!.getID(); expr=expr+16; break
        case Icon32!.getID(); expr=expr+32; break
        case Icon48!.getID(); expr=expr+48; break
        case Icon64!.getID(); expr=expr+64; break
        case default; escape
    swend

    switch DefaultGroup!.getSelected().getID()
        case Default0!.getID(); break
        case Default256!.getID(); expr=expr+256; break
        case Default512!.getID(); expr=expr+512; break
        case default; escape
    swend

    if disable_html then expr=expr+32768
    if mdi_desktop then expr=expr+131072

    mode$ = "x="+x$+",y="+y$+",w="+w$+",h="+h$
    if len(mode!.getText().trim()) then mode$ = mode$ + "," +mode!.getText().trim()
    iconwidth$ = iconwidth!.getText().trim()
    if len(iconwidth$) then mode$ = mode$ + ",iconwidth=" + iconwidth$
    iconheight$ = iconheight!.getText().trim()
    if len(iconheight$) then mode$ = mode$ + ",iconheight=" + iconheight$
    icon$ = icon!.getText().trim()
    if pos(","=icon$) then icon$ = """" + icon$ + """"
    if len(icon$) then mode$ = mode$ + ",icon=" + icon$

    print mode$

    rem 'Message$ = Gettysburg$
    if (custom) then
        Button1! = Custom1!.getText().trim(),Button1$=fnhtml$(Button1!,html)
        Button2! = Custom2!.getText().trim(),Button2$=fnhtml$(Button2!,html)
        Button3! = Custom3!.getText().trim(),Button3$=fnhtml$(Button3!,html)
        if (Button3!.length()) then
            result = msgbox(Message$,expr,Title$,Button1$,Button2$,Button3$,tim=timeout,mode=mode$,err=oops)
        else
            if (Button2!.length()) then
                result = msgbox(Message$,expr,Title$,Button1$,Button2$,tim=timeout,mode=mode$,err=oops)
            else
                if (Button1!.length()) then
                    result = msgbox(Message$,expr,Title$,Button1$,tim=timeout,mode=mode$,err=oops)
                else
                    result = msgbox(Message$,expr,Title$,tim=timeout,mode=mode$,err=oops)
                endif
            endif
        endif
        switch result
            case -1; result$ = "Timeout"; break
            case 0; result$ = "None"; break
            case 1; result$ = Button1$; break
            case 2; result$ = Button2$; break
            case 3; result$ = Button3$; break
            case default; result$ = "Undefined"
        swend
    else
        result = msgbox(Message$,expr,Title$,tim=timeout,mode=mode$,err=oops)
        switch result
            case -1; result$ = "Timeout"; break
            case 0; result$ = "None"; break
            case 1; result$ = "OK"; break
            case 2; result$ = "Cancel"; break
            case 3; result$ = "Abort"; break
            case 4; result$ = "Retry"; break
            case 5; result$ = "Ignore"; break
            case 6; result$ = "Yes"; break
            case 7; result$ = "No"; break
            case default; result$ = "Undefined"
        swend
    endif
    result$ = "MSGBOX result = " + result$ + " ("+str(result)+")"
    status!.setText(result$)
return

oops:
    result = msgbox(errmes(-1),48,"*** ERROR ***")
return

prompt:
    Locale = LocaleBox!.getSelectedIndex()
    if (Locale<0) then
        Locale$ = stbl("!LOCALE",Locale.getDefault().toString())
        Locale! = Locale.getDefault()
        Message! = Locale!.getDisplayName(Locale!)
        Title! = Locale!.getDisplayName()
    else
        Locale$ = stbl("!LOCALE",Locales!.get(Locale))
        Locale! = LocaleList!.get(Locale)
        Message! = localNameList!.get(Locale)
        Title! = defaultNameList!.get(Locale)
    endif

    Title$ = fnhtml$(Title!,html)
    Default$ = Title$

    if (rows) then
        for i = 1 to rows
            extra$ = fill(cols,"row"+str(i)+",")
            Message! = Message!.concat($0a$).concat(extra$)
        next i
    endif

    Message$ = fnhtml$(Message!,html)
    expr = 0

    switch IconGroup!.getSelected().getID()
        case Icon0!.getID(); break
        case Icon16!.getID(); expr=expr+16; break
        case Icon32!.getID(); expr=expr+32; break
        case Icon48!.getID(); expr=expr+48; break
        case Icon64!.getID(); expr=expr+64; break
        case default; escape
    swend

    if mdi_desktop then expr=expr+131072
    mode$ = "x="+x$+",y="+y$+",w="+w$+",h="+h$
    if len(mode!.getText().trim()) then mode$ = mode$ + "," +mode!.getText().trim()
    iconwidth$ = iconwidth!.getText().trim()
    if len(iconwidth$) then mode$ = mode$ + ",iconwidth=" + iconwidth$
    iconheight$ = iconheight!.getText().trim()
    if len(iconheight$) then mode$ = mode$ + ",iconheight=" + iconheight$
    icon$ = icon!.getText().trim()
    if pos(","=icon$) then icon$ = """" + icon$ + """"
    if len(icon$) then mode$ = mode$ + ",icon=" + icon$

    print mode$

    rem 'Message$ = Gettysburg$

    result$ = prompt(Message$,Default$,Title$,expr,tim=timeout,mode=mode$,err=oops)
    result$ = "PROMPT result = " + result$
    status!.setText(result$)
return

use java.util.Arrays
use java.util.ArrayList
use java.util.Locale

init:
    default$ = Locale.getDefault().toString()
    default! = default$
    vector! = bbjapi().makeVector()
    list! = stbl("!LOCALES")
    Locales! = Arrays.asList(list!.split($0a$))
    java.util.Collections.sort(Locales!)
    localeList! = new ArrayList()
    localNameList! = new ArrayList()
    defaultNameList! = new ArrayList()
    for i=0 to Locales!.size()-1
        temp! = Arrays.asList(Locales!.get(i).split("_",3))
        switch temp!.size()
            case 3; Locale! = new Locale(temp!.get(0),temp!.get(1),temp!.get(2)); break
            case 2; Locale! = new Locale(temp!.get(0),temp!.get(1)); break
            case 1; Locale! = new Locale(temp!.get(0)); break
            case default; Locale! = Locale.getDefault(); break
        swend
        localeList!.add(Locale!)
        language$ = Locale!.getLanguage()
        localName! = new String(Locale!.getDisplayName(Locale!).getBytes("UTF-8"),"UTF-8")
        defaultName! = new String(Locale!.getDisplayName().getBytes("UTF-8"),"UTF-8")
        unicode! = localName!.concat(" - ").concat(defaultName!)
        vector!.add(unicode!)
        localNameList!.add(localName!)
        defaultNameList!.add(defaultName!)
        if Locales!.get(i).equals(default$) then default!=unicode!
    next i
    LocaleBox!.insertItems(-1,vector!)
    default = vector!.indexOf(default!)
    LocaleBox!.selectIndex(default)
return

def fnhtml$(string!,_html)
    html! = new StringBuffer("")
    if (string!.length()) then
        for i=0 to string!.length()-1
            c = string!.codePointAt(i)
            if c<128 then html!.append(chr(c)) else html!.append("&#").append(str(c)).append(";"); _html=1
        next i
        if (_html) then
            html!.insert(0,"<html><p style='font-size:20px;'>>")
        endif
    endif
    print string!," = ",html!
    if _html then return html!.toString().replaceAll($0a$,"<br>")
return html!.toString()
fnend

timeout:
    event! = sysgui!.getLastEvent()
    timeout = num(event!.getText())
return

rows:
    event! = sysgui!.getLastEvent()
    rows = num(event!.getText())
return

cols:
    event! = sysgui!.getLastEvent()
    cols = num(event!.getText())
return

x:
    event! = sysgui!.getLastEvent()
    x$ = event!.getText()
return

y:
    event! = sysgui!.getLastEvent()
    y$ = event!.getText()
return

w:
    event! = sysgui!.getLastEvent()
    w$ = event!.getText()
return

h:
    event! = sysgui!.getLastEvent()
    h$ = event!.getText()
return

imagefile:
    filter$ = "Images"+$0a$+"*.png;*.jpg;*.jpeg;*.gif;*.tif;*.tiff"
    filter$ = filter$ + $0a$ + "All Files (*.*)"+$0a$+"*.*"
    clientfile$ = fileopen("Image File","","","",filter$,mode="client,style=style")
    if pos("::"=clientfile$) then icon!.setText(""); return
    tc! = bbjapi().getThinClient()
    fs! = tc!.getClientFileSystem()
    cf! = fs!.getClientFile(clientfile$)

    rem ' The Java Swing GUI client doesn't understand data urls
    if (info(3,6)="5" or info(3,6)="6") then
        bytes! = cf!.getContents()
        base64$=java.util.Base64.getMimeEncoder().encode(bytes!)
        url$ = "data:image/png;base64,"+base64$
        icon!.setText(url$)
    else
        imagefile$ = cf!.copyFromClient()
        icon!.setText(imagefile$)
    endif
return

See Also

DWC Component: dwc-dialog

Alphabetic Listing - Functions

GETS Mnemonic - Create Message Dialog

MSGBOX() Function