PC-DMIS 2022.1 Object Library
AddControl Method
See Also  Send Topic Feedback | See Object Hierarchy Chart
ObjectType
Left
Top
Right
Bottom
PCDLRN ActiveX DLL > ReportControls Collection : AddControl Method

Glossary Item Box

Description

 

This method works like the normal Add method except that the control adds a new object type that shows its properties.

The properties available to this new object type are:

Application - (Get) reference to the application object
Parent - (Get) reference to the parent object (ReportingControls)
Top - (Put/Get) Top position of the report control window
Bottom - (Put/Get) Bottom position of the report control window
Left - (Put/Get) Left position of the report control window
Right - (Put/Get) Right position of the report control window
ID - (Get) The ID of the report control - The name of the control
Selected - (Put/Get) selection state of the report control
Visible - (Put/Get) visible state of the report control
Height - (Put/Get) The height of the report control
Width - (Put/Get) The width of the report control
Type - (Get) The type of control
Command - (Get) The underlying command

Syntax

Visual Basic
Public Function AddControl( _
   ByVal ObjectType As ENUM_REPORT_TEMPLATE_OBJECTS, _
   ByVal Left As Long, _
   ByVal Top As Long, _
   ByVal Right As Long, _
   ByVal Bottom As Long _
) As ReportControl

Parameters

ObjectType
ValueDescription
ID_HOB_ARC 
ID_HOB_BITMAP 
ID_HOB_BORDER 
ID_HOB_CADIMAGEOBJECT_OB 
ID_HOB_CIRCLE 
ID_HOB_GAUGE 
ID_HOB_GRAPH 
ID_HOB_LINE 
ID_HOB_PCD_ANALWIN_OB 
ID_HOB_PCD_CAD_REPORT_OBJECT 
ID_HOB_PCD_COMMAND_TEXT_OB 
ID_HOB_PCD_DIMCOLOR_OB 
ID_HOB_PCD_GRID_CTRL_OB 
ID_HOB_PCD_LABEL_OB 
ID_HOB_PCD_LEADERLINE_OB 
ID_HOB_PCD_SPC_CHART_OB 
ID_HOB_PCD_TEXT_REPORT_OBJECT 
ID_HOB_POLYLINE 
ID_HOB_PTR 
ID_HOB_TEXT 
ID_HOB_TEXT_RT 
Left
Top
Right
Bottom

Example

Private Sub Command1_Click()
  Dim App As PCDLRN.Application
  Set App = CreateObject("PCDLRN.Application")
  Dim Part As PCDLRN.PartProgram
  Set Part = App.ActivePartProgram
  Dim RprtWindow As PCDLRN.ReportWindow
  Set RprtWindow = Part.ReportWindow
  Dim Pages As PCDLRN.Pages
  Set Pages = RprtWindow.Pages
  Dim Page As PCDLRN.Page
  Set Page = Pages.Item(1)
  Dim RptControls As PCDLRN.ReportControls
  Set RptControls = Page.ReportControls
  Dim Control As PCDLRN.CReportControl
  Dim Cmd As PCDLRN.Command
  Dim Count As Integer
  Count = RptControls.Count
  Dim Index As Integer
  Index = 1
  While (Index <= Count)
    Set Control = RptControls.ItemControl(Index)
    If Control.Type = ID_HOB_PCD_LABEL_OB Then
      MsgBox "Label " & Control.ID & " - Top: " & Control.Top & ", Bottom: " & Control.Bottom & ", Left: " & Control.Left & ", Right: " & Control.Right
      MsgBox "Moving Down By 40"
      Control.Top = Control.Top + 40
      MsgBox "Setting to selected"
      Control.Selected = True
      MsgBox "Hiding Label"
      Control.Visible = False
      Set Cmd = Control.Command
      If Not Cmd Is Nothing Then
        MsgBox "The command for this label is ID=" & Cmd.ID
      End If
      MsgBox "Height = " & Control.Height & ", Width = " & Control.Width
      Control.Height = Control.Height + 50
      Control.Width = Control.Width + 50
    End If
    If Control.Type = ID_HOB_PCD_CAD_REPORT_OBJECT Then
      MsgBox "Found Cad Object with ID = " & Control.ID
    End If
    Index = Index + 1
  Wend
End Sub

See Also

Copyright © 2022. Hexagon Manufacturing Intelligence – Metrology Software, Inc. All Rights Reserved.