Load ExFileSettings for a trend

Load ExFileSettings for a trend

  • 25 febbraio 2013 alle 1:13 pm #20976

    Hi guys…
    Witch way is better to load ExFileSettings files from a trend in a screen.

    In my project I have a Menu with some buttons, each button loads an ExFileSetting on the trend. 
    The problem is the menu buttons are in one screen and the trend is in another screen.
    If I have the buttons in the same screen as the trend I can change the ExFileSettings file great.
    But I want the buttons that loads the ExFileSettings file in another screen different than the trend screen.

    My code from one button in the trend screen: 

    Option Explicit

    Dim Trend As TrendCmdTarget
    Dim objTrend As DrawCmdTarget

    Public Sub Click()

    If objTrend Is Nothing Then Set objTrend = GetSynopticObject.GetSubObject(‘Trend’) ‘Create obj trend
    If Trend Is Nothing Then Set Trend = objTrend.GetObjectInterface ‘ Create object 
    Trend.ExtSettingsFile = ‘C:UsersCMS.HSDOMAINDesktopMovicon Supervisionsettings_trend_test.sxml’
    Trend.LoadExtSettings
    Set objTrend = Nothing

    End Sub

    If anyone can help me I’ll appreciate.
    Best regards,
    Cristiano 

     

  • 27 febbraio 2013 alle 2:56 pm #20977
    Ian_C
    Membro

    Hi Cristiano!

    Your Script can’t work if the button is in another screen, because it can’t to refer the object Trend.. Try to use the following code and you will can see that in this way it will work!

    Public Sub Click()
    Dim objTrend As TrendCmdTarget

       Set objTrend = GetSynopticInterface(‘ScreenWithTrend’).GetSubObject(‘Trend’).GetObjectInterface()
       objTrend.ExtSettingsFile
       objTrend.LoadExtSettings
       …
       …

    End Sub

    Best regards!

  • 27 febbraio 2013 alle 3:30 pm #20978
    Ian_C wrote:
    Hi Cristiano!

    Your Script can’t work if the button is in another screen, because it can’t to refer the object Trend.. Try to use the following code and you will can see that in this way it will work!

    Public Sub Click()
    Dim objTrend As TrendCmdTarget

       Set objTrend = GetSynopticInterface(‘ScreenWithTrend’).GetSubObject(‘Trend’).GetObjectInterface()
       objTrend.ExtSettingsFile
       objTrend.LoadExtSettings
       …
       …

    End Sub

    Best regards!

     Thanks Ian_C, it works 😉

Devi essere loggato per rispondere a questa discussione.