Fields and User input into Table

Discussion in 'AutoCAD' started by Dan, Sep 9, 2004.

  1. Dan

    Dan Guest

    I am trying to figure out the best methods to have a user creat a field in a
    table which is link to a piece of text that the user is prompted for.

    Simply the steps are:

    Existing table:
    Exiting Text:

    (user is prompted to select existing text entitiy)
    (user is prompted to select which cell in existing table)

    Then the code will create a field (text contents) in the selected cell that
    references the selected text entity

    This should be easy right? Having a bugger of a time getting the field code
    to work inside the cell.

    I was looking into gathering the ObjectID# of the selected text, then
    placing that in the Field code as a variable.

    Not sure where to go.

    I cannot find to much in the help files...

    Thanks.
     
    Dan, Sep 9, 2004
    #1
  2. Dan

    Dan Guest

    UPDATE: I have figured out how to get the user to select text, get the
    Object ID, and create a field with that text reference.

    LAST thing I need: How do I get the field created in a cell the user select
    in a table?

    Thanks again!
    Dan
     
    Dan, Sep 9, 2004
    #2
  3. Here is a short example:

    Sub Test()
    Dim pickObj As AcadMText
    Dim tblObj As AcadTable
    Dim pickPt As Variant
    Dim tblPt As Variant
    With ThisDrawing.Utility
    .GetEntity pickObj, pickPt, vbCrLf & "Select text: "
    .GetEntity tblObj, tblPt, vbCrLf & "Select table: "
    End With

    Dim vec0(0 To 2) As Double
    vec0(0) = 0#: vec0(1) = 0#: vec0(2) = 1#
    Dim gotRow As Long, gotCol As Long
    If tblObj.HitTest(tblPt, vec0, gotRow, gotCol) Then
    tblObj.SetText gotRow, gotCol, "%<\AcObjProp Object(" &
    CStr(pickObj.ObjectID) & ").TextString \f ""%bl2"">%"
    End If
    End Sub



    --
    R. Robert Bell


    UPDATE: I have figured out how to get the user to select text, get the
    Object ID, and create a field with that text reference.

    LAST thing I need: How do I get the field created in a cell the user select
    in a table?

    Thanks again!
    Dan
     
    R. Robert Bell, Sep 9, 2004
    #3
  4. Dan

    Dan Guest

    Ouch! That was good. My code was 5 times as big. So much to learn. Thank you
    very much Robert.
    That acomplishes exactly what I was working towards. Hope this helps
    others. I have not found much documentation on Fields and tables. Do you
    have any good resources?

    Dan
     
    Dan, Sep 9, 2004
    #4
  5. Nope, no good resources. Lots of testing and so on.

    Please be aware that my sample code is not error-checking the user
    selections!

    --
    R. Robert Bell


    Ouch! That was good. My code was 5 times as big. So much to learn. Thank you
    very much Robert.
    That acomplishes exactly what I was working towards. Hope this helps
    others. I have not found much documentation on Fields and tables. Do you
    have any good resources?

    Dan
     
    R. Robert Bell, Sep 9, 2004
    #5
  6. Now why would you error check user selections, Bob? Don't the users always
    select as *we* think they will =)

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Sep 10, 2004
    #6
  7. Off with their heads if they don't!!!! <esg>

    --
    R. Robert Bell


    Now why would you error check user selections, Bob? Don't the users always
    select as *we* think they will =)

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    R. Robert Bell, Sep 10, 2004
    #7
  8. Dan

    Dan Guest

    Agreed,I am researching different methods of error checking now.
    Dan
     
    Dan, Sep 13, 2004
    #8
  9. I'm not sure that's the case, Dan. Your error message is saying that the
    user chose something, or the lack of something, that is required.
    Typically, this error is seen when your asking for the user to pick lets
    say a LINE and they either pick nothing or another non-line entitiy
    [circle, text, etc.]

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Sep 13, 2004
    #9
  10. Hint: TypeOf

    --
    R. Robert Bell


    Agreed,I am researching different methods of error checking now.
    Dan
     
    R. Robert Bell, Sep 13, 2004
    #10
  11. Dan

    Dan Guest

    I follow you, but when I do it, it fails, then I change the textstyle of the
    cell to Standard, and it works fine....?
    Dan
     
    Dan, Sep 13, 2004
    #11
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.