Solved

Developer Studio key to mark a word

Posted on 2004-09-24
7
179 Views
Last Modified: 2012-05-05
From within Developer Studio, I want to create a keystroke that will mark a word. Currently ctrl/shift/left will mark a word but  ctrl/shift/right marks the word plus the spaces to the next word.

Any ideas?
0
Comment
Question by:ESQuicksall
  • 4
  • 3
7 Comments
 
LVL 19

Expert Comment

by:drichards
ID: 12146753
Once again, start off with the macro recorder.  You want to do ctrl-shift-right and then a shift-left to back up if there was a space after the word.  This gets you a start.  Then you need to go edit the macro.  You want to back up until the last selected character is not a space.  It's actually a bit more complicated than that if you really want to do it right because you have to back up until to the last non-whitespace character.  I'll think about this a bit and see what I can come up with.
0
 
LVL 19

Accepted Solution

by:
drichards earned 250 total points
ID: 12146900
How do you want it to behave?  This will select from current position (in word or at start of word) to the end of the word, not including whitespace.  As I use it , though, it doesn't seem particularly useful because the selection can't be extended since it backs up over spaces.  Try it and let me know exactly what behavior you want.  Maybe this is enough to get you on the right track.
------------------------------
Sub SelWordRight()
'DESCRIPTION: A description was not provided.


'Begin Recording
      ActiveDocument.Selection.WordRight dsExtend
      While (Right(ActiveDocument.Selection,1) = " ") Or (Right(ActiveDocument.Selection,1) = vbTab)
            ActiveDocument.Selection.CharLeft dsExtend
      Wend
'End Recording
End Sub
0
 
LVL 19

Expert Comment

by:drichards
ID: 12146933
Two other options:

1) Use the original CTRL-SHIFT-RIGHT and add a macro to back out the whitespace if you want.  This could be assigned to ALT-SHIFT-LEFT or something.
2) Use the macro above and assign it to ALT-SHIFT-RIGHT and choose whether you want CTRL or ALT version of the command.

The trouble is that the software doesn't know whether you want to extend over the whitespace or not.  Somehow youneed to tell it.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:ESQuicksall
ID: 12168615
SelWordRight works perfectly. All I really want is to have a keystroke that does a "double click" on a word (I hate using a mouse). It does extend the selection if I use shift/right.

Also, with your example, I am able to see how to do more things.

Eddy
0
 

Author Comment

by:ESQuicksall
ID: 12168617
Adding more points for a hard problem.
0
 

Author Comment

by:ESQuicksall
ID: 12168854
I'm wondering why the word "Right" is used in the While. It does not seem intuitive because the highlight would be on a blank and not to the "Right".


Eddy
0
 

Author Comment

by:ESQuicksall
ID: 12168941
I'm going to add another one for you (or anyone else if they are knowledgable). It will be called "Making backspace act like rubout if not insert mode".
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now