Wizards >> Textbox Focus >> call jpg / bmp

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Wizards >> Textbox Focus >> call jpg / bmp

Postby Robertspark » Fri Jan 04, 2019 10:25 pm

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
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2108, Neuron Lite
UCCNC v1.2108 Macro Manual
Robertspark
 
Posts: 1208
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: Wizards >> Textbox Focus >> call jpg / bmp

Postby cncdrive » Fri Jan 04, 2019 10:41 pm

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...
cncdrive
Site Admin
 
Posts: 2461
Joined: Tue Aug 12, 2014 11:17 pm

Re: Wizards >> Textbox Focus >> call jpg / bmp

Postby Robertspark » Fri Jan 04, 2019 11:24 pm

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;
        }
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2108, Neuron Lite
UCCNC v1.2108 Macro Manual
Robertspark
 
Posts: 1208
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: Wizards >> Textbox Focus >> call jpg / bmp

Postby Robertspark » Fri Jan 04, 2019 11:37 pm

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
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2108, Neuron Lite
UCCNC v1.2108 Macro Manual
Robertspark
 
Posts: 1208
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: Wizards >> Textbox Focus >> call jpg / bmp

Postby cncdrive » Fri Jan 04, 2019 11:52 pm

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
cncdrive
Site Admin
 
Posts: 2461
Joined: Tue Aug 12, 2014 11:17 pm

Re: Wizards >> Textbox Focus >> call jpg / bmp

Postby Robertspark » Sat Jan 05, 2019 12:19 am

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 ...
Attachments
2019-01-05 00_16_19-Window.png
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2108, Neuron Lite
UCCNC v1.2108 Macro Manual
Robertspark
 
Posts: 1208
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: Wizards >> Textbox Focus >> call jpg / bmp

Postby Robertspark » Sat Jan 05, 2019 12:47 am

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
Attachments
M9094.zip
(22.21 KiB) Downloaded 14 times
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2108, Neuron Lite
UCCNC v1.2108 Macro Manual
Robertspark
 
Posts: 1208
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England


Return to Macros

Who is online

Users browsing this forum: No registered users and 5 guests