Scroll increment

Paul Hibbert paulhibbert at mac.com
Tue Dec 31 19:58:44 EST 2013


John,

That seems to work pretty well, except the pass rawKeyDown was over-riding the effect for me, but adding an else condition to the first if statement cured the problem here…

   …end if

   else
      pass rawKeyDown -- if you wan to be able to type in the field
   end if
end rawKeyDown

This stops the rawKeyDown message from being sent if the scroll wheel (touch) is in use, but not if you type in the field.

Paul


On 2013-12-31, at 4:01 PM, John <john at onechip.com> wrote:

>   I inadvertently left in a line for debug in my previous posting.  The cleaner version of it is:
> 
> local keyCount, startMilliSec
> on rawKeyDown pKey
>   local accel
> 
>   if pKey = "65308" or pKey = "65309" then  -- if it is the scroll wheel
> 
>      if startMilliSec + 75 < the milliseconds then -- if our timer has expired scroll the field
>         put the milliseconds into startMilliSec    -- get a new time value
> 
>         put item keycount of "1,2,4,7,25,50,150,250,400,800" into accel -- calculate an accel curve
> 
>         if pKey = "65308" then set the vScroll of me to the vScroll of me + accel -- Scrolls down
>         if pKey = "65309" then set the vScroll of me to the vScroll of me - accel -- Scrolls Up
> 
>         -- If there is a scroll bar sitting next to the field that should be updated
>         set the thumbPosition of scrollbar "scroll position" to (the endValue of scrollbar "scroll position") \
>         *(the vscroll of me / (the textheightsum of me - the height of me))
> 
>         put 0 into keyCount -- reset the 'frequency' counter
>      end if
> 
>      if startMilliSec + 75 > the milliseconds then -- if we are in our timerperiod
>         add 1 to keycount  -- sum the the number of events
>      end if
> 
>   end if
> 
>   pass rawKeyDown -- if you wan to be able to type in the field
> end rawKeyDown
> 
> Thanks,
> John
> 
> On Dec 31, 2013, at 12:38 PM, John <John at OneChip.com> wrote:
> 
>>  I was hoping there was something I was missing (a property for instance) that set the “scroll increment” but it looks there isn’t.  I will try to roll my own to try and get closer to a native feel.  If it works out I will report back to the list.
>> 
>> Jaque,
>> 
>> I am using a magic mouse as well.  It wasn’t how fast the field scrolled (that is proportional to my finger speed), it was how finely grained the scrolling is.  When moving my finger slowly on a tall field (1000 px high) the field jumps in 10 text line increments.  On a short field (100 px high) the field jumps one line at a time.  Using a native app (Preview for instance) there is no “jumping” behavior at all.  Testing with a “click wheel” mouse on a native app does result in discrete jumps, one for every click.
>> 
>> 
>> Paul,
>> 
>> Thanks much for the head start, I will start with what you have and see if I can add accelerated scrolling in the like.
>> 
>> 
>> Thanks,
>> John
>> 
>> 
>> On Dec 31, 2013, at 11:19 AM, Paul Hibbert <paulhibbert at mac.com> wrote:
>> 
>>> Jacque,
>>> 
>>> Same issues with different mice (here at least).
>>> 
>>> John,
>>> 
>>> You could try setting the scroll rate yourself, I tried the following scripts and it worked, but I didn't have time to figure out the accelerated scrolling that users may expect…
>>> 
>>> -- Add this command to the script of each scrolling field
>>> on rawKeyDown pKey
>>> put the long name of me into tField
>>> scrollRatePref pKey,tField
>>> end rawKeyDown
>>> 
>>> -- Add this command to your stack or card script
>>> command scrollRatePref pKey,pField
>>> -- Add a temporary scrollBar to make testing easier, then just hard code tScrollRate
>>> -- when you find the value that suits you, or set it up as a user preference. Try a value of 8 for starters.
>>> 
>>> put the thumbPos of sb "tempScrollRate" into tScrollRate
>>> 
>>> if pKey = "65308" then set the vScroll of pField to the vScroll of pField + tScrollRate -- Scrolls down
>>> if pKey = "65309" then set the vScroll of pField to the vScroll of pField - tScrollRate -- Scrolls Up
>>> 
>>> end scrollRatePref
>>> 
>>> If your field scrolls horizontally, 65310 scrolls right & 65311 scrolls left.
>>> 
>>> There are probably many better ways and lots more options, but this demonstrates the point.
>>> 
>>> Paul
>>> 
>>> 
>>> On 2013-12-31, at 10:39 AM, J. Landman Gay <jacque at hyperactivesw.com> wrote:
>>> 
>>>> On 12/30/13 11:52 PM, John wrote:
>>>>> 
>>>>> The standard scrolling field in liveCode supports the a mouse scroll
>>>>> wheel.  What is a bit unusual is that the height of the field
>>>>> dictates how far the field “hops” as you scroll. In short fields (50
>>>>> high) the field “jumps” in ½ character height increments (assuming
>>>>> the default font and size are used).  In 100 high fields it is one
>>>>> line at a time increasing to 10 lines at a time when the field is
>>>>> 1000 high.
>>>> 
>>>> I think this may depend on your mouse and the OS. On my Mac using a magic mouse the amount of scroll depends on how fast I move my finger. On a mouse with a fixed scroll wheel it's probably different and may depend on the number of messages the scroll wheel sends for each change.
>>>> 
>>>> I'm just guessing, so it would be interesting to see if you get different results with a different mouse.
>>>> 
>>>> -- 
>>>> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
>>>> HyperActive Software           |     http://www.hyperactivesw.com
>>>> 
>>>> 
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the Use-livecode mailing list