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 
Switch to threaded view of this topic Create a new topic Submit Reply
Scrolling within a text widget [message #81302] Fri, 07 September 2012 12:04 Go to next 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
Re: Scrolling within a text widget [message #81368 is a reply to message #81302] Mon, 10 September 2012 19:03 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Heinz Stege writes:

> Does that mean, that nobody writes GUIs with IDL? (I mean except the
> developers of the IDL demo.) What way do you recommend, if you have
> written an IDL program and want to give the user a GUI for starting
> and controlling the program?

I recommend you don't use a scrolling text widget. ;-)

The good news is, at least you don't have a requirement
for a table widget!

Cheers,

David

P.S. Let's just say I've found a way to write plenty of
GUIs without scrolling text widgets after I suffered so much
trying to understand them.



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
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: Wed Oct 08 17:47:01 PDT 2025

Total time taken to generate the page: 0.00623 seconds