Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!apple!agate!ziploc!eps From: eps@toaster.SFSU.EDU (Eric P. Scott) Newsgroups: comp.sys.next Subject: Re: How to get graphics into scrolling textvew in IB Message-ID: <1751@toaster.SFSU.EDU> Date: 17 Jun 91 10:24:03 GMT References: <1157.285b7b92@amy.skidmore.edu> Reply-To: eps@cs.SFSU.EDU (Eric P. Scott) Organization: San Francisco State University Lines: 55 In article <1157.285b7b92@amy.skidmore.edu> tholland@amy.skidmore.edu writes: >Does anyone know how to get graphics into a scrolling text view >in IB ? There are basically three ways to create ScrollViews in IB: 1) Dragging a ScrollView+Text from the fourth standard palette; 2) Dragging a CustomView from the third standard palette, and changing it into a ScrollView with the Attributes Inspector; 3) Selecting "Group in ScrollView" from the Layout menu. The easiest way to do what you want is probably (1) and perform replaceSelWithCell: on the ScrollView's docView at run time. Try this: Create a Window containing a ScrollView+Text. Drag a Format> to your main menu (maybe a Services> as well). You want to have fun with your text. :-) Create a Button containing the image you want displayed. (If you don't have one, just use something handy, like NXdefaulticon. Remember to click Title under Icon Position to change it to Icon.) Turn off its Bordered attribute, and click Disabled. Resize if necessary. Click Layout>Send To Back. Then set its Transparent attribute. Don't panic! Create an outlet for the Button ("myButton") Create an outlet for the ScrollView ("myScrollView") Create an action, which you'll connect to from some sort of trigger (such as another button or a menu item). After you've created a project and unparsed, add the code [[myScrollView docView] replaceSelWithCell: [[[myButton cell] copy] setTransparent:NO]]; to that action. Compile your test application, and play with it. This will give you a feel for how embedded graphic objects behave. N.B.: this isn't the "right" (or the best) way to do this sort of thing; I've taken a rather expedient approach. Read the documentation for the Text object before doing this in production code--I've left out a lot of subtle details. > Can I get the scrolling text views to support rtf ? Sure. In the Attributes Inspector, make sure Monofont is NOT checked. This is a prerequisite for being able to embed graphic objects. -=EPS=-