Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
After setsel - how to leave the new text selected
#1
Hi all,

After I invoke on text (in an editable window/control) the getsel function, (e,.g.,
Code:
Copy      Help
str s.getsel
) and then setsel,

how can I leave the new text selected? I.e., in place of the original selected text that I read?

E.g., I found on this forum the following macro to S-w-a-p---C-a-s-e of text.
So I select text in a textbox, run the macro, and it does its thing and replaces the text, but it is o longer selected.
Is there some way I can keep the selection?


Code:
Copy      Help
str s.getsel
if(!s.len) ret
int i is
for i 0 s.len
,if(isalpha(s[i]))
,,is=1
,,if(isupper(s[i])) s[i]=tolower(s[i])
,,else s[i]=toupper(s[i])
if(is) s.setsel
#2
Macro Macro1269
Code:
Copy      Help
str s.getsel
s.ucase
s.setsel

;this code makes selection
spe
key+ S
BSTR b=s
rep(b.len) key L
key- S
spe -1
#3
Hi, I tried this method of yours to leave the text range selected after I did some processing on it. (Actually it traces backwards to reconstitute the original selection.) It works, but it is a bit slow. Anything faster?

TIA

- avi



Gintaras Wrote:Macro Macro1269
Code:
Copy      Help
str s.getsel
s.ucase
s.setsel

;this code makes selection
spe
key+ S
BSTR b=s
rep(b.len) key L
key- S
spe -1
#4
Maybe possible, but only with standard controls, like Edit (Notepad) or Rich Edit (WordPad). Also maybe possible in Word, through its COM interface. Will not work with other programs.
#5
Ok, thanks.

- avi


Forum Jump:


Users browsing this thread: 1 Guest(s)