BBjEditBox::setMaxLength

Description

In BBj 11.00 and higher, this method returns the maximum length of the text in a BBjEditBox control.

Syntax

Return Value

Method

int

getMaxLength()

Parameters

None.

Return Value

Returns the maximum length of the text in the BBjEditBox control.

Remarks

If no maximum length is specified, it defaults to 2^31-1 (2147483647) characters.

Example

open (sysgui)"X0"

sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(50,50,300,200,"Login",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.addStaticText(101,10,50,80,25,"User:",$8000$)
username! = window!.addEditBox(102,100,50,190,25,"",$0000$)
username!.setMaxLength(8)
window!.addStaticText(103,10,100,80,25,"Password:",$8000$)
password! = window!.addEditBox(104,100,100,190,25,"",$0400$)
password!.setMaxLength(16)
login! = window!.addButton(1,100,150,80,25,"Login",$$)
login!.setCallback(login!.ON_BUTTON_PUSH,"login")
cancel! = window!.addButton(2,190,150,80,25,"Cancel",$$)
cancel!.setCallback(cancel!.ON_BUTTON_PUSH,"eoj")

print "Maximum length of username is",username!.getMaxLength()
print "Maximum length of password is",password!.getMaxLength()

username!.focus()

process_events

login:
    if username!.getText().length() = 0 then return
    if password!.getText().length() = 0 then return
    login$ = "Username: "+username!.getText()
    login$ = login$ + ", password: "+password!.getText()
    i = msgbox(login$,0,"Logging in")

eoj:
release

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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