zhengt@mentor.cc.purdue.edu (Tong Zheng) (04/13/91)
Hello, I have two questions about doing Rubber Banding in InterViews. I believe I am using version 2.6. I am working on a project that offers user to draw a rubber banding box to select portion of a Graphic area. Well, I found a RubberRect class and implemented in my codes, I got the rectangular box, but had seen two problems, 1) When the program received a DownEvent, I created the RubberRect object, then if a MotionEvent arrives, method Track() will be used to erase previous box and draw a new box upon currect pointer position, UpEvent will terminate this rubber banding session. I think I follow the right track to form a rubber banding, but funny thing is I never am able to get a MotionEvent. So user can only see a box appearing at the end when the button is released. 2) The rubber box can't redraw itself when is exposed after a obscuring. For problem 1), has anyone had success to do a rubber banding or using MotionEvent? If so, is it possible that I can have a copy of a working sample? or could someone point out what I did wrong in my way drawing rubber banding? For problem 2), in X programming logic, I know client should handle the exposure. But in InterViews, there is no such a thing called ExposeEvent exists. Is there any alternative way to detect the exposure event in InterViews? Any help is appreciated. If there are enough interets, I will post a summary on this. --- * * |* Zheng, Tong | ARPA: tongz@ecn.purdue.edu *| |* 483 Littleton St., | UUCP: pur-ee!tongz *| |* West Lafayette, IN. 47906 | BITNET: *| |* (317)743-2239 | tongz%ecn.purdue.edu@purccvm *| |* ----------- *| |* -- student programmer, Mechanical Eng., Purdue University-- *| *----------------------------------------------------------------*
linton@marktwain.rad.sgi.com (Mark Linton) (04/14/91)
In article <10241@mentor.cc.purdue.edu>, zhengt@mentor.cc.purdue.edu (Tong Zheng) writes: |> I am working on a project that offers user to draw |> a rubber banding box to select portion of a Graphic |> area. Well, I found a RubberRect class and implemented |> in my codes, I got the rectangular box, but had seen |> two problems, |> |> 1) When the program received a DownEvent, I created the |> RubberRect object, then if a MotionEvent arrives, |> method Track() will be used to erase previous box |> and draw a new box upon currect pointer position, |> UpEvent will terminate this rubber banding session. |> I think I follow the right track to form a rubber banding, |> but funny thing is I never am able to get a MotionEvent. |> 2) The rubber box can't redraw itself when is exposed after a |> obscuring. Rubberbands are not interactors; their only purpose is to abstract objects that can be quickly drawn and erased (normally using xor). Therefore, rubberbands do not automatically get MotionEvents, you must catch them explicitly in the interactor that contains the rubberband. Similarly, if you want the rubberband to be redrawn upon exposure then you need to have your interactor's Redraw operation make sure to redraw the rubberband.