General Category > Application Showcase

MDIParent Form Model

(1/2) > >>

timryder:
I've used AHMI on several HMI Applications already but I didn't like the way that change the pages worked so I made my own MDI-Parent/Child form control and I've adapted it to work quite smoothly.  Having used this on several machines already I can say that I'm pretty happy with it.

This particular application is servicing a Micro850 PLC from Allen-Bradley over Ethernet and which has 2 Servo Linear stages for positioning parts directly under a laser marker.  There is also a built in Keyence camera which is being controlled by this application over Winsock TCP/IP.  This app has the ability to build custom part configurations for differing setups as well as store and open previously saved ones.  The HMI will synchronize with the PLC the coordinates for each of the parts programmed.

It also logs machine activity and Part data including Serial Number and Camera Pass/Fail to an excel spreadsheet per the customers request.

I have disabled the PLC coms so when you download the sample make sure to re-enable them if you plan on using this. AdvancedHMIControls project and then in the Subscriptionhandler.vb un-comment the SubscribeToComDriver method.











https://drive.google.com/drive/folders/0B8Vb3TS6SQwxTEROWWR0X1RwcTg?usp=sharing

Just click on the drop down above the files list and there will be an option to download it.

Phrog30:
I use MDIParent as well.  The only issue I have is the form borders will flash on occasion when changing forms.  I haven't quite figured that one out yet.  You were the one that gave me the idea... thanks by the way.

James

Noe:
Kudos! Great graphic design and clear organization, what every HMI should!

timryder:
I have the solution for you Phrog,
From the main MDIParent Form, Open each of the child forms during the Form_Load event.


--- Code: ---childFormMain.MdiParent = Me                                                      'Sets all of the application forms as MDI Children
        childFormAlarms.MdiParent = Me
        childFormManual.MdiParent = Me
        childFormMachineSetup.MdiParent = Me
        childFormPartSetup.MdiParent = Me

        childFormMain.Show()                                                              'Show all of the children initially to load them in memory
        childFormAlarms.Show()
        childFormManual.Show()
        childFormMachineSetup.Show()
        childFormPartSetup.Show()

        childFormMain.BringToFront()                                                      'The children are displayed using the BringToFront method, so here we show the first page.
        childFormMain.Focus()
--- End code ---

Then on the button click method (which doesn't have to be an AHMI "FormChangeButton" btw), use the following logic


--- Code: ---If Me.HasChildren = True Then
            For Each frm As Form In Me.MdiChildren
                If TypeOf (frm) Is frmManual Then
                    CType(frm, frmManual).BringToFront()
                    CType(frm, frmManual).Focus()
                    Me.Refresh()
                    Exit Sub
                End If
            Next
        End If
--- End code ---

Just change the "frmManual" to whatever form Name you're trying to show.  Make sure to set each forms "Name" property as that's how we're calling them.

So the basic idea is to open them all up ahead of time and then just bring to front the form you want to see.
No flashy at all.

Phrog30:

--- Quote from: timryder on September 12, 2017, 11:18:05 AM ---I have the solution for you Phrog,
From the main MDIParent Form, Open each of the child forms during the Form_Load event.


--- Code: ---childFormMain.MdiParent = Me                                                      'Sets all of the application forms as MDI Children
        childFormAlarms.MdiParent = Me
        childFormManual.MdiParent = Me
        childFormMachineSetup.MdiParent = Me
        childFormPartSetup.MdiParent = Me

        childFormMain.Show()                                                              'Show all of the children initially to load them in memory
        childFormAlarms.Show()
        childFormManual.Show()
        childFormMachineSetup.Show()
        childFormPartSetup.Show()

        childFormMain.BringToFront()                                                      'The children are displayed using the BringToFront method, so here we show the first page.
        childFormMain.Focus()
--- End code ---

Then on the button click method (which doesn't have to be an AHMI "FormChangeButton" btw), use the following logic


--- Code: ---If Me.HasChildren = True Then
            For Each frm As Form In Me.MdiChildren
                If TypeOf (frm) Is frmManual Then
                    CType(frm, frmManual).BringToFront()
                    CType(frm, frmManual).Focus()
                    Me.Refresh()
                    Exit Sub
                End If
            Next
        End If
--- End code ---

Just change the "frmManual" to whatever form Name you're trying to show.  Make sure to set each forms "Name" property as that's how we're calling them.

So the basic idea is to open them all up ahead of time and then just bring to front the form you want to see.
No flashy at all.

--- End quote ---

My goal is to create objects that don't require any code writing, so what you described doesn't fit my needs. Also, I hide displays to stop polling. Thanks though.

Navigation

[0] Message Index

[#] Next page

Go to full version