Note that there are some explanatory texts on larger screens.

plurals
  1. POContextMenuStrip Hide and UnHide Buttons
    primarykey
    data
    text
    <p>I'm working on a System Tray Application for a project. I'm currently stuck on when I click on "Toggle On" it won't change itself to "Toggle Off", I was hoping that maybe someone could tell me what i'm doing wrong and help me with fixing it.</p> <p>Code for the Context Menu</p> <pre><code>using System; using System.Diagnostics; using System.Windows.Forms; using TestApplicationforRIVC.Properties; using System.Drawing; namespace TestApplicationforRIVC { class RIVCContextMenu { //Is Add Box Displayed? bool isAddLoaded = false; //Is the Clear box Displayed? bool isClearLoaded = false; //Is it listening for voice? bool toggleOn = false; //Creates this Instance public ContextMenuStrip Create() { //Add the Default Menu Options ContextMenuStrip menu = new ContextMenuStrip(); ToolStripMenuItem item; ToolStripMenuItem off; ToolStripSeparator sep; if(toggleOn) { //Toggle Off item = new ToolStripMenuItem(); item.Text = "Toggle Off"; item.Click += new EventHandler(toggleOffClick); item.Image = Resources.toggleOff; menu.Items.Add(item); } if(!toggleOn) { //Toggle On item = new ToolStripMenuItem(); item.Text = "Toggle On"; item.Click += new EventHandler(toggleOnClick); item.Image = Resources.toggleOn; menu.Items.Add(item); } // Separator. sep = new ToolStripSeparator(); menu.Items.Add(sep); //Add to RIVC Library item = new ToolStripMenuItem(); item.Text = "Add to Library"; item.Click += new EventHandler(addClick); item.Image = Resources.Add; menu.Items.Add(item); //Clear RIVC Library item = new ToolStripMenuItem(); item.Text = "Clear Library"; item.Click += new EventHandler(clearClick); item.Image = Resources.Delete; menu.Items.Add(item); // Separator. sep = new ToolStripSeparator(); menu.Items.Add(sep); //Exit Program item = new ToolStripMenuItem(); item.Text = "Exit"; item.Click += new System.EventHandler(exitClick); item.Image = Resources.Exit; menu.Items.Add(item); return menu; } //Handles the Click Event of the Toggle On Control void toggleOnClick(object sender, EventArgs e) { toggleOn = true; } //Handles the Click Even of the Toggle Off Control void toggleOffClick(object sender, EventArgs e) { toggleOn = false; } //Handles the Click Event of the Add Control void addClick(object sender, EventArgs e) { if(!isAddLoaded) { isAddLoaded = true; //enter Dialog Box Info isAddLoaded = false; } } //Handles the Click Event of the Clear Control void clearClick(object sender, EventArgs e) { if(!isClearLoaded) { isClearLoaded = true; //enter dialog box info isClearLoaded = false; } } //Handles the Click Event of the Exit Control void exitClick(object sender, EventArgs e) { Application.Exit(); } } } </code></pre> <p>Hopefully You guys can help me out with solving this little bug.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload