problem resizing form in activex dll

Discussion in 'AutoCAD' started by petersciganek, Jan 8, 2004.

  1. I am working on an activex dll control to call from vlisp. From a variable list of strings I create an array of controls (buttons) on a form with captions matching the strings from the list. The code works correctly –all buttons are added and repositioned as expected. However, I have not been able to resize the form at runtime. The same code – called from a standard exe project will resize the form correctly. I have tried settingthe height and using the move method, neither has any effect. Is this a limitation of working with activex dlls or am I not using the correct method or property? Thanks for any help, Peter.
     
    petersciganek, Jan 8, 2004
    #1
  2. Well - I can assure you that you're not hitting any limitations of
    ActiveX programming, because I've developed hundreds of them
    which have forms that are resizable.

    Can you indicate whether the form always remains on top of the
    the AutoCAD window? What programming language? What
    are you form's settings for BorderStyle?




    I am working on an activex dll control to call from vlisp. From a variable list of strings I create an array of controls
    (buttons) on a form with captions matching the strings from the list. The code works correctly - all buttons are added
    and repositioned as expected. However, I have not been able to resize the form at runtime. The same code - called from a
    standard exe project will resize the form correctly. I have tried setting the height and using the move method, neither
    has any effect. Is this a limitation of working with activex dlls or am I not using the correct method or property?
    Thanks for any help, Peter.
     
    Tony Tanzillo, Jan 8, 2004
    #2
  3. Thank you for responding, Tony.

    I am using VB6. The BorderStyle is currently set to 2-Sizable (though I have tried other settings). When I vlax-invoke the component from vlisp the form is on top of the acad window. I have tried the code in the load, initialize and activate event - no difference. When I stretch the form the buttons are all in the correct position - though in the final version I would like to make the border style fixed.

    Here is the current code:

    frmCmd with two buttons, cmdX (index 0) and cmdCancel.
    code in form:
    Private Sub cmdCancel_Click()
    Me.Hide
    Unload Me
    End Sub

    Private Sub cmdX_Click(Index As Integer)
    varReturn = cmdX(Index).Caption
    Me.Hide
    Unload Me
    End Sub


    Private Sub Form_Load()
    Dim lst, pair As Variant
    Dim i, h As Integer


    lst = Split(varData, vbVerticalTab)


    pair = Split(lst(0), vbCr)

    h = frmCmd.Height + (240 * (UBound(lst) - 1))




    cmdX(0).Caption = pair(0)
    cmdX(0).ToolTipText = pair(1)


    For i = 1 To UBound(lst) - 1
    pair = Split(lst(i), vbCr)
    Load cmdX(i)
    cmdX(i).Caption = pair(0)
    cmdX(i).ToolTipText = pair(1)
    cmdX(i).Top = cmdX(i - 1).Top + 480
    cmdX(i).Visible = True
    Next i

    frmCmd.Move frmCmd.Left, frmCmd.Top, frmCmd.Width, h
    'frmCmd.Height = h

    cmdCancel.Top = frmCmd.Height - 840
    End Sub

    code in class module ui_functions:

    Public Function cmd_form(vdata As Variant) As Variant
    Dim frm As frmCmd

    varData = vdata

    Set frm = New frmCmd

    frm.Show vbModal

    cmd_form = varReturn

    Unload frm

    Set frm = Nothing

    End Function

    Public varSet, varData, varReturn As Variant in base module

    In lisp I reformat an assoc list with the command name and tool tip text into a string divided by vbVerticalTab and vbCr to pass as an argument to the function cmd_form.

    Peter
     
    petersciganek, Jan 9, 2004
    #3
  4. Should anyone be interested or have a similar problem - I recently stumbled across the (a?) solution. If I use 'me' rather than frmCmd (i.e. me.Move me.Left, me.Top, me.Width, h instead of frmCmd.Move frmCmd.Left, frmCmd.Top, frmCmd.Width, h) then the form resizes as expected.

    I assume that me and frmCmd refer to the same object - but it seems that 'me' reacts differently to methods than the object does when called by name.

    Peter
     
    petersciganek, Jul 5, 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.