scrollbarDrag question...

Garrett Hylltun garrett at paraboliclogic.com
Fri Mar 31 01:30:15 EST 2006


Ken Ray wrote:

[snip]
>> Is there a way to find out which scrollbar sent the message?
> 
> Well, you could store the current hScroll and vScroll values in a custom
> property, and then when you get the scrollbarDrag message, compare the
> hScroll and vScoll against the stored values. Whichever one changed is the
> culprit. Then just make sure to set your custom properties to the new values
> so you can check the next time...
> 
> I'm curious, though - why would you need to know which sent the message?

In my endeavor to make a routine for syntax highlighting for a HTML 
document in a field, I've tried various ideas.  Initially I was scanning 
the entire document each time a change was made in the field, and this 
proved to be a very bad idea.  I was also scanning the entire document 
when loading the html file, great for small files, but a very noticeable 
delay when trying to load a very large html file.

I have come up with what I think is a good routine for checking when a 
change is made in the field, so that's taken care of, but I had an idea 
earlier today about when loading the html file into the editor.

Instead of scanning the entire document on loading it, I want to scan 
only the text that is just below the view of the user.  So as the user 
scrolls, I want to scan a few lines below the users view.  This way it 
doesn't take a lot of time scanning and highlighting the entire document 
on initial loading, it only takes a microsecond to scan just below the 
view of the user.  I have no problem coming up with the code to actually 
do this, but when I found out that I could not tell which scroll bar was 
at work, I couldn't move on.

I'll give your suggestion a try.  Looks like Richard Gaskin has an idea 
also for this.  So maybe between your suggestion and his I might be able 
to accomplish this  :-)

Thanks a bunch,
-Garrett



More information about the use-livecode mailing list