<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">
<p class="MsoNormal"><span style=""></span><font size="3"><span style="font-size: 10pt;">We need to create a single text% object and display it in two
editor-canvas%es, and have them scroll relative to each other. Our code thus far is below. We can get the one text% object to the two editor-canvas%es, and we can scroll them independently. </span></font><font size="3"><span style="font-size: 10pt;">However, we can't get the two editor-canvas%es to scroll relative to each other. </span></font><font size="3"><span style="font-size: 10pt;">Any ideas about how to go about doing this?</span><span style=""></span></font></p>
<p class="MsoNormal"><font size="3"><span style=""><br></span></font></p>
<p class="MsoNormal"><font size="3"><span style="font-size: 10pt;">Thank you,</span><span style=""></span></font></p>
<p class="MsoNormal"><font size="3"><span style="font-size: 10pt;">Leslie Gerhat</span><span style=""></span></font></p>
</div></div></div><br>
<p class="MsoPlainText">(require (lib "class.ss")</p>
<p class="MsoPlainText"><span style=""> </span>(lib
"mred.ss" "mred"))</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(define lorem-ipsum</p>
<p class="MsoPlainText"><span style=""> </span>"Lorem ipsum
dolor sit amet, consectetuer adipiscing elit. Mauris ultrices. Ut rutrum lacus
quis tortor. Cras commodo massa vel nisl.</p>
<p class="MsoPlainText">Phasellus porta malesuada nulla. Cras quis tortor.
Pellentesque ut urna. Integer ipsum elit, pulvinar sollicitudin, pulvinar et,
feugiat nec, turpis. Aliquam accumsan. Aenean bibendum turpis at nisl. Aliquam
in augue et felis bibendum vulputate. Nunc non arcu.</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Donec erat arcu, tempor sit amet, posuere sit amet, dignissim
ac, enim. Donec eget tellus. Suspendisse hendrerit arcu posuere magna. Sed non
purus eu libero molestie consectetuer. Nunc id ligula vel ipsum cursus
consectetuer. Nullam tristique porttitor lorem. Sed odio dolor, venenatis in,
mollis eu, elementum id, enim. Sed varius varius leo.</p>
<p class="MsoPlainText">Mauris eleifend nonummy est. Morbi ut mi. Curabitur eget
libero.</p>
<p class="MsoPlainText">Phasellus leo urna, volutpat sed, laoreet vel, semper ac,
mauris.</p>
<p class="MsoPlainText">Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas.</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Fusce ut massa ac risus porta eleifend. Mauris non enim.
Pellentesque consequat, lacus quis tempus sollicitudin, lectus elit tempor
orci, a tempor dolor felis et nunc. Sed eget nunc quis metus tempus mattis.</p>
<p class="MsoPlainText">Donec aliquet euismod velit. Nullam sit amet eros. Mauris
dui. Aliquam ligula enim, commodo vitae, imperdiet quis, convallis id, ante.</p>
<p class="MsoPlainText">Curabitur sit amet metus quis nulla euismod tincidunt.
Integer interdum. Vestibulum bibendum, velit imperdiet faucibus ullamcorper,
libero eros ornare sem, sed commodo justo quam a sem. Vestibulum nunc.</p>
<p class="MsoPlainText">In tincidunt pede at pede. Duis ante lacus, sodales ac,
lacinia vel, commodo at, ipsum. Phasellus malesuada. Ut malesuada dolor.
Quisque dolor ante, blandit in, faucibus id, laoreet nec, libero.</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Vestibulum adipiscing mollis nisi. Aliquam nec sem eget
tortor suscipit mattis. Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas. Phasellus et massa. Sed nunc nulla,
lobortis quis, tincidunt sed, fringilla at, enim. Ut varius pharetra erat.
Phasellus pharetra nulla sed felis. Nulla facilisi. Vestibulum vulputate nisi a
quam. Suspendisse fringilla odio vitae purus. Sed dapibus nonummy justo.
Integer mollis ligula vel odio sollicitudin euismod. Fusce vel turpis. Aliquam
semper lacinia diam.</p>
<p class="MsoPlainText">Mauris fermentum, pede nec rhoncus vehicula, lorem turpis
cursus diam, a tempor ligula justo vulputate tortor. Sed sodales orci ut metus.
Sed et tortor.")</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(define f (new frame%</p>
<p class="MsoPlainText"><span style="">
</span>(label "Foo")</p>
<p class="MsoPlainText"><span style=""> </span><span style=""> </span>(min-width 800)</p>
<p class="MsoPlainText"><span style="">
</span>(min-height 400)</p>
<p class="MsoPlainText"><span style=""> </span>))</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(define v (new vertical-pane%</p>
<p class="MsoPlainText"><span style="">
</span>(parent f)))</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(define h (new horizontal-pane%</p>
<p class="MsoPlainText"><span style="">
</span>(parent v)</p>
<p class="MsoPlainText"><span style=""> </span>))</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(define txt (new text%</p>
<p class="MsoPlainText"><span style=""> </span><span style=""> </span>(auto-wrap #t)</p>
<p class="MsoPlainText"><span style=""> </span>))</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(define left (new editor-canvas%</p>
<p class="MsoPlainText"><span style="">
</span>(parent h)</p>
<p class="MsoPlainText"><span style="">
</span>(editor txt)</p>
<p class="MsoPlainText"><span style="">
</span>(style '(hide-vscroll))</p>
<p class="MsoPlainText"><span style="">
</span>(min-width 300)</p>
<p class="MsoPlainText"><span style="">
</span>(min-height 350)</p>
<p class="MsoPlainText"><span style="">
</span>(scrolls-per-page 1)</p>
<p class="MsoPlainText"><span style="">
</span>))</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(define space (new horizontal-panel%</p>
<p class="MsoPlainText"><span style="">
</span>(parent h)</p>
<p class="MsoPlainText"><span style="">
</span>(min-width 100)))</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(define right (new editor-canvas%</p>
<p class="MsoPlainText"><span style="">
</span>(parent h)</p>
<p class="MsoPlainText"><span style="">
</span>(editor txt)</p>
<p class="MsoPlainText"><span style="">
</span>(min-width 300)</p>
<p class="MsoPlainText"><span style="">
</span>(min-height 350)))</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(define start (box 0))</p>
<p class="MsoPlainText">(define end (box 0))</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(define b (new button%</p>
<p class="MsoPlainText"><span style="">
</span>(parent v)</p>
<p class="MsoPlainText"><span style="">
</span>(label "Extent")</p>
<p class="MsoPlainText"><span style="">
</span>(callback</p>
<p class="MsoPlainText"><span style="">
</span>(lambda (w e)</p>
<p class="MsoPlainText"><span style="">
</span>(define last (send txt last-position))</p>
<p class="MsoPlainText"><span style="">
</span>(printf "~a~n" last)</p>
<p class="MsoPlainText"><span style="">
</span>(send txt get-visible-position-range start end #f)</p>
<p class="MsoPlainText"><span style="">
</span>(printf "~a, ~a~n"</p>
<p class="MsoPlainText"><span style="">
</span>(unbox start)</p>
<p class="MsoPlainText"><span style=""> </span><span style=""> </span>(unbox end))))))</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(send f show #t)</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(send txt insert lorem-ipsum)</p>
<p class="MsoPlainText">;; Scroll the text to the top; this gets everything.</p>
<p class="MsoPlainText">(send txt scroll-to-position 0 #f 'same 'none)</p><br><p class="MsoPlainText"><br></p><br>At Tue, 13 Nov 2007 17:15:58 -0800 (PST), Leslie Gerhat wrote:<br>> We are creating an eBook reader program and are having some
difficulties with <br>> our GUI. In particular, we would like the area which displays the
text to <br>> look like a book with two text% objects corresponding to the right
and left <br>> pages. We have created these two objects; however we are unable to
fill them <br>> appropriately. We need to feed text into the left text% object until
the <br>> snips are no longer visible. At that point, we need to start filling
the <br>> right text% object. Then, once the user has read these two columns,
they need <br>> to be able to "turn the page" and repeat the fill processes with the
next "two <br>> pages" of text. We have tried breaking our single string of text
into list <br>> objects representing a "page," but because we are using a
proportional font, <br>> the number of characters per "page" is inconsistent and we have no
good way of <br>> generating these list objects. We also considered making each word
or newline <br>> into a structure, carrying a field<br>> corresponding to the word's index in the complete text. However, we
ran into <br>> issues when trying to put these into the text% object. Specifically,
we <br>> couldn't figure out how to tell whether or not the word was visible.
We tried <br>> to use the (get-visible-position-range) function, but it<br>> doesn't actually return an integer value that can be compared to the<br>> current position. We are looking for any advice with our approach to
this <br>> problem. Thank you in advance for your help.<br>> <br>> Leslie Gerhat<br>
</div></div><br>
<hr size=1>Be a better sports nut! Let your teams follow you
with Yahoo Mobile. <a href="http://us.rd.yahoo.com/evt=51731/*http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
">Try it now.</a></body></html>