Solved

Developer Studio key to mark a word

Posted on 2004-09-24
7
200 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
Industry Leaders: 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

730 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