| View previous topic :: View next topic |
| Author |
Message |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Wed Dec 18, 2002 3:55 pm Post subject: Re-Select text |
|
|
After I have copied a block of text and added a few chars to the beginning
and end and paste it back, how can i re-select the original text?
Ex.
Lets say I want to copy the text:
TEXT NEEDS
TO BE COPY
then add "THIS " it the beginning and "IED" to the end (I know it is spelled wrong, this is just an example ok! )
The text is highlighted, copied and the text added to the beginning and end and pasted back. So it would look like this:
THIS TEXT NEEDS
TO BE COPYIED
Now,I need to re-select the original:
TEXT NEEDS
TO BE COPY
I know It can be done with API, but, I can't get it to work.
Can anyone lend a hand?
Thanks in advance. _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Wed Dec 18, 2002 4:24 pm Post subject: |
|
|
Where are you copying from? Another program, or....?
Are you forced to de-select your text selection between copying the text and copying
the revised text back? Once your text is de-selected you'll probably have a hard time
obtaining it again, I think. But if you can keep your selection, it's easy to overwrite it.
Or you could cut the text instead and insert the new text at the cursor point - that
could be easier.
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Wed Dec 18, 2002 4:27 pm Post subject: |
|
|
The text would be copied from my program. When the text is pasted it
the selection goes away. _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Wed Dec 18, 2002 5:36 pm Post subject: |
|
|
Hmmmm, normally you wouldn't lose your selection just when making the copy. Then it should
be straightforward: COPY + manipulate TEXT + PASTE.
That should overwrite the original text selection with the new modified text. But obviously
you are then doing something more inbetween ????
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Wed Dec 18, 2002 5:39 pm Post subject: |
|
|
I don't lose the selection when cpoying, I do when I paste. That is why I need to re-select the original text. _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Wed Dec 18, 2002 5:44 pm Post subject: |
|
|
Ahaaaaa! Now I see what the problem is. I got it all mixed up in my mind
I'll give it a thought and see if something comes up.
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Wed Dec 18, 2002 6:19 pm Post subject: |
|
|
Why don't you just send a @shift(@key(left)), after you've paste the text, with the window send command...
| Code: | window send,#Notepad,This is a long text
window send,#Notepad,@shift(@key(left)@key(left)@key(left)@key(left)@key(left)@key(left)@key(left)@key(left)@key(left))
window send,#Notepad,short line of text |
|
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Wed Dec 18, 2002 6:43 pm Post subject: |
|
|
This is a test using API commands:
| Code: |
title TEST
dialog CREATE,TEST,-1,0,300,150
dialog ADD,EDIT,EDIT1,10,10,280,60,START. TEXT NEEDS TO BE COPY. END,MULTI
dialog ADD,BUTTON,BUTTON1,120,120,,,Go!,DEFAULT
dialog SHOW
%a = @sendmsg(@win(~EDIT1),$0B1,7,28)
:evloop
wait event
goto @event()
:BUTTON1BUTTON
dialog disable,BUTTON1
%a = @sendmsg(@win(~EDIT1),$0B0,0,0)
%%end = @div(%A,65536)
%%start = @diff(%A,@prod(%%end,65536))
%%dummy = @sendmsg(@win(~EDIT1),$0301,0,0)
dialog focus,EDIT1
%%part1 = "THIS "
%%part2 = "IED"
window send,TEST,%%part1
%a = @sendmsg(@win(~EDIT1),$0302,0,0)
window send,TEST,%%part2
%a = @sendmsg(@win(~EDIT1),$0B1,@sum(%%start,@len(%%part1)),@sum(%%end,@len(%%part1)))
goto evloop
:CLOSE
exit
|
Mind you, wrote it in VDS3, may not run in VDS4 without adjustments.
Greetz
Dr. Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing
Last edited by Dr. Dread on Thu Dec 19, 2002 12:09 am; edited 1 time in total |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Dec 18, 2002 10:28 pm Post subject: |
|
|
You need to get the starting and ending positions of the text when you
first copy it. Once pasted, you then use the positions you saved to select
the text to highlight again.
-Garrett |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Dec 19, 2002 12:20 am Post subject: |
|
|
Added a line to the above code to get an auto-select to start out with.
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Thu Dec 19, 2002 1:25 am Post subject: |
|
|
Dr. Dread that works GREAT! thanks a lot.
I was having a hard time with that one.  _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|