Re: Carriage Returns in IDL Text Widget [message #25885] |
Thu, 26 July 2001 04:57  |
Alex Schuster
Messages: 124 Registered: February 1997
|
Senior Member |
|
|
Dan Fletcher wrote:
> I've searched through Google groups and seen this question asked a
> number of times, but I haven't seen an answer anywhere and I'm hoping
> someone out there can help me. I have a Text Widget and want to write
> some info to it. I can't seem to send it a carriage return, so all of
> the text winds up on one line and out of the space supplied by the
> widget.
>
> Here's the widget definition (I've also tried it with the /WRAP keyword
> and have had the same problem).
>
> WID_TEXT_FILEPROPS = Widget_Text(WID_BASE_LEFT, $
> UNAME='WID_TEXT_FILEPROPS' ,XOFFSET=8 ,YOFFSET=21 $
> ,SCR_XSIZE=168 ,SCR_YSIZE=163 ,XSIZE=20 ,YSIZE=1)
^^^^^^^
Well, your text widget has only one line, is that really what you
intended? If yes, skip the APPEND keyword, and you'll always see the
last string you sent to the widget. Or you can increase the YSIZE, then,
with the APPEND keyword, the new strings start at a new line.
> TextString='File: '+EEGFileName + STRING(13B)+STRING(10B)
I think IDL doesn't care about CR+LF here. To add multiple lines, just
use a STRARR, or put the single strings there one after another, with
the /append keyword.
Alex
--
Alex Schuster Wonko@planet-interkom.de
alex@pet.mpin-koeln.mpg.de
|
|
|
Re: Carriage Returns in IDL Text Widget [message #25886 is a reply to message #25885] |
Thu, 26 July 2001 04:34   |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
Dan Fletcher <djfletcher@ucdavis.edu> writes:
> Hello:
>
> I've searched through Google groups and seen this question asked a
> number of times, but I haven't seen an answer anywhere and I'm hoping
> someone out there can help me. I have a Text Widget and want to write
> some info to it. I can't seem to send it a carriage return, so all of
> the text winds up on one line and out of the space supplied by the
> widget.
>
> Here's the widget definition (I've also tried it with the /WRAP keyword
> and have had the same problem).
>
> WID_TEXT_FILEPROPS = Widget_Text(WID_BASE_LEFT, $
> UNAME='WID_TEXT_FILEPROPS' ,XOFFSET=8 ,YOFFSET=21 $
> ,SCR_XSIZE=168 ,SCR_YSIZE=163 ,XSIZE=20 ,YSIZE=1)
>
> and here's the code I'm using to write to it:
>
> TextString='File: '+EEGFileName + STRING(13B)+STRING(10B)
>
> WIDGET_CONTROL,widget_info(Event.top,
> FIND_BY_UNAME='WID_TEXT_FILEPROPS'),SET_VALUE=TextString,/AP PEND
>
> TextString="Sampling Rate:
> "+STRING(EEGFile.DataBlockSampleRate(0,0))+" Hz"
>
> WIDGET_CONTROL,widget_info(Event.top,
> FIND_BY_UNAME='WID_TEXT_FILEPROPS'),SET_VALUE=TextString,/AP PEND
>
>
> Any suggestions would be greatly appreciated. This is driving me crazy!
>
Hmmm. Seems like the Expert Programmer Association's pres is on vacation
or in his annual tennis tournament ;-) I'm not sure if I can really help
you, but I would start looking at those keywords to Widget_Text. I would
think that with All_Events=1 you can get each and every keystroke. Then
you can track things along the lines of:
CASE StrUpCase(eventCategory) OF
;; Gaining or loosing focus
'WIDGET_KBRD_FOCUS' : BEGIN
RETURN, self->HandleFocusEvents(event)
END
;; Change the cursor position or select part of the string
'WIDGET_TEXT_SEL' : BEGIN
END
;; Insertion of a single character
'WIDGET_TEXT_CH' : BEGIN
;; TAB or RETURN key
IF event.ch EQ 9B OR event.ch EQ 10B THEN BEGIN ;; <===
self->MoveTab
RETURN, 0 ;; event
ENDIF
RETURN, self->HandleInsertEvents(event)
END
;; Insertion of a string
'WIDGET_TEXT_STR' : BEGIN
RETURN, self->HandleInsertEvents(event)
END
;; Delete a character or string
'WIDGET_TEXT_DEL' : BEGIN
RETURN, self->HandleDeleteEvents(event)
END
ELSE: BEGIN
self->ErrorMessage, 'Unknown event catagory : '+ $
eventCategory
ENDELSE
ENDCASE
This is an excerpt from a widget object.
Good luck,
Martin
--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
|
|
|
Re: Carriage Returns in IDL Text Widget [message #25973 is a reply to message #25885] |
Thu, 26 July 2001 10:45  |
Dan Fletcher
Messages: 4 Registered: August 1999
|
Junior Member |
|
|
Thanks for the replies! The widget was indeed set to one character high
(YSIZE=1). The odd thing is that I set this up in the GUI Builder and it
doesn't appear to allow me to set the YSIZE to anything BUT 1 (the option in
the properties dialog is grayed out and 1 is entered). So I guess I just have
to remember to go back and set that value anytime I change anything in GUI
Builder and recreate the *.pro file.
Thanks again for your help!
Dan
Alex Schuster wrote:
> Dan Fletcher wrote:
>
>> I've searched through Google groups and seen this question asked a
>> number of times, but I haven't seen an answer anywhere and I'm hoping
>> someone out there can help me. I have a Text Widget and want to write
>> some info to it. I can't seem to send it a carriage return, so all of
>> the text winds up on one line and out of the space supplied by the
>> widget.
>>
>> Here's the widget definition (I've also tried it with the /WRAP keyword
>> and have had the same problem).
>>
>> WID_TEXT_FILEPROPS = Widget_Text(WID_BASE_LEFT, $
>> UNAME='WID_TEXT_FILEPROPS' ,XOFFSET=8 ,YOFFSET=21 $
>> ,SCR_XSIZE=168 ,SCR_YSIZE=163 ,XSIZE=20 ,YSIZE=1)
> ^^^^^^^
> Well, your text widget has only one line, is that really what you
> intended? If yes, skip the APPEND keyword, and you'll always see the
> last string you sent to the widget. Or you can increase the YSIZE, then,
> with the APPEND keyword, the new strings start at a new line.
>
>> TextString='File: '+EEGFileName + STRING(13B)+STRING(10B)
>
> I think IDL doesn't care about CR+LF here. To add multiple lines, just
> use a STRARR, or put the single strings there one after another, with
> the /append keyword.
>
> Alex
> --
> Alex Schuster Wonko@planet-interkom.de
> alex@pet.mpin-koeln.mpg.de
|
|
|