Discussion:
Editor component is slow when loading and when moving to different line number
(too old to reply)
Ivar B. Jessen
2004-01-02 16:11:35 UTC
Permalink
The dBASE editor component is very slow when loading a file larger than around
20-40 Kb, but it is also slow when it has to move from one line to another
using form.editor1.lineNo.

Save the code below and run.

When the form opens I see a short flash of the file opened and displayed with
correct line lengths, then the editor displays the file as a single wrapped
line where the line breaks have been replaced by htlm-tags for paragraphs, all
this lasts about 27 seconds. After that the editor again displays the file
correctly but it takes about another 27 seconds before the cursor reappears.

Now grab the thumb of the vertical scrollbar and move it up and down. Note
that the lines displayed in the editor moves correspondingly without any delay
giving the impression that the editor.value has now been reformatted correctly
and is now sitting in memory ready to be displayed at a moments notice.

When I press the button 'Go to bottom' the editor moves quickly to the bottom
line, ie 'at a moments notice', but again it takes about 27 seconds before the
cursor reappears.

In the on_click event of the button, editor1.lineNo is set to 1426. If that is
changed to 2 it will also take 27 seconds to move from line 1 to line 2!


Ivar B. Jessen

//-----
//----- demoSearch.wfm ------
** END HEADER -- do not remove this line
//
// Generated on 02-01-2004
//
parameter bModal
local f
f = new demoSearchForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class demoSearchForm of FORM
with (this)
onOpen = class::FORM_ONOPEN
scroll = class::SCROLL
height = 15.3636
left = 7.7143
top = 2.1364
width = 91.0
text = ""
endwith

this.EDITOR1 = new EDITOR(this)
with (this.EDITOR1)
height = 13.0
left = 1.0
top = 0.5
width = 89.0
value = ""
marginHorizontal = 5.0
endwith

this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
onClick = class::PUSHBUTTON1_ONCLICK
height = 1.0909
left = 1.0
top = 14.0
width = 15.2857
text = "Go to bottom"
endwith

this.PUSHBUTTON2 = new PUSHBUTTON(this)
with (this.PUSHBUTTON2)
onClick = class::PUSHBUTTON2_ONCLICK
height = 1.0909
left = 19.0
top = 14.0
width = 15.2857
text = "Go to top"
endwith

this.TEXTLABEL1 = new TEXTLABEL(this)
with (this.TEXTLABEL1)
height = 1.0
left = 36.0
top = 14.0
width = 54.0
text = ""
endwith


function form_onOpen
cFile = _dbwinhome + "Samples\Contax\Scheduler.wfm"
f = new file()
f.open(cFile, "R")
cStr = f.read(f.size(cfile))

re = new oleautoclient("VBScript.RegExp")
re.ignoreCase = true
re.Global = true
re.pattern = "endclass"
re.execute(cStr)
form.editor1.evalTags = false
form.editor1.value = re.replace(cStr, "<b><u>$&</u></b>")
form.editor1.evalTags = true
return

function PUSHBUTTON1_onClick
class::scroll(1426)
return

function PUSHBUTTON2_onClick
class::scroll(1)
return

function scroll(gt)
form.textlabel1.text = ""
st = new date().getTime()

form.editor1.lineNo = gt

form.editor1.setfocus()
et = new date().getTime()
form.textlabel1.text = int((et - st)/1000)+ ;
" seconds for focus to return to editor!"
return
endclass
//----- EOF demoSearch.wfm -----
//-----
Ken Mayer [dBASE, Inc.]
2004-01-02 16:32:37 UTC
Permalink
Post by Ivar B. Jessen
The dBASE editor component is very slow when loading a file larger than around
20-40 Kb, but it is also slow when it has to move from one line to another
using form.editor1.lineNo.
Save the code below and run.
If it's doing any formatting it will slow down.

This is all related to QAID: 1760.

Ken
---
Ken Mayer [dBASE, Inc.]
** Please respond ONLY in the newsgroups **

"Think OOP"

dBASE, Inc. website: http://www.dbase.com
Ivar B. Jessen
2004-01-02 20:42:55 UTC
Permalink
On Fri, 02 Jan 2004 08:32:37 -0800 , in dbase.bug-reports , Re: Editor
component is slow when loading and when moving to different line number ,
Post by Ken Mayer [dBASE, Inc.]
If it's doing any formatting it will slow down.
Does this mean that it is reformatting the file when it moves one line down?
Post by Ken Mayer [dBASE, Inc.]
This is all related to QAID: 1760.
In quaid 1760 it is mentioned that the slowdown is less when the
ldriver=windows.

I changed to ldriver=windows and found that the reported delays of 27 seconds
were now down to 7 seconds, which stil makes the editor unuseable for the
purpose illustrated in the demo.


Ivar B. Jessen
Edmund
2004-02-29 06:53:15 UTC
Permalink
Post by Ken Mayer [dBASE, Inc.]
Post by Ivar B. Jessen
The dBASE editor component is very slow when loading a file larger than around
20-40 Kb, but it is also slow when it has to move from one line to another
using form.editor1.lineNo.
Save the code below and run.
If it's doing any formatting it will slow down.
This is all related to QAID: 1760.
But the formatting isn't doing a good job either.
You can simply change(programatically) one format
for a particular word and it doesn't update
until you disable evaltags and then re-enable it.

In any event, I'd like to Me_too whatever this
bug is filed as.

I have this in my test3.prg:

function checkInt(inInt)
local testvar

testvar = iff(inInt < 10, ;
'0'+str(inInt,1,0),;
ltrim(str(inInt,10,0)))

return testvar


Then I load that in the editor in the onOpen
event for the form via:


tf = new file()
tf.open('test3.prg',r')
q = ""
do while .not. tf.eof()
q += tf.gets()+chr(13)+chr(10)
enddo

this.editor1.value = q


Then if I have a button with the onclick event of:

q = this.parent.editor1.value
if at('testvar',q) > 0
p1 = left(q,at('testvar',q)-1)
p2 = right(q,q.length-at('testvar',q)-6)) //2nd part w/o
// testvar
q = p1+'<b>testvar</b>'+p2
endif
this.parent.editor1.value = q

This produces a badly formated text in the editor. I need to add
this.parent.editor1.evaltags = false before the if statement
and this.parent.editor1.evaltags = true after the if statement.

(this is actually a modified version that I posted in the
dbase.programming. Ivar pointed out this thread to me.)

Thanks
--
email: cc at kdtc dot nospam dot net (remove nospam for email)
Loading...