problem resizing form in activex dll

petersciganek

Usenet Archive
Joined
Jul 7, 2003
Messages
82
Reaction score
0
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.
 
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.
 
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
 
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
 

Latest threads

Back
Top