Message-ID: <31B7226B.3F4B@mail.amsinc.com>
Date: Thu, 06 Jun 1996 14:24:43 -0400
From: "David W. Murrell IV" <david_murrell@mail.amsinc.com>
X-Mailer: Mozilla 2.0 (Win16; I)
MIME-Version: 1.0
Newsgroups: comp.lang.smalltalk
Subject: Re: VW2.5 - TableInterface dependencies
References: <4o33mm$8u8@dfw-ixnews2.ix.netcom.com> <4p25h1$6vo@newsbf02.news.aol.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: dmurrell.amsinc.com
Lines: 39
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!godot.cc.duq.edu!newsgate.duke.edu!news.mathworks.com!news.kei.com!newsfeed.internetmci.com!in2.uu.net!dns.amsinc.com!

Bmollett wrote:
> 
> In article <4o33mm$8u8@dfw-ixnews2.ix.netcom.com>, sauer@ix.netcom.com
> (Frank Sauer) writes:
> 
> >>Never mind, we were able to figure it out on our own.  Thanks anyway,
> but
> >>we do have another question: how do you tell a SelectionIntable (or
> >>SelectionInList for that matter) to set the current selection to show at
> >>the top of the table/window?
> >
> >>Thanks,
> >>Jeff L., Eric W.
> >
> >
> 
> The closest I could get to showing a selected row programmatically was the
> following, where I know that row #15 exists in my example:
> 
> postOpenWith: aBuilder
>         | pt |
>         pt := 1 @ 15. "column + row"
>         self tableInterface tableView makeFullyVisible: pt.
>         self tableInterface selectionIndex: pt
> 
> The row made fully visible is certain to be visible, but not necessarily
> at the top of the table widget. By setting the table widget property to
> select by row, setting the selection index also hilights the row.

Assuming #aTable is the component name of the table and itemIndex is the index
of the item you want to be at the top, the following will scroll an item to the top:

widget := ((self builder componentAt: (#aTable)) widget.
widget scrollTo: (0 @ (itemIndex - 1 * widget lineGrid) negated).

NOTE: If the table shows N records at a time and you have M records, it seems
the table cannot be scrolled past the point where index M-N+2 is at the top.

-- 
Dave Murrell
American Management Systems, Inc.
david_murrell@mail.amsinc.com
