Page 1 of 1

scrolling list field abnormal behaviour

Posted: Wed Jun 04, 2014 11:23 am
by robm80
With this script I renew the scrolling list field "index".
It worked perfectly until my "dabasbase" contents 48 lines.
From now on when clicking the button, the index freezes, gets pale and is in strike and I have to start anew, with the same result.
Why?

on mouseUp
filter fld "index" with empty
put the number of lines of fld "DB1" of cd "DB" into tNum
repeat with i = 1 to tNum
put item 1 of line i of fld "DB1" of cd "DB" &cr after fld "index"
end repeat
put number of lines of fld "index" && "namen" into field "zoeknamen"
end mouseUp

thanks, Rob

Re: scrolling list field abnormal behaviour

Posted: Wed Jun 04, 2014 11:54 am
by Klaus
Hi Rob,

the script looks OK!?

Maybe you can find WHERE exactly the freeze happens by adding some anwser dialogs,
so you can see what has been executed and what not to get a little hint:

Code: Select all

on mouseUp 
  filter fld "index" with empty
  answer "filtered"

  ## Accessing FIELDS has a lot of overhead, so better access the CONTENT directly:
  put fld "DB1" of cd "DB" into tDB1
  put the number of lines of tDB1 into tNum
  answer "got data. number of lines:" && tNum

  repeat with i = 1 to tNum

    ## Same here, so better collect the new data in a variable and 
    ## add the data "en bloc" to the field
    put item 1 of line i of tDB1 & cr after tNewIndices
  end repeat 
  put tNewIndices AFTER fld "index"
  answer "new indices" 

  put THE number of lines of fld "index" && "namen" into field "zoeknamen"
end mouseUp
Please try this and tell us what answer dialog actually appeared.


Best

Klaus

Re: scrolling list field abnormal behaviour

Posted: Wed Jun 04, 2014 9:42 pm
by robm80
Hi Klaus:
The script:
on mouseUp
filter fld "index" with empty
answer "filtered"

## Accessing FIELDS has a lot of overhead, so better access the CONTENT directly:
put fld "DB1" of cd "DB" into tDB1
put the number of lines of tDB1 into tNum
answer "got data. number of lines:" && tNum

repeat with i = 1 to tNum
## Same here, so better collect the new data in a variable and
## add the data "en bloc" to the field
put item 1 of line i of tDB1 & cr after tNewIndices
end repeat

SO FAR SO GOOD, BUT HERE THE FIELD FREEZES, WHOLE LIVECODE FREEZES AND HAS TO BE SHUT DOWN

put tNewIndices AFTER fld "index"
answer "new indices"

put THE number of lines of fld "index" && "namen" into field "zoeknamen"
end mouseUp


But now something awkward:
put the number of lines of tDB1=48
put NUMBER OF LINES of fld "index"=46
and clicking the last line of field "index" gives 44


What can I do to repear this?

Re: scrolling list field abnormal behaviour

Posted: Wed Jun 04, 2014 9:50 pm
by robm80
PS:
when I add the line where the trouble begon,in the content, to add it as the last line of field index' it responds normally and gives as linenumber 45 :!: :!: :?: :?:

Re: scrolling list field abnormal behaviour

Posted: Thu Jun 05, 2014 2:47 am
by robm80
Very simple repair.
Thinking all over, it must have been that I had added some empty lines in fld "DB1".
So with "filter fld "DB1" without empty" the abnormal behaviour became normal again.

Re: scrolling list field abnormal behaviour

Posted: Thu Jun 05, 2014 1:13 pm
by Klaus
Hi Rob,

so no more FREEZEing of Livecode?


Best

Klaus