Lisp HUG Maillist Archive

How to determine if pane is scrolled

Is there a simple capi way to determine if a pane is scrolled? Or do I 
use something like:

(defun pane-is-scrolled-p (pane orientation)
   "t if the pane is scrolled. Orientation is :horizontal or :vertical"
   (multiple-value-bind (min-range max-range slug-size)
       (if (eql orientation :horizontal)
         (capi:get-horizontal-scroll-parameters pane :min-range 
:max-range :slug-size)
         (capi:get-vertical-scroll-parameters pane :min-range :max-range 
:slug-size))
     (/= (- max-range min-range)
         slug-size)))

Mitch


Re: How to determine if pane is scrolled

I'm not sure to well understand your question but isn't simply the fact that
%scroll-x% or %scroll-y% is non equal to zero ?
For instance :
(with-geometry pane
  (case orientation
    (:horizontal (and  %scroll-x% (not (zerop %scroll-x%))))
    (t (and  %scroll-y% (not (zerop %scroll-y%))))))

Best 

Denis


Le 5/02/08 15:21, « [NOM] » <[ADRESSE]> a écrit :

> 
> Is there a simple capi way to determine if a pane is scrolled? Or do I
> use something like:
> 
> (defun pane-is-scrolled-p (pane orientation)
>    "t if the pane is scrolled. Orientation is :horizontal or :vertical"
>    (multiple-value-bind (min-range max-range slug-size)
>        (if (eql orientation :horizontal)
>          (capi:get-horizontal-scroll-parameters pane :min-range
> :max-range :slug-size)
>          (capi:get-vertical-scroll-parameters pane :min-range :max-range
> :slug-size))
>      (/= (- max-range min-range)
>          slug-size)))
> 
> Mitch
> 

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------



Re: How to determine if pane is scrolled

Sorry for the sloppy description. What I am interested in knowing is 
whether a scroll-bar is displayed. So even if the slug position is 0, if 
the slug-width is less than the scroll range, it is possible to move the 
slug and scroll the pane.

Mitch

Denis Pousseur wrote:
> I'm not sure to well understand your question but isn't simply the fact that
> %scroll-x% or %scroll-y% is non equal to zero ?
> For instance :
> (with-geometry pane
>   (case orientation
>     (:horizontal (and  %scroll-x% (not (zerop %scroll-x%))))
>     (t (and  %scroll-y% (not (zerop %scroll-y%))))))
> 
> Best 
> 
> Denis
> 
> 
> Le 5/02/08 15:21, « [NOM] » <[ADRESSE]> a écrit :
> 
>> Is there a simple capi way to determine if a pane is scrolled? Or do I
>> use something like:
>>
>> (defun pane-is-scrolled-p (pane orientation)
>>    "t if the pane is scrolled. Orientation is :horizontal or :vertical"
>>    (multiple-value-bind (min-range max-range slug-size)
>>        (if (eql orientation :horizontal)
>>          (capi:get-horizontal-scroll-parameters pane :min-range
>> :max-range :slug-size)
>>          (capi:get-vertical-scroll-parameters pane :min-range :max-range
>> :slug-size))
>>      (/= (- max-range min-range)
>>          slug-size)))
>>
>> Mitch
>>


Re: How to determine if pane is scrolled

I suppose you can do this by compare the width (or height) of the pane with
the %scroll-width% (or %scroll-height%) of the same 'with-geometry' macro

Best 

Denis


Le 5/02/08 18:05, « [NOM] » <[ADRESSE]> a écrit :

> Sorry for the sloppy description. What I am interested in knowing is
> whether a scroll-bar is displayed. So even if the slug position is 0, if
> the slug-width is less than the scroll range, it is possible to move the
> slug and scroll the pane.
> 
> Mitch
> 
> Denis Pousseur wrote:
>> I'm not sure to well understand your question but isn't simply the fact that
>> %scroll-x% or %scroll-y% is non equal to zero ?
>> For instance :
>> (with-geometry pane
>>   (case orientation
>>     (:horizontal (and  %scroll-x% (not (zerop %scroll-x%))))
>>     (t (and  %scroll-y% (not (zerop %scroll-y%))))))
>> 
>> Best 
>> 
>> Denis
>> 
>> 
>> Le 5/02/08 15:21, « [NOM] » <[ADRESSE]> a écrit :
>> 
>>> Is there a simple capi way to determine if a pane is scrolled? Or do I
>>> use something like:
>>> 
>>> (defun pane-is-scrolled-p (pane orientation)
>>>    "t if the pane is scrolled. Orientation is :horizontal or :vertical"
>>>    (multiple-value-bind (min-range max-range slug-size)
>>>        (if (eql orientation :horizontal)
>>>          (capi:get-horizontal-scroll-parameters pane :min-range
>>> :max-range :slug-size)
>>>          (capi:get-vertical-scroll-parameters pane :min-range :max-range
>>> :slug-size))
>>>      (/= (- max-range min-range)
>>>          slug-size)))
>>> 
>>> Mitch
>>> 
> 

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------



Updated at: 2020-12-10 08:44 UTC