Page 1 of 1
Wizards >> Textbox Focus >> call jpg / bmp
Posted:
Fri Jan 04, 2019 10:25 pm
by Robertspark
With a wizards / Macro with a form.
Is there a way that if I clicked within a text box I could call a jpg / bmp to display within the form
Say I have a rectangle, and it has an Width and Height dimension, if I clicked on the Width text box to enter data a jpg would show to heighlight the dimension with a secondary image. Then when I clicked on the Height textbox that jpg would be over-ridden an a new one would be shown in its place.
Thanks in advance for any suggestions,
As always,
Rob
Re: Wizards >> Textbox Focus >> call jpg / bmp
Posted:
Fri Jan 04, 2019 10:41 pm
by cncdrive
Hi Rob,
Yes, ofcourse it is possible.
You can attach any control events which the textbox has and then you can define the event handler after the #Events in the macro, because that is where the UCCNC macro compiler places the text into global space for the macro class.
So, you can handle the event in there.
Basicly you do it the same way like how doing it in a standard C# Forms application, the only difference is that in the UCCNC macro the #Events word defines the beginning of the global space, because you have no access to that since the macro text is already inside a function of the macro class, but the #Events gives you access to the global space of the class...
Re: Wizards >> Textbox Focus >> call jpg / bmp
Posted:
Fri Jan 04, 2019 11:24 pm
by Robertspark
Would it be something like this?
- Code: Select all
private void textBox1_MouseClick(object sender, MouseEventArgs e)
{
pictureBox1.Visible = true;
}
private void textBox1_MouseHover(object sender, EventArgs e)
{
pictureBox1.Visible = true;
}
private void textBox1_MouseLeave(object sender, EventArgs e)
{
pictureBox1.Visible = false;
}
Re: Wizards >> Textbox Focus >> call jpg / bmp
Posted:
Fri Jan 04, 2019 11:37 pm
by Robertspark
- Code: Select all
private void textBox1_Leave(object sender, EventArgs e)
{
pictureBox1.Visible = false;
}
private void textBox1_Enter(object sender, EventArgs e)
{
pictureBox1.Visible = true;
}
private void textBox1_MouseHover(object sender, EventArgs e)
{
pictureBox1.Visible = true;
}
private void textBox1_MouseLeave(object sender, EventArgs e)
{
pictureBox1.Visible = false;
}
This one may be better as it works for tab and mouse
Re: Wizards >> Textbox Focus >> call jpg / bmp
Posted:
Fri Jan 04, 2019 11:52 pm
by cncdrive
Yes, like that, but don't forget that you also have to subsribe the event for it to fire.
Like how it is described on this link:
https://docs.microsoft.com/en-us/dotnet ... rom-events
Re: Wizards >> Textbox Focus >> call jpg / bmp
Posted:
Sat Jan 05, 2019 12:19 am
by Robertspark
Thanks VERY much {needs a bit of editing but the below is a good start}
- Code: Select all
this.textBox1.Enter += new System.EventHandler(this.textBox1_Enter);
this.textBox1.Leave += new System.EventHandler(this.textBox1_Leave);
this.textBox1.MouseLeave += new System.EventHandler(this.textBox1_MouseLeave);
this.textBox1.MouseHover += new System.EventHandler(this.textBox1_MouseHover);
..... my long term plan of emulating the following / something similar ...
Re: Wizards >> Textbox Focus >> call jpg / bmp
Posted:
Sat Jan 05, 2019 12:47 am
by Robertspark
YES!!!! it works!!!!!
Hover over, tab to, select and deselect "start angle" and "hole depth"
Nope not one of my macro wizards.... just edited one of Terrys