﻿Option Strict Off
Option Explicit On 
Friend Class OrgSet
	Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

	Public Sub New()
		MyBase.New()

		'This call is required by the Windows Form Designer.
		InitializeComponent()

		'Add any initialization after the InitializeComponent() call

	End Sub

	'Form overrides dispose to clean up the component list.
	Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
		If disposing Then
			If Not (components Is Nothing) Then
				components.Dispose()
			End If
		End If
		MyBase.Dispose(disposing)
	End Sub

	'Required by the Windows Form Designer
	Private components As System.ComponentModel.IContainer

	'NOTE: The following procedure is required by the Windows Form Designer
	'It can be modified using the Windows Form Designer.  
	'Do not modify it using the code editor.
	Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
	Friend WithEvents chkZUse As System.Windows.Forms.CheckBox
	Friend WithEvents Label1 As System.Windows.Forms.Label
	Friend WithEvents cboZCount As System.Windows.Forms.ComboBox
	Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
	Friend WithEvents rdoDirDisable As System.Windows.Forms.RadioButton
	Friend WithEvents rdoPlusDir As System.Windows.Forms.RadioButton
	Friend WithEvents rdoMinusDir As System.Windows.Forms.RadioButton
	Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox
	Friend WithEvents chkOrg As System.Windows.Forms.CheckBox
	Friend WithEvents chkZ As System.Windows.Forms.CheckBox
	Friend WithEvents txtOrg As System.Windows.Forms.TextBox
	Friend WithEvents txtZ As System.Windows.Forms.TextBox
	Friend WithEvents chkLimTurn As System.Windows.Forms.CheckBox
    Friend WithEvents btnComReturn As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.GroupBox2 = New System.Windows.Forms.GroupBox()
        Me.rdoMinusDir = New System.Windows.Forms.RadioButton()
        Me.rdoPlusDir = New System.Windows.Forms.RadioButton()
        Me.rdoDirDisable = New System.Windows.Forms.RadioButton()
        Me.cboZCount = New System.Windows.Forms.ComboBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.chkZUse = New System.Windows.Forms.CheckBox()
        Me.GroupBox3 = New System.Windows.Forms.GroupBox()
        Me.txtZ = New System.Windows.Forms.TextBox()
        Me.txtOrg = New System.Windows.Forms.TextBox()
        Me.chkZ = New System.Windows.Forms.CheckBox()
        Me.chkOrg = New System.Windows.Forms.CheckBox()
        Me.chkLimTurn = New System.Windows.Forms.CheckBox()
        Me.btnComReturn = New System.Windows.Forms.Button()
        Me.GroupBox1.SuspendLayout()
        Me.GroupBox2.SuspendLayout()
        Me.GroupBox3.SuspendLayout()
        Me.SuspendLayout()
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.GroupBox2, Me.cboZCount, Me.Label1, Me.chkZUse})
        Me.GroupBox1.Location = New System.Drawing.Point(16, 16)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(208, 200)
        Me.GroupBox1.TabIndex = 0
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "ORG Type"
        '
        'GroupBox2
        '
        Me.GroupBox2.Controls.AddRange(New System.Windows.Forms.Control() {Me.rdoMinusDir, Me.rdoPlusDir, Me.rdoDirDisable})
        Me.GroupBox2.Location = New System.Drawing.Point(16, 88)
        Me.GroupBox2.Name = "GroupBox2"
        Me.GroupBox2.Size = New System.Drawing.Size(176, 96)
        Me.GroupBox2.TabIndex = 3
        Me.GroupBox2.TabStop = False
        Me.GroupBox2.Text = "EndDirType :"
        '
        'rdoMinusDir
        '
        Me.rdoMinusDir.Location = New System.Drawing.Point(16, 72)
        Me.rdoMinusDir.Name = "rdoMinusDir"
        Me.rdoMinusDir.Size = New System.Drawing.Size(128, 16)
        Me.rdoMinusDir.TabIndex = 2
        Me.rdoMinusDir.Text = "Minus Dir"
        '
        'rdoPlusDir
        '
        Me.rdoPlusDir.Location = New System.Drawing.Point(16, 48)
        Me.rdoPlusDir.Name = "rdoPlusDir"
        Me.rdoPlusDir.Size = New System.Drawing.Size(128, 16)
        Me.rdoPlusDir.TabIndex = 1
        Me.rdoPlusDir.Text = "Plus Dir"
        '
        'rdoDirDisable
        '
        Me.rdoDirDisable.Location = New System.Drawing.Point(16, 24)
        Me.rdoDirDisable.Name = "rdoDirDisable"
        Me.rdoDirDisable.Size = New System.Drawing.Size(128, 16)
        Me.rdoDirDisable.TabIndex = 0
        Me.rdoDirDisable.Text = "Disable"
        '
        'cboZCount
        '
        Me.cboZCount.Location = New System.Drawing.Point(80, 54)
        Me.cboZCount.Name = "cboZCount"
        Me.cboZCount.Size = New System.Drawing.Size(104, 23)
        Me.cboZCount.TabIndex = 2
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(16, 56)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(55, 14)
        Me.Label1.TabIndex = 1
        Me.Label1.Text = "Z Count :"
        '
        'chkZUse
        '
        Me.chkZUse.Location = New System.Drawing.Point(16, 24)
        Me.chkZUse.Name = "chkZUse"
        Me.chkZUse.TabIndex = 0
        Me.chkZUse.Text = "Z : USE"
        '
        'GroupBox3
        '
        Me.GroupBox3.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtZ, Me.txtOrg, Me.chkZ, Me.chkOrg})
        Me.GroupBox3.Location = New System.Drawing.Point(240, 16)
        Me.GroupBox3.Name = "GroupBox3"
        Me.GroupBox3.Size = New System.Drawing.Size(200, 96)
        Me.GroupBox3.TabIndex = 1
        Me.GroupBox3.TabStop = False
        Me.GroupBox3.Text = "ORG Logic"
        '
        'txtZ
        '
        Me.txtZ.Enabled = False
        Me.txtZ.Location = New System.Drawing.Point(88, 56)
        Me.txtZ.Name = "txtZ"
        Me.txtZ.ReadOnly = True
        Me.txtZ.Size = New System.Drawing.Size(96, 21)
        Me.txtZ.TabIndex = 3
        Me.txtZ.Text = "Low Active "
        '
        'txtOrg
        '
        Me.txtOrg.Enabled = False
        Me.txtOrg.Location = New System.Drawing.Point(88, 22)
        Me.txtOrg.Name = "txtOrg"
        Me.txtOrg.ReadOnly = True
        Me.txtOrg.Size = New System.Drawing.Size(96, 21)
        Me.txtOrg.TabIndex = 2
        Me.txtOrg.Text = "Low Active "
        '
        'chkZ
        '
        Me.chkZ.Checked = True
        Me.chkZ.CheckState = System.Windows.Forms.CheckState.Checked
        Me.chkZ.Location = New System.Drawing.Point(16, 56)
        Me.chkZ.Name = "chkZ"
        Me.chkZ.Size = New System.Drawing.Size(56, 16)
        Me.chkZ.TabIndex = 1
        Me.chkZ.Text = "Z"
        '
        'chkOrg
        '
        Me.chkOrg.Checked = True
        Me.chkOrg.CheckState = System.Windows.Forms.CheckState.Checked
        Me.chkOrg.Location = New System.Drawing.Point(16, 24)
        Me.chkOrg.Name = "chkOrg"
        Me.chkOrg.Size = New System.Drawing.Size(56, 16)
        Me.chkOrg.TabIndex = 0
        Me.chkOrg.Text = "ORG"
        '
        'chkLimTurn
        '
        Me.chkLimTurn.Checked = True
        Me.chkLimTurn.CheckState = System.Windows.Forms.CheckState.Checked
        Me.chkLimTurn.Location = New System.Drawing.Point(240, 128)
        Me.chkLimTurn.Name = "chkLimTurn"
        Me.chkLimTurn.Size = New System.Drawing.Size(112, 24)
        Me.chkLimTurn.TabIndex = 2
        Me.chkLimTurn.Text = "LimitTurn Use"
        '
        'btnComReturn
        '
        Me.btnComReturn.Location = New System.Drawing.Point(360, 184)
        Me.btnComReturn.Name = "btnComReturn"
        Me.btnComReturn.Size = New System.Drawing.Size(80, 24)
        Me.btnComReturn.TabIndex = 4
        Me.btnComReturn.Text = "&Return"
        '
        'OrgSet
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(456, 230)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnComReturn, Me.chkLimTurn, Me.GroupBox3, Me.GroupBox1})
        Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "OrgSet"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "ORG Setting"
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox2.ResumeLayout(False)
        Me.GroupBox3.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub chkLimTurn_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkLimTurn.Click

        If chkLimTurn.CheckState = 1 Then
            LimitTurn = 1
        ElseIf chkLimTurn.CheckState = 0 Then
            LimitTurn = 0
        End If

    End Sub

    Private Sub chkOrg_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkOrg.Click

        If chkOrg.CheckState = 1 Then
            txtOrg.Text = "Low Active"
            OrgLog = OrgLog Xor &H1
        ElseIf chkOrg.CheckState = 0 Then
            txtOrg.Text = "High Active"
            OrgLog = OrgLog Or &H1
        End If

    End Sub

    Private Sub chkZ_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkZ.Click

        If chkZ.CheckState = 1 Then
            txtZ.Text = "Low Active"
            OrgLog = OrgLog Xor &H2
        ElseIf chkZ.CheckState = 0 Then
            txtZ.Text = "High Active"
            OrgLog = OrgLog Or &H2
        End If

    End Sub

    Private Sub chkZUse_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkZUse.Click

        If chkZUse.CheckState = 1 Then
            cboZCount.Enabled = True
            OrgType = 1
        ElseIf chkZUse.CheckState = 0 Then
            cboZCount.Enabled = False
            OrgType = 0
        End If

    End Sub

    Private Sub cboZCount_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboZCount.SelectedIndexChanged

        ZCount = cboZCount.SelectedIndex + 1

    End Sub



    Private Sub btnComReturn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnComReturn.Click

        Me.Close()

    End Sub

    Private Sub OrgSet_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim n As Short

        If OrgType = 0 Then
            chkZUse.CheckState = 0
        Else
            chkZUse.CheckState = 1
        End If
        chkZUse_Click(sender, e)

        ' ZCount ComboBox
        cboZCount.Items.Clear()
        For n = 1 To 16
            cboZCount.Items.Add(Str(n))
        Next

        ' ComboBox Initialise
        cboZCount.SelectedIndex = ZCount - 1

        ' EndDir OptionButton
        rdoDirDisable.Checked = False
        rdoPlusDir.Checked = False
        rdoMinusDir.Checked = False
        Select Case EndDir
            Case 0
                rdoDirDisable.Checked = True
            Case 1
                rdoPlusDir.Checked = True
            Case 2
                rdoMinusDir.Checked = True
        End Select

        ' OrgLog CheckBox
        If (OrgLog And &H1) Then
            chkOrg.CheckState = 0
        End If

        If (OrgLog And &H2) Then
            chkZ.CheckState = 0
        End If

        ' LimitTurn CheckBox
        ' CheckBox Initialise
        chkLimTurn.Checked = LimitTurn

    End Sub

    Private Sub rdoDirDisable_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdoDirDisable.Click

        EndDir = 0

    End Sub

    Private Sub rdoPlusDir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdoPlusDir.Click

        EndDir = 1

    End Sub

    Private Sub rdoMinusDir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdoMinusDir.Click

        EndDir = 2

    End Sub


End Class
