From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: fabien.fleutot@inria.fr
Cc: caml-list@inria.fr
Subject: Re: Scrolling canvases in LablTk 3.00
Date: Mon, 21 Aug 2000 09:00:58 +0900 [thread overview]
Message-ID: <20000821090058V.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: Your message of "Thu, 17 Aug 2000 11:57:46 +0200" <200008170957.e7H9vkw07841@faure.inria.fr>
> I can't figure how to add a scrollbar to a canvas; here is my code:
>
> ------------------------------------
>
> open Tk
> open Printf
>
> let _ =
> let win = openTk() in
> let c = Canvas.create win ~width:2560 ~height:100 in
> let s = Scrollbar.create win ~orient:`Horizontal in
>
> (* draw clearer and clearer gray strips on the canvas. *)
> for i = 0 to 255 do
> let color = `Color (sprintf "#%02x%02x%02x" i i i) in
> ignore(Canvas.create_rectangle c ~x1:(i*10) ~x2:(i*10+10) ~y1:0 ~y2:99
> ~fill:color)
> done ;
>
> Canvas.configure c ~xscrollcommand:(Scrollbar.set s) ;
> Scrollbar.configure s ~command:(Canvas.xview c) ;
>
> place c ~x:0 ~y:0;
> place s ~x:0 ~y:100 ~relwidth:1.;
> Wm.geometry_set win "300x125" ;
> mainLoop()
>
> ------------------------------------
You should use the ~scrollregion option:
Canvas.create win ~width:300 ~height:100 ~scrollregion:(0,0,2560,100)
Then you don't need the Wm.geometry_set anymore.
---------------------------------------------------------------------------
Jacques Garrigue Kyoto University garrigue at kurims.kyoto-u.ac.jp
<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>
prev parent reply other threads:[~2000-08-21 9:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-08-17 9:57 Fabien Fleutot
2000-08-21 0:00 ` Jacques Garrigue [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20000821090058V.garrigue@kurims.kyoto-u.ac.jp \
--to=garrigue@kurims.kyoto-u.ac.jp \
--cc=caml-list@inria.fr \
--cc=fabien.fleutot@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox