Results Table Viewing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Results Table Viewing

Adam Cliffe
Kind of a trivial macro writing problem....

If there are say 100 results in the results table, running
updateResults(); refreshes the results table but also scrolls the
window down to the last entry.
does anyone know an easy way to set the part of the results table
shown in the window? (i.e. so the first result is visible).

thanks

Adam


Dr Adam Cliffe
Research Scientist, Rorth Lab

Institute of Molecular and Cell Biology
61 Biopolis Drive
Proteos
Singapore 138673

tel: +65 6586 9731









Note: This message may contain confidential information. If this Email/Fax has been sent to you by mistake, please notify the sender and delete it immediately. Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Results Table Viewing

Michael Schmid
Hi Adam,

assuming you are programming a plugin, not a macro:

The only idea that comes into my mind is not very elegant, but it  
should do what you want (I have not tried it, however). You could  
create a mouse wheel event that scrolls up a very large distance  
(999999 lines, or whatever you consider enough):

TextPanel textPanel = IJ.getTextPanel();
textPanel.mouseWheelMoved(new MouseWheelEvent(textPanel, 0, 0, 0, 0,  
0, 0, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, -999999, -999999);

Michael
________________________________________________________________

On 1 Dec 2009, at 06:27, Adam Cliffe wrote:

> Kind of a trivial macro writing problem....
>
> If there are say 100 results in the results table, running
> updateResults(); refreshes the results table but also scrolls the
> window down to the last entry.
> does anyone know an easy way to set the part of the results table
> shown in the window? (i.e. so the first result is visible).
>
> thanks
>
> Adam
Reply | Threaded
Open this post in threaded view
|

Re: Results Table Viewing

ctrueden
Hi Adam & Michael,

Here's a (not particularly future-proof) solution with more code than
Michael's, but should work efficiently regardless of how much text is
present:

TextPanel textPanel = IJ.getTextPanel();
Component[] c = textPanel.getComponents();
for (int i=0; i<c.length; i++) {
  if (c[i] instanceof Scrollbar) {
    Scrollbar sb = (Scrollbar) c[i];
    if (sb.getOrientation() == Scrollbar.VERTICAL) {
      sb.setValue(0);
      break;
    }
  }
}

-Curtis

On Tue, Dec 1, 2009 at 4:20 AM, Michael Schmid <[hidden email]>wrote:

> Hi Adam,
>
> assuming you are programming a plugin, not a macro:
>
> The only idea that comes into my mind is not very elegant, but it should do
> what you want (I have not tried it, however). You could create a mouse wheel
> event that scrolls up a very large distance (999999 lines, or whatever you
> consider enough):
>
> TextPanel textPanel = IJ.getTextPanel();
> textPanel.mouseWheelMoved(new MouseWheelEvent(textPanel, 0, 0, 0, 0, 0, 0,
> false, MouseWheelEvent.WHEEL_UNIT_SCROLL, -999999, -999999);
>
> Michael
> ________________________________________________________________
>
>
> On 1 Dec 2009, at 06:27, Adam Cliffe wrote:
>
>  Kind of a trivial macro writing problem....
>>
>> If there are say 100 results in the results table, running
>> updateResults(); refreshes the results table but also scrolls the
>> window down to the last entry.
>> does anyone know an easy way to set the part of the results table
>> shown in the window? (i.e. so the first result is visible).
>>
>> thanks
>>
>> Adam
>>
>