Author Topic: Main Menu Button/Form  (Read 2597 times)

kay_gsr13

  • Newbie
  • *
  • Posts: 25
    • View Profile
Main Menu Button/Form
« on: December 06, 2016, 02:48:49 PM »
I've created a menu form and it works great! One question that I have is that, is there a way to have the forms "follow" the menu form when I re position it?

Also can I specify which for to open with the menu form from the MainMenuButton Controls?
« Last Edit: December 06, 2016, 02:52:14 PM by kay_gsr13 »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Main Menu Button/Form
« Reply #1 on: December 06, 2016, 04:37:08 PM »
This first version of the main menu is fairly limited. It will only allow the main menu to be on the left side. It will always try to align the forms to the upper right of the main menu.

To specify the initial form to open, the MainMenuButton has a property of OpenOnStartup. By setting that to true, the associated form will open when the application starts.

kay_gsr13

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Main Menu Button/Form
« Reply #2 on: December 06, 2016, 05:55:39 PM »
This first version of the main menu is fairly limited. It will only allow the main menu to be on the left side. It will always try to align the forms to the upper right of the main menu.

To specify the initial form to open, the MainMenuButton has a property of OpenOnStartup. By setting that to true, the associated form will open when the application starts.

Archie,

Thanks for the update. For those that read this, all of the MainMenuButton are set to true by default for so it brought the last page up that the button was linked to.

Now that I have my startup page loaded with the menu, is there a quick way to have the MainMenuButton that is synced startup page highlight automatically, as the 1st MainMenuButton is highlighted by default?

Thanks Again,

K

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Main Menu Button/Form
« Reply #3 on: December 06, 2016, 06:24:28 PM »
For those that read this, all of the MainMenuButton are set to true by default for so it brought the last page up that the button was linked to.
I just checked this and the OpenOnStartup property after adding a new button and it was set to False. Did you maybe copy and paste the default button instead of getting it from the Toolbox?
Now that I have my startup page loaded with the menu, is there a quick way to have the MainMenuButton that is synced startup page highlight automatically, as the 1st MainMenuButton is highlighted by default?
Not in this current version without adding a bunch of code.

Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: Main Menu Button/Form
« Reply #4 on: January 06, 2017, 06:06:00 PM »
Archie, sorry if I´m highjacking this thread, but I could not find the answer, when you switch from form to form, the hidden forms stops polling data? I use small databases to log data from process, but I would like to change from tabs (as current solution we have) to different forms, can I still log data whe switching to another form?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Main Menu Button/Form
« Reply #5 on: January 06, 2017, 07:52:34 PM »
Archie, sorry if I´m highjacking this thread, but I could not find the answer, when you switch from form to form, the hidden forms stops polling data? I use small databases to log data from process, but I would like to change from tabs (as current solution we have) to different forms, can I still log data whe switching to another form?
The stopping of polling when a form is hidden is controlled by the code snippet behind the MainForm. This snippet should be copied to each form in order to optimize communications by stopping the polling when a form is hidden. If you want the data to continue to be polled, then you can comment out that code:

Code: [Select]
    '*******************************************************************************
    '* Stop polling when the form is not visible in order to reduce communications
    '* Copy this section of code to every new form created
    '*******************************************************************************
    Private NotFirstShow As Boolean

     Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
        '* Do not start comms on first show in case it was set to disable in design mode
        If NotFirstShow Then
            AdvancedHMIDrivers.Utilities.StopComsOnHidden(components, Me)
        Else
            NotFirstShow = True
        End If
    End Sub

The Main Menu driven style application offers the option of putting a driver on the Main Menu. Since this is a form that is always visible, then controls such as data logging can be put on the form.

Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: Main Menu Button/Form
« Reply #6 on: January 09, 2017, 11:22:46 AM »
Thanks Archie! Now I get it.