Menu

Multiple forms

Help
bigplcman
2009-06-10
2013-05-30
  • bigplcman

    bigplcman - 2009-06-10

    Hi

    Does advanced hmi support multiple pages? When I create an additional form it works but the screen update or comms is much slower on the additional screen.

     
    • Canaan

      Canaan - 2009-06-10

      I have been playing with that as well, and so far I can't get a second form to work at all unless I actually unload the first one. I intended to have more than one screen in my app, but transitioning between forms is very slow because of unloading one and loading another. I wished to just hide the first one but with the DF1Comm still active I get all kinds of problems. Unloading the first form before loading the next one seems to work ok, if you can tolerate the lag.

       
  • Archie

    Archie - 2010-01-25

    There have been some fixes in the past few months that may resolve these issues.

     
  • B W

    B W - 2011-07-09

    I am having problems with multiple forms as well with DF1.
    A single form works fine.
    Multiple forms give me a conflict with DF1 comm.
    I am getting the following errors with the DF1 comm.
    Right now each form has its own DF1Comm# and I use ( Me.Close ) to clear connections.

    Let me know the proper procedure for multiple forms using the DF1Comm?

    at form Process Step#2
    Locals

    +        Me    {MfgControl.AdvancedHMI.DF1Comm}    MfgControl.AdvancedHMI.DF1Comm
    +        e    {System.EventArgs}    System.EventArgs
    +        ex    {"Not Acknowledged (NAK)"}    System.Exception

    Call Stack
    >    AdvancedHMI.exe!MfgControl.AdvancedHMI.DF1Comm.PollUpdate(Object sender = {Interval = 50}, System.EventArgs e = {System.EventArgs}) Line 554    Basic

    DF1Comm.vb
    Break pt
        m_SynchronizingObject.BeginInvoke(PolledAddressList(i).dlgCallBack, CObj(TempArray))

    at form Process Step#3

    +        ex    {"No Reponse, Check COM Settings"}    System.Exception

     
  • aaron tanquerel

    aaron tanquerel - 2011-08-02

    Bw1sf, did you fix this?

     
  • B W

    B W - 2011-08-03

    NO, I was waiting for the fixes from arj3090.

     
  • aaron tanquerel

    aaron tanquerel - 2011-08-04

    i did a test and have two forms, each have got a df1comm1 with the same com port, and each have got a few controls such as basic indicator, digital panel meter etc.  The only problem i get is that when i switch to the other form i get this error:

    Error in returning data from datareceived

    So, what i always do when dealing with multiple forms is to set the DF1Comm1.DisableSubscriptions property of each DF1comm1 to True in design mode, and then toggle them when i want to use that form, obviously toggling the redundant one at the same time.  Try that see how you go.

     
  • B W

    B W - 2011-08-16

    I already tried that.
    With three forms, it does not work.
    I also set the DF1Comm1.DisableSubscriptions property of each DF1comm1 to True in design mode.
    I tried changing them to false both from a seperate main form that called the DF1 forms as well as in the New Sub of each form and true on form close.  Neither worked.

     
  • aaron tanquerel

    aaron tanquerel - 2011-08-20

    Have you got the latest version of advancedhmi?

     
  • B W

    B W - 2011-08-21

    I am using AdvancedHMIBeta302

     
  • aaron tanquerel

    aaron tanquerel - 2011-08-23

    Are you using a USB-Serial converter?  Just, if you are, sometimes the driver can cause funny problems….

     
  • B W

    B W - 2011-08-24

    No, it is a standard AB DB9 serial connector.

     
  • aaron tanquerel

    aaron tanquerel - 2011-08-24

    try not using the me.close statement in favour of only disabling the subscriptions when you change forms, that's how i'm doing it and i don't even use me.close when i finally close the last form.  perhaps when you use the me.close, there needs to be a time delay as the pc needs to re-open the com port and as you may see when you intially open up a single form it takes a couple of seconds to start subsribing to the controls.

     
  • B W

    B W - 2011-09-10

    OK I did that … did not work.
    I tried setting all the forms from the Mainform Public Sub New():
            ProcessX.DF1Comm3.DisableSubscriptions = True      ( Same as in the forms Default parameter settings )
            ProcessX.Show()
    Nothing should happen, but I get the Error message from the Mainfrom with no DF1comm :
    "Error in returning data from datareceived"

    Perhaps you could just post a simple multiform example?

     
  • Archie

    Archie - 2011-09-10

    I never actually close any forms. I only Show and Hide:

    Form2.Show

    Form2.Hide

    In order to keep down excessive polling on hidden forms, I add this code to every form:

        '*******************************************************************************
        '* Stop polling when the form is not visible in order to reduce communications
        '*******************************************************************************
        Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
            If components IsNot Nothing Then
                Dim drv As ICommComponent
                '*****************************
                '* Search for comm components
                '*****************************
                For i As Integer = 0 To components.Components.Count - 1
                    If components.Components(i).GetType.GetInterface("ICommComponent") IsNot Nothing Then
                        drv = components.Components.Item(i)
                        '* Stop/Start polling based on form visibility
                        drv.DisableSubscriptions = Not Me.Visible
                    End If
                Next
            End If
        End Sub

     
  • B W

    B W - 2011-09-13

    OK, that did it.
    All forms are good now.
    Thanks

     

Log in to post a comment.