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

Home » Public Forums » archive » Text Widget Confession
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Text Widget Confession [message #26738 is a reply to message #26626] Mon, 24 September 2001 11:41 Go to previous messageGo to previous message
Don J Lindler is currently offline  Don J Lindler
Messages: 19
Registered: April 2001
Junior Member
I have not run the code, but it looks to me that if your text widget had
something like:

hog
dog
dig

and you selected the og from dog and the d from dig. The code would select
the og from hog and the d from dog. The strpos would find the first
occurence of the string.

Don
lindler@rockit.gsfc.nasa.gov


"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1619113bbea36aa89896c2@news.frii.com...
> Pavel A. Romashkin (pavel.romashkin@noaa.gov) writes:
>
>> David Fanning wrote:
>>>
>>> It turns out a list widget, although simplifying my
>>> life, made other things more complicated.
>>
>> You could use widget_text, then, by modifying the code above to include
>> the following (sorry for not providing this to start with :-):
>>
>> junk = where(strsplit(rs, string(1b), /extract) $
>> ne theText, comp=good_rows, ncomp=count)
>> if count ne 0 then theText = theText[good_rows]
>> Widget_Control, textID, Set_Value=theText
>>
>> Its not copyrighted, you know :-)
>
> No, I realize it's not copyrighted. But I feel
> obligated to send you a check for $100 anyway
> to compensate you for your time and effort. :-)
>
> Cheers,
>
> David
>
> P.S. In case you are interested, here is the final
> code responding to the Delete button:
>
> ************************************************************ ************
> PRO Recorder::DeleteIt, event
>
> ; The method event handler deletes text lines in the current selection.
>
> ; Get the current text selection.
>
> Widget_Control, self.textID, Get_Value=selectText, /Use_Text_Select
>
> ; Get the text itself.
>
> theText = *self.text
>
> ; Hocus-pocus provided by Pavel Romashkin to circumvent
> ; RSI-supplied nonsense. V-E_R-Y clever! :-)
>
> jt = StrJoin(theText, String(1b))
> js = StrJoin(selectText, String(1b))
> rs = jt
> StrPut, rs, String( Byte(js) < 2b), StrPos(jt, js)
> selection = Where(StrSplit(rs, String(1b), /Extract) NE thetext)
>
> ; Error checking. Look for no selection values.
>
> IF N_Elements(selection) EQ 1 THEN BEGIN
> IF selection[0] EQ -1 THEN RETURN
> ENDIF
>
> ; Error checking. Look for no overlap between the two vectors.
>
> overlap = self->SetDifference(Indgen(N_Elements(*self.text)), selection)
> IF N_Elements(overlap) EQ 1 THEN BEGIN
> IF overlap[0] EQ -1 THEN BEGIN
> *self.text = ""
> ENDIF ELSE BEGIN
> *self.text = (*self.text)[overlap]
> ENDELSE
> ENDIF ELSE *self.text = (*self.text)[overlap]
>
>
> Widget_Control, self.textID, Set_Value=*self.text
>
> END
> ************************************************************ ************
>
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438, E-mail: david@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: A distracting puzzle
Next Topic: Xmanager R US

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

Current Time: Sun Oct 12 14:51:27 PDT 2025

Total time taken to generate the page: 0.40112 seconds