BeginOpen Event

Discussion in 'AutoCAD' started by Dragnsbld, Jul 13, 2004.

  1. Dragnsbld

    Dragnsbld Guest

    I am trying to get this BeginOpen event to work however, in order to get it to work I need to initialize the events to get access to the application level events. This doesn't seem to want to work.
    Any ideas about this?
    Has anyone else tried this before with success?
     
    Dragnsbld, Jul 13, 2004
    #1
  2. Dragnsbld

    Joe Sutphin Guest

    Dim WithEvents oApp As AcadApplication

    Joe
    --

    it to work I need to initialize the events to get access to the application
    level events. This doesn't seem to want to work.
     
    Joe Sutphin, Jul 13, 2004
    #2
  3. Dragnsbld

    Dragnsbld Guest

    I tried that. I followed the demo exactly as they say however, how do you get the Application level events to start. here's a copy of what I have:
    ClassMod Decl-> Public WithEvents App As AcadApplication

    ThisDrawing ->
    Sub AcadApplication_Events()
    Set ACADApp = GetObject(, "AutoCAD.Application.16")
    End Sub

    Private Sub ACADApp_BeginOpen(FileName As String)
    MsgBox "A drawing is about to be loaded from: " & FileName
    End Sub

    Itried to place the
    Set AcEvClMod.App = ThisDrawing.Application

    everywhere I could think of and it never even gets tapped.
     
    Dragnsbld, Jul 13, 2004
    #3
  4. Dragnsbld

    TomD Guest

    Not sure if this will help you, but here's the callback for BeginPlot that's
    working very well, here:

    Private Sub AcadDocument_BeginPlot(ByVal DrawingName As String)
    If Not bCecPrePlotOff Then
    Call UpdateStamp 'Offer to update CEC plot stamp
    Call CheckLtScale 'Check linetype scaling
    End If
    End Sub

    Note that this is the ThisDrawing module..............no class modules at
    all. It's working great.

    get the Application level events to start. here's a copy of what I have:
     
    TomD, Jul 13, 2004
    #4
  5. Dragnsbld

    Dragnsbld Guest

    Thanks for that. I have a Document Level event also, don't have troubles with it right now but the Application Level is giving me a test of abilities. I think I am thinking into it to much.
     
    Dragnsbld, Jul 13, 2004
    #5
  6. Dragnsbld

    TomD Guest

    Sorry it didn't help. I had written one, just to try it out. It did work
    well, but I lost some time ago. If I come across it, I'll post it.

    with it right now but the Application Level is giving me a test of
    abilities. I think I am thinking into it to much.
     
    TomD, Jul 13, 2004
    #6
  7. Dragnsbld

    Anne Brown Guest

    Here is a tip on using the discussion groups to your best
    advantage. Please do not change the subject line of discussion
    group messages to which you are replying. It breaks the ability
    of the search engine to group the messages, makes it harder to
    follow the thread and is quite confusing. If it is a new subject,
    please start a new message; if a reply, put your text answer in
    the body of your message and leave the header the same.

    The post "Found it" is an answer to "BeginOpen Event".

    Thanks for your future cooperation.
     
    Anne Brown, Jul 13, 2004
    #7
  8. Dragnsbld

    TomD Guest

    I changed it so the original poster realized it wasn't an inadvertant double
    post.

    I will refrain from doing so in the future.
     
    TomD, Jul 13, 2004
    #8
  9. Here is an example I use.

    Class Module named clsApplicationEvents
    ---------------------------------------------------
    Option Explicit
    Public WithEvents objAcadApp As AcadApplication

    Private Sub Class_Initialize()
    Set objAcadApp = ThisDrawing.Application
    End Sub

    Private Sub objAcadApp_SysVarChanged(ByVal SysvarName As String, ByVal newVal As Variant)
    If SysvarName = "SDI" Then
    If newVal <> 1 Then
    ThisDrawing.SetVariable "SDI", 1
    End If
    End If
    End Sub
    ---------------------------------------------------
    I initialize the events at startup by running the following sub
    ---------------------------------------------------
    Option Explicit
    Public objApplicationEvents As clsApplicationEvents

    Public Sub InitializeEvents()
    Set objApplicationEvents = New clsApplicationEvents
    End Sub
     
    Nathan Taylor, Jul 14, 2004
    #9
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.