Solved

Developer Studio key to mark a word

Posted on 2004-09-24
7
205 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A short article about a problem I had getting the GPS LocationListener working.
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.
Six Sigma Control Plans
Introduction to Processes

707 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