hexagon logo

DropDown List Box example

Free to use and change to meet your needs.

Hope this helps someone.

Dim PCDDmisApp As Object
    Dim PCDDmisPart As Object
    Dim PCDDmisCommands As Object
    Dim PCDDmisCommand As Object

Sub Main ()
    Set PCDDmisApp = CreateObject("PCDLRN.Application")
    Set PCDDmisPart = PCDDmisApp.ActivePartProgram
    Set PCDDmisCommands = PCDDmisPart.Commands

    Dim Command As Object
'    create a list of part numbers For the drop down list

        Dim MyList$(8)
        MyList(0) = "12345"
        MyList(1) = "12346"
        MyList(2) = "12347"
        MyList(3) = "12348"
        MyList(4) = "12349"
        MyList(5) = "22345"
        MyList(6) = "22346"
        MyList(7) = "22347"
        MyList(8) = "22348"
        
        Begin Dialog DialogName1 200,184, "Part Number Selection Dialog Box"
            Text 10,10,88,22, "Select a Part  Number:"
            DropListBox 42,76,108,186, MyList$(), .DropList1$
            CancelButton 42,108,40,12
            OKButton 90,108,40,12
        End Dialog

        Dim Dlg1 As DialogName1

'       Dlg1.DropList1  =  0 this shows item (0) default In the window In the drop down list
'       You can change it To show Any item On top from Mylist()
        Dlg1.DropList1  =  0

'       If cancel button is selected, Exit Sub
        Button = Dialog(Dlg1)
        If Button = 0 Then Exit Sub 
     
        Vari = Dlg1.DropList1
      
        Set PCDDmisCommand = PCDDmisCommands.Add(ASSIGNMENT,True)
        PCDDmisCommand.Marked = True
        retval = PCDDmisCommand.PutText("Part_Num",DEST_EXPR,0)
        retval = PCDDmisCommand.PutText(mylist$(vari),SRC_EXPR,0)
        
End Sub


Parents
  • I have an icon assigned to another vbs script called extern.bas that puts the command into my programs.

    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim DmisCommands As Object
    Dim DmisCommand As Object
    
    Sub Part1
      Set DmisApp = CreateObject("PCDLRN.Application")
      Set DmisPart = DmisApp.ActivePartProgram
      Set DmisCommands = DmisPart.Commands
      CommandCount = DmisCommands.Count
      Set DmisCommand = DmisCommands.Item(CommandCount)
      DmisCommands.InsertionPointAfter DmisCommand
       
      Set DmisCommand = DmisCommands.Add(BASIC_SCRIPT, True)
        DmisCommand.Marked = True
      ' Set Id  = CS1
        retval = DmisCommand.PutText ("CS1", ID, 0)
      ' Set Filename  = S:\PC-DMIS Programs\PC-DMIS Basic Scripts\TRACEFIELDEX.BAS
        retval = DmisCommand.PutText ("S:\PC-DMIS Programs\PC-DMIS Basic Scripts\TRACEFIELDEX.BAS", FILE_NAME, 0)
      ' Set Subroutine Name  = Main
        retval = DmisCommand.PutText ("Main", SUB_NAME, 0)
      ' Set Show Details  = YES
        retval = DmisCommand.SetToggleString (2, SHOW_DETAILS, 0)
      
    End Sub
    
    Sub Main
    
      Part1
    
      DmisPart.RefreshPart
    End Sub
Reply
  • I have an icon assigned to another vbs script called extern.bas that puts the command into my programs.

    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim DmisCommands As Object
    Dim DmisCommand As Object
    
    Sub Part1
      Set DmisApp = CreateObject("PCDLRN.Application")
      Set DmisPart = DmisApp.ActivePartProgram
      Set DmisCommands = DmisPart.Commands
      CommandCount = DmisCommands.Count
      Set DmisCommand = DmisCommands.Item(CommandCount)
      DmisCommands.InsertionPointAfter DmisCommand
       
      Set DmisCommand = DmisCommands.Add(BASIC_SCRIPT, True)
        DmisCommand.Marked = True
      ' Set Id  = CS1
        retval = DmisCommand.PutText ("CS1", ID, 0)
      ' Set Filename  = S:\PC-DMIS Programs\PC-DMIS Basic Scripts\TRACEFIELDEX.BAS
        retval = DmisCommand.PutText ("S:\PC-DMIS Programs\PC-DMIS Basic Scripts\TRACEFIELDEX.BAS", FILE_NAME, 0)
      ' Set Subroutine Name  = Main
        retval = DmisCommand.PutText ("Main", SUB_NAME, 0)
      ' Set Show Details  = YES
        retval = DmisCommand.SetToggleString (2, SHOW_DETAILS, 0)
      
    End Sub
    
    Sub Main
    
      Part1
    
      DmisPart.RefreshPart
    End Sub
Children
No Data