Re: Text Widget Confession [message #26768 is a reply to message #26626] |
Fri, 21 September 2001 11:08   |
Pavel A. Romashkin
Messages: 531 Registered: November 2000
|
Senior Member |
|
|
David Fanning wrote:
>
> Wouldn't a list widget work better for what you are doing?
>
> Of course, and that is exactly how I solved the problem.
> But it didn't really clear up any of my questions. :-)
David,
I could not believe you'd give up so easily :-(
The following code seems to do what you want with WIDGET_TEXT on both
Mac and W2K. I am sorry folks but I am too dumb for all your LFs and CRs
so I just ignored it all.
It only prints the index of items to be deleted from the origunal value
of the widget. But that should be fairly easy to set up.
Cheers,
Pavel
;****************
PRO Example_Event, event
Widget_Control, event.top, Get_UValue=textID
Widget_Control, textID, Get_Value=selectText, /Use_Text_Select
Widget_Control, textID, Get_Value=theText
jt = strjoin(thetext, string(1b))
js = strjoin(selecttext, string(1b))
rs = jt
strput, rs, string( byte(js) < 2b), strpos(jt, js)
print, where(strsplit(rs, string(1b), /extract) ne thetext)
END; -----------------------------------
;****************
PRO Example
tlb = Widget_Base(Column=1)
button = Widget_Button(tlb, Value='Do It')
textID = Widget_Text(tlb, Scr_XSize=100, $
YSize=20,Value=['Dog', 'Cow', 'Coyote'])
Widget_Control, tlb, /Realize, Set_UValue=textID
XManager, 'example', tlb, /No_Block
END; -----------------------------------
;****************
|
|
|