hexagon logo

Using Variables in OptionButtons

I'm able to combine assignments and text strings together in other assignments, but how do you do it in the text of an optionbutton for example?

Is it even possible?
Parents
  • If you are creating the dialogs within your script (PC-DMIS script editor/Cypress Enable) you can, but if you are using COM/OLE automation from an external application, then it's a different story.

    You will need to set the optionbutton property before you call the dialog creation.
    See this snippet of mine below:

    Begin Dialog CINTDLG 82,24, 168, 167, "Intersections"
      OKButton 124,152,37,12
      CancelButton 4,152,37,12
      TextBox 60,36,101,12, .XEdit
      TextBox 60,56,101,12, .YEdit
      TextBox 60,76,101,12, .ZEdit
      TextBox 60,100,37,12, .RadiiEdit
      'CheckBox 60,128,77,12, "Use '0+' syntax", .CheckBox_1
    
      TextBox 92,12,41,12, [COLOR="Red"].CINTn[/COLOR][COLOR="Blue"]<--- The textbox 'holding' my variable[/COLOR]
    
      Text 4,12,77,12, "Enter coordinates for:"
      Text 8,36,37,12, "X-coord:"
      Text 8,56,37,12, "Y-coord:"
      Text 8,76,37,12, "Z-coord:"
      Text 8,100,37,12, "Bend radii:"
    End Dialog
    
    Dim DLG As CINTDLG
    Dim XC As String
    Dim YC As String
    Dim ZC As String
    Dim Rad As String
    
    CRcnt = 0
    
    For cnt = 1 To LINcnt + 1
      [COLOR="red"]DLG.CINTn [/COLOR]= "CINT" & cnt [COLOR="Blue"] <--- Changes the contents of the textbox before creating the dialog[/COLOR]
      CINTButton = Dialog(DLG) [COLOR="Blue"]<--- Create/show the dialog[/COLOR]
Reply
  • If you are creating the dialogs within your script (PC-DMIS script editor/Cypress Enable) you can, but if you are using COM/OLE automation from an external application, then it's a different story.

    You will need to set the optionbutton property before you call the dialog creation.
    See this snippet of mine below:

    Begin Dialog CINTDLG 82,24, 168, 167, "Intersections"
      OKButton 124,152,37,12
      CancelButton 4,152,37,12
      TextBox 60,36,101,12, .XEdit
      TextBox 60,56,101,12, .YEdit
      TextBox 60,76,101,12, .ZEdit
      TextBox 60,100,37,12, .RadiiEdit
      'CheckBox 60,128,77,12, "Use '0+' syntax", .CheckBox_1
    
      TextBox 92,12,41,12, [COLOR="Red"].CINTn[/COLOR][COLOR="Blue"]<--- The textbox 'holding' my variable[/COLOR]
    
      Text 4,12,77,12, "Enter coordinates for:"
      Text 8,36,37,12, "X-coord:"
      Text 8,56,37,12, "Y-coord:"
      Text 8,76,37,12, "Z-coord:"
      Text 8,100,37,12, "Bend radii:"
    End Dialog
    
    Dim DLG As CINTDLG
    Dim XC As String
    Dim YC As String
    Dim ZC As String
    Dim Rad As String
    
    CRcnt = 0
    
    For cnt = 1 To LINcnt + 1
      [COLOR="red"]DLG.CINTn [/COLOR]= "CINT" & cnt [COLOR="Blue"] <--- Changes the contents of the textbox before creating the dialog[/COLOR]
      CINTButton = Dialog(DLG) [COLOR="Blue"]<--- Create/show the dialog[/COLOR]
Children
No Data