Active a activeX dialogue box from vlisp?

Discussion in 'AutoCAD' started by Bill Barrows, Jan 20, 2004.

  1. Bill Barrows

    Bill Barrows Guest

    I am trying to create a dialogue box with Visual Basic that can pass a value
    to Visual Lisp. I am having problems opening the dialogue box from vlisp.

    1. I created the VB project (wjbUI) with a form (wjbio) and class module
    (wjbDialogue).

    2. Created the dll (make wjbUI.dll)

    3. I ran regsrv32.exe on the wjbUI.dll successfully.

    3. I used these two commands in Visual lisp:
    _$(vl-load-com)
    _$ (setq ui (vlax-create-object "wjbUI.wjbDialogue"))
    #<VLA-OBJECT _wjbDialogue 001a2f18>

    Now I want to open the dialogue box using something like this
    _$ (vlax-ldata-get "wjbUI" "wjbN")
    nil

    How do I launch the dialogue box?
    Any help appreciated.

    Bill Barrows



    ***
    My form (wjbio) has two text boxes and two buttons and has this code

    Option Explicit
    Public UI As wjbDialogue
    Private Sub cmdOK_Click()
    UI.wjbL = Me.txtwjbL.Text
    UI.wjbN = Me.txtwjbN.Text
    Unload Me
    End Sub
    Private Sub cmdCancel_Click()
    UI.Cancelled = True
    Unload Me
    End Sub

    ***
    My Class Module (wjbDialogue) has this code

    Option Explicit
    Public wjbN As Integer
    Public wjbL As String
    Public Cancelled As Boolean
    Public Sub ShowUI()
    With wjbio
    Set .UI = Me
    Call .Show(vbModal)
    End With
    End Sub
    Private Sub Class_Initialize()
    wjbN = 7
    wjbL = "testing 123"
    End Sub
     
    Bill Barrows, Jan 20, 2004
    #1
  2. I would expect you have to call the show method of the dialog box at some point, right?
    If you do VB, you know that is the first step to seeing a dialog box. Maybe you made it so the class initialize event
    opened the dialog...

    While you are accessing the props and methods from vlisp, its still an activex world.
    You still have to deal with the objects just like you are in VB, except you use things like vlax-invoke or
    vl-catch-all-apply whatever whatever. The hard part is converting the data types when passing things back and forth.
    The other major disadvantage is that the dialog has no way of sending info back to your routine while it is open (I
    believe). You have to wait til it closes, then grab the properties of the form (thats right, you set up properties for
    the form to hold the data even after the form is closed.

    The whole process is way more complicated than using ObjectDCL. The ObjectDCL is activex compatible so its all that VB
    is and more. You also get this handy set of paring knives that cut through a brick.....<g>
    Only problem with lisp is its database handling. I like VB much better for that so my apps that use a database are in
    VB. The rest are in lisp with ODCL.

    The super, awesome, cool, neat, and fun part about ODCL is that the callbacks are not nasty looking like normal dcl.
    ODCL structures things like VB so each control gets its own callback function per event. It is sooooooooo much better
    than using normal dcl. I hope Chad and friends become millionaires from it as it just makes the coolest tools.

    The VB guys must have been upset when ODCL came out as it extended the capability of lisp way beyond VB in terms of
    making real programs. VB is cool but it has too many hangups with accessing the command line and a general lack of
    certain commands like grdraw and the ability to send chopped up command sequences cleanly. Too bas is its structure is
    beautiful. But maybe .net changes all this. Time will tell.

    So I would check out ObjectDCL.com or do the whole thing in VB or VBA. A mix is really tough if you are not a veteran
    at data type conversions for lisp and VB.

    "Bill Barrows" <>
    |>I am trying to create a dialogue box with Visual Basic that can pass a value
    |>to Visual Lisp. I am having problems opening the dialogue box from vlisp.
    |>
    |>1. I created the VB project (wjbUI) with a form (wjbio) and class module
    |>(wjbDialogue).
    |>
    |>2. Created the dll (make wjbUI.dll)
    |>
    |>3. I ran regsrv32.exe on the wjbUI.dll successfully.
    |>
    |>3. I used these two commands in Visual lisp:
    |>_$(vl-load-com)
    |>_$ (setq ui (vlax-create-object "wjbUI.wjbDialogue"))
    |>#<VLA-OBJECT _wjbDialogue 001a2f18>
    |>
    |>Now I want to open the dialogue box using something like this
    |>_$ (vlax-ldata-get "wjbUI" "wjbN")
    |>nil
    |>
    |>How do I launch the dialogue box?
    |>Any help appreciated.
    |>
    |>Bill Barrows
    |>
    |>
    |>
    |>***
    |>My form (wjbio) has two text boxes and two buttons and has this code
    |>
    |>Option Explicit
    |>Public UI As wjbDialogue
    |>Private Sub cmdOK_Click()
    |> UI.wjbL = Me.txtwjbL.Text
    |> UI.wjbN = Me.txtwjbN.Text
    |> Unload Me
    |>End Sub
    |>Private Sub cmdCancel_Click()
    |> UI.Cancelled = True
    |> Unload Me
    |>End Sub
    |>
    |>***
    |>My Class Module (wjbDialogue) has this code
    |>
    |>Option Explicit
    |>Public wjbN As Integer
    |>Public wjbL As String
    |>Public Cancelled As Boolean
    |>Public Sub ShowUI()
    |> With wjbio
    |> Set .UI = Me
    |> Call .Show(vbModal)
    |> End With
    |>End Sub
    |>Private Sub Class_Initialize()
    |> wjbN = 7
    |> wjbL = "testing 123"
    |>End Sub
    |>
    |>
    |>
    |>
    |>
    |>
    |>

    James Maeding
    Civil Engineer/Programmer
     
    James Maeding, Jan 20, 2004
    #2
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.