Example #1
0
        private void RTxTypedAMessages_TextChanged(object sender, EventArgs e)
        {
            // Message Entry Area
            //--------------------

            // positition text cursor at end of message
            // and allows me to edit the message

            RTxTypedAMessages.SelectionStart = RTxTypedAMessages.TextLength + 1;
            RTxTypedAMessages.Focus();

            LblCharacterCountRes.Text = RTxTypedAMessages.TextLength.ToString();

            // Highlights text
            if (RTxTypedAMessages.SelectionBackColor == Color.Yellow)
            {
                RTxTypedAMessages.SelectionBackColor = Color.White;
                RTxTypedAMessages.Focus();
            }
            // Error checks
            if (LBxMyMessages.SelectedItem != null &&
                RTxTypedAMessages.TextLength < LBxMyMessages.Text.Length ||
                RTxTypedAMessages.TextLength > LBxMyMessages.Text.Length)
            {
                // Edit check
                EditMode = true;
            }
            else
            {
                EditMode = false;
            }

            // Error check
            if (EditMode && LBxMyMessages.SelectedItem == null &&
                RTxTypedAMessages.TextLength > 0)
            {
                BtnChoiceOne.Text = "Add";
                BtnChoiceTwo.Text = "Delete";
            }

            // Edit mode enabled
            if (EditMode == true)
            {
                BtnChoiceOne.Text = "Edit";
                BtnChoiceTwo.Text = "Copy";
                SubEnabledButtons();
            }

            // Edit mode disabled
            if (EditMode == false)
            {
                BtnChoiceOne.Text = "Copy";
                BtnChoiceTwo.Text = "Delete";
                SubEnabledButtons();
            }

            // Error check
            if (LBxMyMessages.SelectedItem == null && RTxTypedAMessages.TextLength == 0)
            {
                BtnChoiceOne.Text = "Add";
                BtnChoiceTwo.Text = "Clear";
                SubDisablesButtons();
            }

            // Error check
            else if (LBxMyMessages.SelectedItem == null && RTxTypedAMessages.TextLength > 0)
            {
                BtnChoiceOne.Text = "Add";
                BtnChoiceTwo.Text = "Clear";
                SubEnabledButtons();
            }

            // Error check
            else if (LBxMyMessages.SelectedItem != null && RTxTypedAMessages.TextLength == 0)
            {
                LBxMyMessages.ClearSelected();
                BtnChoiceOne.Text = "Add";
                BtnChoiceTwo.Text = "Clear";
                SubDisablesButtons();
            }
        }
Example #2
0
        private void RTxTypedAMessages_TextChanged(object sender, EventArgs e)
        {
            // Message Entry Area
            //--------------------

            // positition text cursor at end of message
            // and allows me to edit the message

            RTxTypedAMessages.SelectionStart = RTxTypedAMessages.TextLength + 1;
            RTxTypedAMessages.Focus();

            LblCharacterCountRes.Text = RTxTypedAMessages.TextLength.ToString();

            if (RTxTypedAMessages.SelectionBackColor == Color.Yellow)
            {
                RTxTypedAMessages.SelectionBackColor = Color.White;
                RTxTypedAMessages.Focus();
            }

            if (LBxMyMessages.SelectedItem != null &&
                RTxTypedAMessages.TextLength < LBxMyMessages.Text.Length ||
                RTxTypedAMessages.TextLength > LBxMyMessages.Text.Length)
            {
                EditMode = true;
                PBxEditModeLED.Visible = true;
            }
            else
            {
                EditMode = false;
                PBxEditModeLED.Visible = false;
            }

            if (EditMode && LBxMyMessages.SelectedItem == null &&
                RTxTypedAMessages.TextLength > 0)
            {
                BtnChoiceOne.Text      = "Add";
                BtnChoiceTwo.Text      = "Delete";
                PBxEditModeLED.Visible = false;
            }

            if (EditMode == true)
            {
                BtnChoiceOne.Text        = "Edit";
                BtnChoiceTwo.Text        = "Copy";
                BtnChoiceOne.Enabled     = true;
                BtnChoiceTwo.Enabled     = true;
                PBxEditModeLED.BackColor = Color.Green;
            }

            if (EditMode == false)
            {
                BtnChoiceOne.Text        = "Copy";
                BtnChoiceTwo.Text        = "Delete";
                BtnChoiceOne.Enabled     = true;
                BtnChoiceTwo.Enabled     = true;
                PBxEditModeLED.BackColor = Color.Green;
            }

            if (LBxMyMessages.SelectedItem == null && RTxTypedAMessages.TextLength == 0)
            {
                BtnChoiceOne.Text    = "Add";
                BtnChoiceTwo.Text    = "Clear";
                BtnChoiceOne.Enabled = false;
                BtnChoiceTwo.Enabled = false;
            }
            else if (LBxMyMessages.SelectedItem == null && RTxTypedAMessages.TextLength > 0)
            {
                BtnChoiceOne.Text    = "Add";
                BtnChoiceTwo.Text    = "Clear";
                BtnChoiceOne.Enabled = true;
                BtnChoiceTwo.Enabled = true;
            }
            else if (LBxMyMessages.SelectedItem != null && RTxTypedAMessages.TextLength == 0)
            {
                LBxMyMessages.ClearSelected();
                PBxEditModeLED.Visible = false;
                BtnChoiceOne.Text      = "Add";
                BtnChoiceTwo.Text      = "Clear";
                BtnChoiceOne.Enabled   = true;
                BtnChoiceTwo.Enabled   = true;
            }
        }