cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
matteo_patelmo
Level IV

ScriptBox scrolling

Hi, I would like to scroll the following script box to the end, so that the last string written is always visible. 

 

w=new window("a", sb=script box());

for (i=1, i<=100, i++,
		sb<<append text(char(i) || "\!N");
// I would like to set a scroll to end here, so that the last written string is visible.
);

By instpect the the display box tree, I see that a "scroll box" is automatically created around the script box, but I have not found a way to access it.  

 

Any suggestion?

 

thanks

Matteo

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: ScriptBox scrolling

For script box you can use Set Line to go to specific line

Names Default To Here(1);

w = New Window("a", sb = Script Box());
maxcount = 100;

For(i = 1, i <= maxcount, i++,
	sb << append text(Char(i) || "\!N");      // I would like to set a scroll to end here, so that the last written string is visible.
);

lines = sb << get lines;

sb << Set Line Text(N Items(lines), Char(lines[N Items(lines)]));

The scrollbox which wraps script box seems to be some sort of weird scrollbox (it is still scriptbox..)

Names Default To Here(1);

nw = New Window("a", sb = Script Box());
maxcount = 100;

For(i = 1, i < maxcount, i++,
	sb << append text(Char(i) || "\!N");      // I would like to set a scroll to end here, so that the last written string is visible.
);

scroll = nw[ScrollBox(1)];
Show(scroll << Class Name);
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: ScriptBox scrolling

For script box you can use Set Line to go to specific line

Names Default To Here(1);

w = New Window("a", sb = Script Box());
maxcount = 100;

For(i = 1, i <= maxcount, i++,
	sb << append text(Char(i) || "\!N");      // I would like to set a scroll to end here, so that the last written string is visible.
);

lines = sb << get lines;

sb << Set Line Text(N Items(lines), Char(lines[N Items(lines)]));

The scrollbox which wraps script box seems to be some sort of weird scrollbox (it is still scriptbox..)

Names Default To Here(1);

nw = New Window("a", sb = Script Box());
maxcount = 100;

For(i = 1, i < maxcount, i++,
	sb << append text(Char(i) || "\!N");      // I would like to set a scroll to end here, so that the last written string is visible.
);

scroll = nw[ScrollBox(1)];
Show(scroll << Class Name);
-Jarmo
matteo_patelmo
Level IV

Re: ScriptBox scrolling

Thanks, it works!

 

Matteo