Added more ability to this

Discussion in 'AutoCAD' started by cadman_meg, Apr 22, 2004.

  1. cadman_meg

    cadman_meg Guest

    I have a VBA routine that detects when certain commands are called for editing text, attributes, etc... It looks like this:

    'Begin Code Block
    Option Explicit
    Private Const VK_CAPITAL = &H14
    Private Type KeyboardBytes
    kbByte(0 To 255) As Byte
    End Type
    Private kbArray As KeyboardBytes
    Private Declare Function GetKeyState Lib "user32" _
    (ByVal nVirtKey As Long) As Long
    Private Declare Function GetKeyboardState Lib "user32" _
    (kbArray As KeyboardBytes) As Long
    Private Declare Function SetKeyboardState Lib "user32" _
    (kbArray As KeyboardBytes) As Long
    Private Declare Function GetForegroundWindow Lib "user32" () As Long
    Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
    If CommandName = "TEXT" Or CommandName = "DTEXT" Or _
    CommandName = "DDEDIT" Or CommandName = "MTEXT" Or _
    CommandName = "DDATTE" Then
    GetKeyboardState kbArray
    kbArray.kbByte(VK_CAPITAL) = 1
    SetKeyboardState kbArray
    End If
    End Sub
    Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
    If CommandName = "TEXT" Or CommandName = "DTEXT" Or _
    CommandName = "DDEDIT" Then
    GetKeyboardState kbArray
    kbArray.kbByte(VK_CAPITAL) = 0
    SetKeyboardState kbArray
    End If
    End Sub
    'End Code Block

    This works great for me except for one big thing. With the newer versions of ACAD, you can just double click on mtext or dtext and then the appropriate edit box comes up. I find myself doing this more and more. With this, my routine will not work. Can I do something to this to make it work when I double click on any type of text for editing? If so, what and how? Thanks.
     
    cadman_meg, Apr 22, 2004
    #1
  2. cadman_meg

    cadman_meg Guest

    Anyone have any ideas on this? Would much appreciate it. Thanks.
     
    cadman_meg, Apr 22, 2004
    #2
  3. cadman_meg

    Doug Broad Guest

    Meg,
    The code you posted is VBA. There is a VBA newsgroup if
    you wish a VBA solution. Changing the code however will
    not fix your problem.

    In general, I suggest that you need to either,
    1) Add a double-click reactor or event to replace the default
    double click operations. Difficulty level -> large.

    2) can you caps lock event and change the objects after the
    fact by using either a command ended reactor/event or a database
    reactor/event.
     
    Doug Broad, Apr 22, 2004
    #3
  4. cadman_meg

    cadman_meg Guest

    I am not a super programmer. So I will probably just leave it as is. Just need to get out of the habit of double clicking or something. But I thought it would be a huge undertaking to set it up the way I am asking. Maybe some wiz here will shot at it. In any event, thanks for responding to me.
     
    cadman_meg, Apr 22, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.