BBjCEdit::getMaxLength

Description

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

Syntax

Return Value

Method

int

getMaxLength()

Parameters

None.

Return Value

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

Remarks

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

Example

rem ' BBjCEdit::getMaxLength Example

rem ' BBjCEdit Limits
maxLen = 256
maxParLen = 64
maxParNum = 10
text$ = "The quick brown fox jumps over the lazy dog."
sysgui! = bbjapi().openSysGui("X0")
window! = sysgui!.addWindow(50,50,540,440,"CEdit")
window!.setCallback(window!.ON_CLOSE,"eoj")
overtype! = window!.addCheckBox(101,20,20,100,25,"Overtype",$$)
overtype!.setCallback(overtype!.ON_CHECK_ON,"overtype_on")
overtype!.setCallback(overtype!.ON_CHECK_OFF,"overtype_off")
cedit! = window!.addCEdit(102,20,55,500,245,text$,$0004$)
cedit!.setCallback(cedit!.ON_EDIT_MODIFY,"status")
cedit!.setMaxLength(maxLen)
cedit!.setLineCountLimit(maxParNum)
cedit!.setMaxParagraphSize(maxParLen)

rem ' max length
window!.addStaticText(103,1,315,95,25,"Max Length:",$8000$)
maxLen! = window!.addInputNSpinner(104,100,310,100,25)
maxLen!.setMinimum(1)
maxLen!.setText(str(maxLen))
maxLen!.setCallback(sysgui!.ON_SPIN,"maxLen")
window!.addStaticText(105,201,315,95,25,"Curr Length:",$8000$)
currLen! = window!.addStaticText(106,300,315,220,20,"",$$)
currLen!.setBackColor(bbjapi().makeColor(255,255,255))

rem ' max number of paragraphs
window!.addStaticText(107,1,345,95,25,"Max Par Count:",$8000$)
maxParNum! = window!.addInputNSpinner(108,100,340,100,25)
maxParNum!.setMinimum(1)
maxParNum!.setText(str(maxParNum))
maxParNum!.setCallback(sysgui!.ON_SPIN,"maxParNum")
window!.addStaticText(109,201,345,95,25,"Curr Par Count:",$8000$)
currParNum! = window!.addStaticText(110,300,345,220,20,"",$$)
currParNum!.setBackColor(bbjapi().makeColor(255,255,255))

rem ' max paragraph size
window!.addStaticText(111,1,375,95,25,"Max Par Size:",$8000$)
maxParLen! = window!.addInputNSpinner(112,100,370,100,25)
maxParLen!.setMinimum(1)
maxParLen!.setText(str(maxParLen))
maxParLen!.setCallback(sysgui!.ON_SPIN,"maxParLen")
window!.addStaticText(113,201,375,95,25,"Curr Par Sizes:",$8000$)
currParLen! = window!.addStaticText(114,300,375,220,50,"",$$)
currParLen!.setBackColor(bbjapi().makeColor(255,255,255))
gosub status
process_events

eoj:
release

overtype_off:
    cedit!.setOvertypeMode(0)
return

overtype_on:
    cedit!.setOvertypeMode(1)
return

status:
    currLen!.setText(str(cedit!.getText().length()))
    currParNum!.setText(str(cedit!.getNumberOfParagraphs()))
    vector! = cedit!.getAllParagraphs()
    currParLen$ = ""

    if (vector!.size()) then
        for par = 0 to vector!.size() - 1
            if (par > 0) then
                currParLen$ = currParLen$ + ", "
            endif

            len$ = str(len(vector!.get(par)))
            currParLen$ = currParLen$ + str(par) + "=" + len$
        next par
    endif

    currParLen!.setText(currParLen$)
return

maxLen:
    event! = sysgui!.getLastEvent()
    maxLen = num(event!.getText())
    cedit!.setMaxLength(maxLen)
return

maxParLen:
    event! = sysgui!.getLastEvent()
    maxParLen = num(event!.getText())
    cedit!.setMaxParagraphSize(maxParLen)
return

maxParNum:
    event! = sysgui!.getLastEvent()
    maxParNum = num(event!.getText())
    cedit!.setLineCountLimit(maxParNum)
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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