?
Solved

Making backspace act like rubout if not insert mode

Posted on 2004-09-28
7
Medium Priority
?
195 Views
Last Modified: 2013-11-13
Using Developer Studio to edit C files, I want backspace to act like this:
1) if currently in "insert mode", I want backspace to act like it does ... i.e., to move characters to the left as it deletes the previous character
2) if currently in "overlay mode", I want backspace to move one character left and replace the character with a blank
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

Accepted Solution

by:
drichards earned 1000 total points
ID: 12169620
This macro should do it - though the name could probably be better.
----------------------------------------------------------
Sub MyBS()
'DESCRIPTION: A description was not provided.


  if ( Application.TextEditor.OverType = True ) Then
'Begin Recording
      ActiveDocument.Selection.BackSpace
      ActiveDocument.Selection = " "
      ActiveDocument.Selection.CharLeft
'End Recording
  Else
    ActiveDocument.Selection.BackSpace
  End If
End Sub
0
 

Author Comment

by:ESQuicksall
ID: 12179259
That did it. Thanks.

Now, I would like to assign it to the backspace key but Developer Studio won't let me assign the backspace key (probably because that is used to backspace within the "Press New shortcut key" box). Is there an override or some other place I can reference to set this key?
0
 
LVL 19

Expert Comment

by:drichards
ID: 12180787
Not sure.  You can do Shift+Backspace for sure.  I don't know where the key binding is stored.  You might be able to go there and edit it manually.  I'll look for it when I get a chance.
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

Author Comment

by:ESQuicksall
ID: 12183240
BTW, can you tell me how to check the character at the curser regardless of if there is a Selection or not?
0
 
LVL 19

Expert Comment

by:drichards
ID: 12191388
Seems more complicated than necessary, but I don't see another way:

    l = Len(ActiveDocument.Selection)
    ActiveDocument.Selection.CharRight dsExtend
    If Len(ActiveDocument.Selection) > l Then
        c = Right(ActiveDocument.Selection,1)
        ActiveDocument.Selection.CharLeft dsExtend
    Else
        ActiveDocument.Selection.CharLeft dsExtend
        c = Left(ActiveDocument.Selection,1)
    End If
0
 

Author Comment

by:ESQuicksall
ID: 12191479
I assume a macro can only operate on a selection. I am having trouble finding the documentation on "Right" and all the other functions like that that may be available to me. Can you give me an idea as to how I would find that documentation? i.e., is this code simply Visual Basic or is it a Developer Studio unique code set?
0
 
LVL 19

Expert Comment

by:drichards
ID: 12191782
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Starting up a Project
Suggested Courses

752 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