Solved

Making backspace act like rubout if not insert mode

Posted on 2004-09-28
7
188 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
  • 4
  • 3
7 Comments
 
LVL 19

Accepted Solution

by:
drichards earned 250 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

This article will show, step by step, how to integrate R code into a R Sweave document
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 …
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 …

746 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

12 Experts available now in Live!

Get 1:1 Help Now