public void SetButtonFromConfig(string buttonName, string buttonValue) { // lookup from buttonNames to get the right index var idx = buttonNames.ToList().IndexOf(buttonName); Console.WriteLine("INDEX FOUND: " + idx.ToString()); if (idx != -1) { //buttonValues[idx] = buttonValue; //currentButtons[idx].NormalCommand = buttonValue; selectedButton = currentButtons[idx]; SetNormCommand(buttonValue); SetButtonValue(buttonValue); SetButtonText(); } }
public void LoadButtons(Action <object, MouseEventArgs> mouseHandler, TabPage tabPage) { // remove buttons here while (currentButtons.Count > 0) { BoxButton a = currentButtons[0]; currentButtons.RemoveAt(0); tabPage.Controls.Remove(a); } for (var i = 0; i < numButtons; i++) { BoxButton temp = new BoxButton(buttonValues[i], buttonPos[i], i); temp.MouseDown += new MouseEventHandler(mouseHandler); tabPage.Controls.Add(temp); currentButtons.Add(temp); } mainTab = tabPage; }
public void SetSelectedButton(object selected) { this.selectedButton = selected as BoxButton; }