comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » WWTEXT scroll position.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
WWTEXT scroll position. [message #18088] Wed, 01 December 1999 00:00
nittler is currently offline  nittler
Messages: 2
Registered: December 1999
Junior Member
Hi peoples,

I thought I had posted this already but it never showed up.
I am now developing widget applications in both PV-WAVE and IDL and my
head is swimming. For one WAVE application, I want to use a widget text
(WWTEXT) window to output information messages as the program runs,
basically a console window. I have run into two problems. First there
doesn't seem to be a way to directly append text to a WWTEXT widget.
Well I fixed this by writing a routine to read the current contents of
the widget, tack on the new contents and put the whole thing back in the
widget. This is fine, but it leads to the second problem, namely that I
can't figure out how to set the scroll position of the window. So, once
I rewrite the text to the widget the scroll is always set to the first
line, whereas I want it to be set to the most recently written (last)
line. Can anybody help?

Cheers,
Larry

------------------------------------------------------------ ----------
Larry R. Nittler Laboratory for Extraterrestrial
Physics, Code 691
Interstellar Dust Buster NASA Goddard Spaceflight Center
Greenbelt MD 20771
phone: 301-286-4572 fax:301-286-0212
phone (DTM): 202-686-4370 x4421
nittler@lepvax.gsfc.nasa.gov http://www.ciw.edu/lrn/
------------------------------------------------------------ ----------


Sent via Deja.com http://www.deja.com/
Before you buy.
Re: WWTEXT scroll position. [message #18172 is a reply to message #18088] Wed, 01 December 1999 00:00 Go to previous message
Mark D. Williams is currently offline  Mark D. Williams
Messages: 15
Registered: November 1999
Junior Member
nittler@lepvax.gsfc.nasa.gov wrote:
> For one WAVE application, I want to use a widget text
> (WWTEXT) window to output information messages as the program runs,
> basically a console window. I have run into two problems. First there
> doesn't seem to be a way to directly append text to a WWTEXT widget.
> Well I fixed this by writing a routine to read the current contents of
> the widget, tack on the new contents and put the whole thing back in the
> widget. This is fine, but it leads to the second problem, namely that I
> can't figure out how to set the scroll position of the window. So, once
> I rewrite the text to the widget the scroll is always set to the first
> line, whereas I want it to be set to the most recently written (last)
> line. Can anybody help?
>

Try the following. It's a handy tip (that I have used before)
from VNI's on-line tips database:

The example code shows how to calculate the character offset
corresponding to
the desired row of the text and then set the appropriate resource for
the widget.

EXAMPLE CODE/FILES

pro ButCB, wid, data
common w, top, txt, txtsel, text

row = FIX(WwGetValue(txtsel)) ; Which row do we want?

eol = [0, WHERE(BYTE(text) EQ 10B)] ; Array of linefeed indicies
; (with 0 added for the first
line)

maxrow = n_elements(eol)-1 ; Max row of the data

offset = eol(row < maxrow) + 1 ; Position to use for topCharacter

args = {, topCharacter:offset} ; Set resource
status = WtSet(txt, args)

end

pro textpos
common w, top, txt, txtsel, text
top = WwInit('test','Test',layout,Backgr='cyan',/vertical)

label = ['Select this row:']
bbox = WwButtonBox(layout, label, 'ButCB')
txtsel = WwText(layout, Text='5')

text = 'Line 0 This is a test of positioning a text widget \012' + $
'Line 1 This is a test of positioning a text widget \012' + $
'Line 2 This is a test of positioning a text widget \012' + $
'Line 3 This is a test of positioning a text widget \012' + $
'Line 4 This is a test of positioning a text widget \012' + $
'Line 5 This is a test of positioning a text widget \012' + $
'Line 6 This is a test of positioning a text widget \012' + $
'Line 7 This is a test of positioning a text widget \012' + $
'Line 8 This is a test of positioning a text widget \012' + $
'Line 9 This is a test of positioning a text widget \012' + $
'Line 10 This is a test of positioning a text widget '

txt = WwText(layout, Text=text, /Read, cols=40, rows=10)

status = WwSetValue(top,/Display)
WwLoop, /Noblock
end

Regards,
Mark Williams
Resource Engineering, Inc.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Fitting Circles
Next Topic: Fitting Circles

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:53:02 PDT 2025

Total time taken to generate the page: 0.00552 seconds