forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Re-Select text

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Wed Dec 18, 2002 3:55 pm    Post subject: Re-Select text Reply with quote

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! Smile )

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
View user's profile Send private message Send e-mail Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Wed Dec 18, 2002 4:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Wed Dec 18, 2002 4:27 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Wed Dec 18, 2002 5:36 pm    Post subject: Reply with quote

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
View user's profile Send private message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Wed Dec 18, 2002 5:39 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Wed Dec 18, 2002 5:44 pm    Post subject: Reply with quote

Ahaaaaa! Now I see what the problem is. I got it all mixed up in my mind Rolling Eyes

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
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Wed Dec 18, 2002 6:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Wed Dec 18, 2002 6:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed Dec 18, 2002 10:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu Dec 19, 2002 12:20 am    Post subject: Reply with quote

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
View user's profile Send private message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Thu Dec 19, 2002 1:25 am    Post subject: Reply with quote

Dr. Dread that works GREAT! thanks a lot. Worship
I was having a hard time with that one. Wink

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group