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

Home » Public Forums » archive » Scrolling within a text widget
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Scrolling within a text widget [message #81302] Fri, 07 September 2012 12:04 Go to previous message
Heinz Stege is currently offline  Heinz Stege
Messages: 189
Registered: January 2003
Senior Member
Hi all,

here is a very basic question on srolling the text within a text
widget. My program is writing messages (e.g. infos, warnings and error
messages) into a little text widget. I would like the widget
automatically to scroll down the text, so that the user always can
read the latest message. Here is a demo:

tlb_wid=widget_base(title='Demo',/column)
text_wid=widget_text(tlb_wid,scr_xsize=200,ysize=6,/wrap)
widget_control,tlb_wid,/realize
widget_control,text_wid,set_value='1. The first message.'
widget_control,text_wid,set_value='2. This is a message '+$
'long enough to be wrapped by the text widget.',/append
widget_control,text_wid,set_value='3. Version: '+$
string(!version,/print),/append

So far so good. However the following message will not be visible,
because the text needs to be scrolled:

widget_control,text_wid,set_value='4. Error: '+$
'Something-went-wrong-message.',/append

The user does not see this message. He can click into the text widget
and make it visible by use of the PageDown or the Ctrl+End keys.

Here is my question: How can I make my program to scroll down to the
latest message automatically?

This is what I tried by now:

1. The /TEXT_NUMBER and TEXT_OFFSET_TO_XY=integer keywords of the
WIDGET_INFO function (in combination with the
SET_TEXT_TOP_LINE=line_number keyword of WIDGET_CONTROL) do not help
because they don't consider the line breaks due to the /WRAP option
specified in the WIDGET_TEXT function. (Note that
SET_TEXT_TOP_LINE=line_number from WIDGET_CONTROL counts the lines
after wrapping.) :-(

2. The following IDL commands do the magic on my Windows OS:

big_number=2^31-1
widget_control,text_wid,set_text_top_line=big_number

However, this does not work on a Linux-OS. :-(
On Linux the text scrolls up so far, that only one line of the text is
visible. And how could I be sure, that it will still work on
Windows�8? Not to mention, that I don't know, if it works on Mac-OS.

Does anybody have a solution? Please tell me.

Heinz
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Scrolling within a text widget
Next Topic: Re: Can't launch IDL DE anymore...

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

Current Time: Fri Oct 10 03:08:43 PDT 2025

Total time taken to generate the page: 1.03965 seconds