Re: Scrolling within a text widget [message #81301] |
Fri, 07 September 2012 12:24  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Heinz Stege writes:
> 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.
Oh, my gosh! Does this bring back a lot of bad memories!
It's like an old girlfriend showing up years later after
you thought that nightmare was over. :-)
I don't think there is a real solution. At least I
don't remember one, and it's pretty clear no one
has bothered to work on widgets for at least the last
10 years or so.
You might try TextLineFormat in the Coyote Library. I think
I wrote that to break lines up into shorter lines so that
I could keep track of them as I added them to a text widget.
That way, I didn't have to worry about wrapping.
http://www.idlcoyote.com/programs/textlinformat.pro
Cheers,
David
--
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.")
|
|
|
Re: Scrolling within a text widget [message #81369 is a reply to message #81301] |
Mon, 10 September 2012 15:15  |
Heinz Stege
Messages: 189 Registered: January 2003
|
Senior Member |
|
|
Hi David,
thank you for your reply.
On Fri, 7 Sep 2012 13:24:46 -0600, David Fanning wrote:
> Heinz Stege writes:
>
>> 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.
>
> Oh, my gosh! Does this bring back a lot of bad memories!
> It's like an old girlfriend showing up years later after
> you thought that nightmare was over. :-)
>
> I don't think there is a real solution. At least I
> don't remember one, and it's pretty clear no one
> has bothered to work on widgets for at least the last
> 10 years or so.
>
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?
> You might try TextLineFormat in the Coyote Library. I think
> I wrote that to break lines up into shorter lines so that
> I could keep track of them as I added them to a text widget.
> That way, I didn't have to worry about wrapping.
>
> http://www.idlcoyote.com/programs/textlinformat.pro
>
This looks like a good Workaround. I tried something very similar.
Since I don't know how many characters fit into the text widget, I
used the STRING_SIZE keyword of WIDGET_INFO to place the line breaks
at the proper places. In this way every (broken) line gets as long as
possible.
However I don't feel very lucky with this method. IDL does not really
give the information, how many pixels may be used for the text. I get
a rough estimation from the geometry structure from WIDGET_INFO. The
number of pixels seems to be SCR_XSIZE minus MARGIN*2 minus a fudge
factor. On windows the fudge factor is 2. On Linux it is different. If
you have scroll bars, you have to add the width of the scroll bars.
And IDL has no function to tell us the width of the scroll bar.
David, you are right. Widget programming seems to have a taste of a
nightmare.
Why couldn't Exelis simply spend us a SET_TEXT_BOTTOM_LINE keyword in
WIDGET_CONTROL?
Cheers, Heinz
|
|
|