Author Topic: Sub forms/pages remove the X button  (Read 1857 times)

g.mccormick

  • Newbie
  • *
  • Posts: 29
    • View Profile
Sub forms/pages remove the X button
« on: April 10, 2018, 09:50:20 AM »
I am building a dispaly that will have 6-7 screens that are accessed from the home screen.  I've found that if you X out of a sub screen, then advanceHMI is still running in background and you cannot re-open the application.  I would like to either disable the X or better yet have the X return to the home screen same as my HOME button does.  How would I go about this?

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
« Last Edit: April 10, 2018, 01:58:01 PM by Godra »

nickbri

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Sub forms/pages remove the X button
« Reply #2 on: April 13, 2018, 03:32:49 PM »
If memory serves correctly, you can use this in your pages so that when they are closed it reopens the main form. This way, the main form must be closed to "X" the application. I went through this same thing a while ago and this solved my problems.


    Private Sub Page2_FormClosing(sender As Object, e As EventArgs) Handles MyBase.Closing
        AdvancedHMI.MainForm.Show()

    End Sub

Phrog30

  • Guest
Re: Sub forms/pages remove the X button
« Reply #3 on: April 13, 2018, 03:42:11 PM »
If memory serves correctly, you can use this in your pages so that when they are closed it reopens the main form. This way, the main form must be closed to "X" the application. I went through this same thing a while ago and this solved my problems.


    Private Sub Page2_FormClosing(sender As Object, e As EventArgs) Handles MyBase.Closing
        AdvancedHMI.MainForm.Show()

    End Sub


Or, just e.cancel = true

g.mccormick

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: Sub forms/pages remove the X button
« Reply #4 on: April 17, 2018, 09:06:07 PM »
If memory serves correctly, you can use this in your pages so that when they are closed it reopens the main form. This way, the main form must be closed to "X" the application. I went through this same thing a while ago and this solved my problems.


    Private Sub Page2_FormClosing(sender As Object, e As EventArgs) Handles MyBase.Closing
        AdvancedHMI.MainForm.Show()

    End Sub


Or, just e.cancel = true


Can you explain more? 


I removed the border, but do not like that you cannot more or resize the window now. 

g.mccormick

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: Sub forms/pages remove the X button
« Reply #5 on: April 17, 2018, 09:10:48 PM »
If memory serves correctly, you can use this in your pages so that when they are closed it reopens the main form. This way, the main form must be closed to "X" the application. I went through this same thing a while ago and this solved my problems.


    Private Sub Page2_FormClosing(sender As Object, e As EventArgs) Handles MyBase.Closing
        AdvancedHMI.MainForm.Show()

    End Sub


That worked great thank you.

I had removed the border, but did not like losing the ability to resize, move,  etc the windo.


Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Sub forms/pages remove the X button
« Reply #6 on: April 17, 2018, 10:47:18 PM »
If you are now using the FormClosing event to show the MainForm then you can put the border back on the form.

This means that even if a user clicks "X" it will only close that form, fire the FormClosing event thus show the MainForm.