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",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
enterAsTab! = window!.addCheckBox(101,20,20,100,25,"EnterAsTab",$$)
enterAsTab!.setCallback(enterAsTab!.ON_CHECK_ON,"enterAsTab_on")
enterAsTab!.setCallback(enterAsTab!.ON_CHECK_OFF,"enterAsTab_off")
ignoreEnter! = window!.addCheckBox(102,140,20,100,25,"ignoreEnter",$0004$)
ignoreEnter!.setCallback(ignoreEnter!.ON_CHECK_ON,"ignoreEnter_on")
ignoreEnter!.setCallback(ignoreEnter!.ON_CHECK_OFF,"ignoreEnter_off")
ignoreTab! = window!.addCheckBox(103,260,20,100,25,"ignoreTab",$$)
ignoreTab!.setCallback(ignoreTab!.ON_CHECK_ON,"ignoreTab_on")
ignoreTab!.setCallback(ignoreTab!.ON_CHECK_OFF,"ignoreTab_off")
overtype! = window!.addCheckBox(104,380,20,100,25,"Overtype",$$)
overtype!.setCallback(overtype!.ON_CHECK_ON,"overtype_on")
overtype!.setCallback(overtype!.ON_CHECK_OFF,"overtype_off")
cedit! = window!.addCEdit(105,20,55,500,245,text$,$0004$)
cedit!.setCallback(cedit!.ON_EDIT_MODIFY,"status")
cedit!.setMaxLength(maxLen)
cedit!.setLineCountLimit(maxParNum)
cedit!.setMaxParagraphSize(maxParLen)
cedit!.setIgnoreEnters(1); rem ' because ignoreEnter is checked on
rem ' max length
window!.addStaticText(106,1,315,95,25,"Max Length:",$8000$)
maxLen! = window!.addInputNSpinner(107,100,310,100,25)
maxLen!.setMinimum(1)
maxLen!.setText(str(maxLen))
maxLen!.setCallback(sysgui!.ON_SPIN,"maxLen")
window!.addStaticText(108,201,315,95,25,"Curr Length:",$8000$)
currLen! = window!.addStaticText(109,300,315,220,20,"",$$)
currLen!.setBackColor(bbjapi().makeColor(255,255,255))
rem ' max number of paragraphs
window!.addStaticText(110,1,345,95,25,"Max Par Count:",$8000$)
maxParNum! = window!.addInputNSpinner(111,100,340,100,25)
maxParNum!.setMinimum(1)
maxParNum!.setText(str(maxParNum))
maxParNum!.setCallback(sysgui!.ON_SPIN,"maxParNum")
window!.addStaticText(112,201,345,95,25,"Curr Par Count:",$8000$)
currParNum! = window!.addStaticText(113,300,345,220,20,"",$$)
currParNum!.setBackColor(bbjapi().makeColor(255,255,255))
rem ' max paragraph size
window!.addStaticText(114,1,375,95,25,"Max Par Size:",$8000$)
maxParLen! = window!.addInputNSpinner(115,100,370,100,25)
maxParLen!.setMinimum(1)
maxParLen!.setText(str(maxParLen))
maxParLen!.setCallback(sysgui!.ON_SPIN,"maxParLen")
window!.addStaticText(116,201,375,95,25,"Curr Par Sizes:",$8000$)
currParLen! = window!.addStaticText(117,300,375,220,50,"",$$)
currParLen!.setBackColor(bbjapi().makeColor(255,255,255))
gosub status
process_events
eoj:
release
enterAsTab_off:
window!.setEnterAsTab(0)
return
enterAsTab_on:
window!.setEnterAsTab(1)
return
ignoreEnter_off:
cedit!.setIgnoreEnters(0)
return
ignoreEnter_on:
cedit!.setIgnoreEnters(1)
return
ignoreTab_off:
cedit!.setIgnoreTabs(0)
return
ignoreTab_on:
cedit!.setIgnoreTabs(1)
return
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$ + ", "
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
|