0
\$\begingroup\$

I am developing a character creator using Windows Forms (because apparently I can't create menus in Unity), and I want to display some tips and descriptions in a RichTextBox located by the options when the user's mouse hover by its GroupBoxes.

Since I am fairly new to programming I don't know if getting all the controls' names one by one is the optimal, so I want to grab the controls' names inside of the tabControl control that I am using to organize everything.

private void TabControl1_MouseHover(object sender, EventArgs e)
        {
            foreach(Control c in this.Controls)
            {
                string name = c.Name;
                TooltipText(name);
            }
        }

And I also have a method where I will write the text that will be displayed in the RichTextBox

private string TooltipText(string name)
        {
            if(name == "Name:")
            {
                return "blabla";
            }
            else
            {
                return "none";
            }
        }

I've tried a generic method to show a message box if the control was detected and, as I suspected, nothing showed up:

private void TooltipText(string name)
        {
            if(name == "LBL_Name")
            {
                MessageBox.Show("hey");
                return;
            }
        }

How can I properly detect the GroupBoxes or other types of controls inside of the TabControl control and also display the text in the box beside it?

\$\endgroup\$
2
  • \$\begingroup\$ What leads you to believe "apparently I can't create menus in Unity"? \$\endgroup\$ – DMGregory Oct 13 '19 at 8:49
  • \$\begingroup\$ @DMGregory because, at least for now, I don't have enough experience in creating menus and creating a text based, menu oriented game in Unity has been quite chealenging for me. I can't find any good or focused resources that can help me. On the other hand, a could find a lot of information on how to use windows forms, so I am trying this for now. \$\endgroup\$ – JoeKalango Oct 13 '19 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.