Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!wugate!uunet!microsoft!ericsc From: ericsc@microsoft.UUCP (Eric Schlegel) Newsgroups: comp.sys.mac.programmer Subject: Re: List manager and Think C Message-ID: <7579@microsoft.UUCP> Date: 1 Sep 89 16:16:26 GMT References: <5501@viscous.sco.COM> Reply-To: ericsc@microsoft.UUCP (Eric Schlegel) Organization: Microsoft Corp., Redmond WA Lines: 62 In article <5501@viscous.sco.COM> jamesm@sco.COM (James M. Moore) writes: >One question about lists: > >1. Is there any way to change the location of a list? There doesn't >seem to be a list manager call to do so. The code that I came up with to do this: #define dxyScroll (15) // scroll bar width #define DxRc(rc) ((rc).right - (rc).left) #define DyRc(rc) ((rc).bottom - (rc).top) // one of the instance variables of the LBOX class is // ListHandle lh; // SetRc(rcNew): set the location of the listbox // to be rcNew. RcNew INCLUDES the scroll bars; that is, // the list box inset from the sides of rcNew by the // width of a scroll bar. void LBOX::SetRc(Rect rcNew) { short dx; short dy; RgnHandle rgn; Rect rctT; /* by the way, everything between here and the */ /* LSize is completely unsanctioned by Apple. */ /* there is no List Manager interface to move the */ /* top left corner of a list. */ SetRect(&rctT, (*lh)->rView.left, (*lh)->rView.top, (*lh)->rView.right + dxyScroll, (*lh)->rView.bottom); EraseRect(&rctT); SetRect(&rctT, 0, 0, 0, 0); rgn = NewRgn(); GetClip(rgn); ClipRect(&rctT); dx = rcNew.xLeft - (*lh)->rView.left; dy = rcNew.yTop - (*lh)->rView.top; OffsetRect(&((*lh)->rView), dx, dy); (*lh)->clikLoc.h += dx; (*lh)->clikLoc.v += dy; if ((*lh)->vScroll != NULL) MoveControl((*lh)->vScroll, dx, dy); if ((*lh)->hScroll != NULL) MoveControl((*lh)->hScroll, dx, dy); SetClip(rgn); DisposeRgn(rgn); LSize(DxRc(rcNew) - dxyScroll, DyRc(rcNew) - dxyScroll, lh); } Eric Schlegel ---- Microsoft owns my code, but the opinions are my own.