jan@oscvax.UUCP (Jan Sven Trabandt) (02/21/88)
Howdy howdy. (I forgot this one in my last posting) According to the Intuition manual, in their example for a proportional gadget(vertical) they say: suppose a window shows 5 lines of a (max) 15 line file then set the VertBody to 0xFFFF / 3 = 0x5555 so that the auto-knob fills one-third of the container. This it does. However, clicking on the container, which is supposed to advance the VertPot by VertBody (ie 0 => 1/3 => 2/3 in real terms), causes the VertPot to effectively go 0 => 1/2 => 1 as if the 5 lines in the window showed part of the 4/3 of the file Did things change or am I just enterpreting things wrong. The upshot of this is that I have a similar situation: my window shows (say) 10 lines out of 100 possible. I set my VertBody to 1/10 of 0xFFFF but I get a similar thing happening as above. i.e. The VertPot goes all the way to 1 (0xFFFF) and thus tells me to display the 11th 1/10 of my lines [lines 101-110]. What should I be setting my VertBody to, or how can I compensate for this? (I also want to be able to take the VertPot value and figure out which line is supposed to be at the top of the window, and I want clicking on the container (not the knob) to advance the VertPot 1/10 of 0xFFFF properly). This is happening in a SMART_REFRESH window. Thanks in advance, Jan Sven. -------------------------------------------------------- "Violence is the last resort of the incompetent" - Hari Seldon, 'The Foundation Trilogy' (Isaac Asimov) Mind like parachute - function only when open! Jan (Jan, from Amsterdam) no-hyphen Sven Trabandt ...!{allegro,ihnp4,decvax,pyramid}!utzoo!oscvax!jan
bryce@eris (Bryce Nesbitt) (02/24/88)
In article <585@oscvax.UUCP> jan@oscvax.UUCP (Jan Sven Trabandt) writes: > >According to the Intuition manual, in their example for a proportional >gadget(vertical) they say... > >...Did things change or am I just enterpreting (sic) things wrong. I think things changed. Try using this: (From the "Amiga Enhancer Manual") Proportional Gadgets -------------------- Consider as an example scrolling a 25 line view of a 100 line display. In the following, the variables "visible_lines" and "total_lines" would take the values 25 and 100, respectively. The first relationship is easy: make the Body value represent "one-fourth." This can be expressed as VertBody = (ULONG)(visible_lines*0xFFFF)/total_lines; If you can special-case zero visible_lines, then this works: VertBody = ((ULONG)(visible_lines<<16) -1)/total_lines; Now, note that when you are displaying the last "page," line 75 is the top line in view (start line numbers from zero). Therefore, when the VertPot value is a maximum (0xFFFF) you need to convert this to 75, and so on. This can be done like so: top_line = ((ULONG)(total_lines-visible_lines)*VertPot+(1<<15))>>16; The inverse of this operation is needed if you wish to ini- tialize the pot for some particular value of top_lines. VertPot = MIN(0xFFFF, ((top_line_input<<16))/(total_lines-visible_lines)); The MIN macro is used because "unity" is actually 0xFFFF. |\_/| . ACK!, NAK!, EOT!, SOH! {O_o} . Bryce Nesbitt (") BIX: mleeds (temporarily) U USENET: bryce@eris.berkeley.EDU -or- ucbvax!eris!bryce