Home Image-Pro Automation (Macros, Apps, Reports)

Is there a way to SHOW the OUTPUT WINDOW without CLEARING the OUTPUT WINDOW?

All --

I would like to be able to SHOW the OUTPUT WINDOW without CLEARING the OUTPUT WINDOW.

Right now it looks like if I CLOSE/HIDE the OUTPUT WINDOW and then SHOW the OUTPUT WINDOW (either through a MACRO or MANUALLY) a CLEAR is run on the OUTPUT WINDOW.

I have tried using
ThisApplication.Output.Visible = FALSE

ThisApplication.Output.Visible = TRUE
but the CLEAR still seems to happen.

Any suggestions?

Thanks.

-- Matt




Best Answer

  • Accepted Answer
    Matt, the Output panel gets disposed then closed and recreated again then open. This workaround will keep the instance of the Output panel alive during Show/Hide/Show cycle preserving its context:

        Public _output As System.Windows.Forms.Control = Nothing
    
        Public Sub OutputShow
            If McApplication.ThisApplication.Panels.Control("Output") Is Nothing Then
                If _output Is Nothing Then
                    McApplication.ThisApplication.Panels.Add("MediaCy.Controls.Output.Output", "Output", "Output", mcPanelLocation.mcplBottom, Nothing, mcControlType.mcctUserControl, Nothing, Nothing, Nothing, mcPanelsOptions.mcpoDoNotDispose)
                Else
                    McApplication.ThisApplication.Panels.Add(_output, "Output", "Output", mcPanelLocation.mcplBottom, Nothing, mcControlType.mcctUserControl, Nothing, Nothing, Nothing, mcPanelsOptions.mcpoDoNotDispose)
                End If
            End If
        End Sub
    
        Public Sub OutputHide
            If McApplication.ThisApplication.Panels.Control("Output") IsNot Nothing Then
                _output = McApplication.ThisApplication.Panels.Control("Output")'keep ref
                McApplication.ThisApplication.Panels.Remove("Output")
            End If
        End Sub
    

    Let me know, if you need more robust solution,

    Thanks,
    Nikita. 

Answers

  • Matt,

    You can use the following code.

        Sub HideOutput
            ThisApplication.Panels.SetAutoHide("Output",True)
        End Sub
    
    
        Sub ShowOutput
            ThisApplication.Panels.SetAutoHide("Output",False)
        End Sub
    

    Pierre
  • Pierre --

    Thank you for your response.

    Your solution did not work for me until I made a slight revision.

                    ThisApplication.Panels.SetAutoHide("Output",False)
    
    did not work until I had manually or programmatically executed a

                    ThisApplication.Output.show
    

    Here is the CODE that works for me . . . .

        Private Sub checkBox_ShowOutputWindow_CheckedChanged(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles checkBox_ShowOutputWindow.CheckedChanged
    
            'If the SHOW OUTPUT WINDOW OPTION is ON
            If ( checkBox_ShowOutputWindow.checked = True ) _
                Then
    
                    'Show the output window
                    ThisApplication.Output.show
                    ThisApplication.Panels.SetAutoHide("Output",False)
    
                Else
    
                    'Hide the output window
    '                ThisApplication.Output.hide
                    ThisApplication.Panels.SetAutoHide("Output",True)
    
                End If
    
        End Sub

    When I have a section of code needs to show something to the user in the OUTPUT WINDOW, I paste in . . .

        '-- Extract and report the measurement information for the current image
    
        'Clear the output window
        ThisApplication.Output.Clear
    
        'If the SHOW OUTPUT WINDOW OPTION is OFF
        If ( checkBox_ShowOutputWindow.Checked = False ) _
            Then
    
                'Turn on the SHOW OUTPUT WINDOW OPTION
                checkBox_ShowOutputWindow.Checked = True
    
    '            'Show the output window
    '            ThisApplication.Output.show
    
            End If

    If the user UNCHECKS the and then CHECKS the SHOW OUTPUT WINDOW OPTION, the window disappears then reappears with its contents intact.

    This is exactly the functionality that my code needs.

    The only issue that I see is the

        AUTOMATE RIBBON + TASK SECTION + OUTPUT PANEL

    is displaying ENGAGED (with the GOLD BACKGROUND) while the OUTPUT WINDOW is hidden by the

                    ThisApplication.Panels.SetAutoHide("Output",True)



    Thank you very much.

    -- Matt








  • Pierre --

    Yesterday I neglected to mark this DISCUSSION / QUESTION with a

        ANSWERED = YES

    Today I'm back to note that there seems to be another WRINKLE.

    When your solution and my modification are used on a PREMIER that has a DOCKED OUTPUT WINDOW, everything works fine.

    When the same code is run on a PREMIER that has an UNDOCKED OUTPUT WINDOW, the SHOW and HIDE behavior is dramatically different.

    On my machine, the HIDE TRUE generated a PINNED version of the OUTPUT WINDOW to the left of the APPLICATION DIALOG BOX and it did not close the ORIGINAL OUTPUT WINDOW.  The HIDE FALSE seems to discard the PINNED version of the OUTPUT WINDOW and relocates the UNDOCKED OUTPUT WINDOW into the UPPER LEFT CORNER of my PRIMARY WINDOWS SCREEN (no matter where PREMIER is).

    DOCKING the OUTPUT WINDOW is the only way I see to resolve this problem and to have the ability to SHOW and HIDE the OUTPUT WINDOW without losing its contents.

    Are there any other options?

    Thanks.

    -- Matt

  • No I think that's what you need to do, SetAutoHide is only valid when the output window is visible.

    Pierre
  • Pierre --

    Ouch.

    Is there any other way to do a PRESERVE on the contents of the OUTPUT WINDOW during the HIDE / SHOW CYCLE?

    Thanks.

    -- Matt
  • Hi Matt,
    My first thought was what it should keep it context, but it is not. I’ll take a look how to keep the context of the Output panel during hide/show cycle and will post the solution. 
    Nikita.

  • Nikita --

    I appreciate your investigating this.

    -- Matt
  • Nikita --

    Thank you for your response.

    I have modified my code with

        'Declare the PUBLIC VARIABLE that will hold the OUTPUT WINDOW CONTENTS while it is HIDDEN
        Public _output As System.Windows.Forms.Control = Nothing
    

    In the PUBLIC CLASS section of the APPLICATION'S VB CODE and

        Private Sub checkBox_ShowOutputWindow_CheckedChanged _
            (ByVal sender As System.Object,ByVal e As System.EventArgs) _
            Handles checkBox_ShowOutputWindow.CheckedChanged
    
            'If the SHOW OUTPUT WINDOW OPTION is ON
            If ( checkBox_ShowOutputWindow.checked = True ) _
                Then
    
    '                'If the OUTPUT WINDOW is not open
    '                If ( McApplication.ThisApplication.Panels.Control("Output") Is Nothing ) _
    '                    Then
    
                            'If there are no OUTPUT WINDOW CONTENTS in STORAGE
                            If ( _output Is Nothing ) _
                                Then
    
                                    'Open the OUTPUT WINDOW with NO CONTENTS
                                    McApplication.ThisApplication.Panels.Add _
                                        ( _
                                        "MediaCy.Controls.Output.Output", _
                                        "Output", _
                                        "Output", _
                                        mcPanelLocation.mcplBottom, _
                                        Nothing, _
                                        mcControlType.mcctUserControl, _
                                        Nothing, _
                                        Nothing, _
                                        Nothing, _
                                        mcPanelsOptions.mcpoDoNotDispose _
                                        )
    
                                Else
    
                                    'Open the OUTPUT WINDOW with the PREVIOUS CONTENTS
                                    McApplication.ThisApplication.Panels.Add _
                                        ( _
                                        _output, _
                                        "Output", _
                                        "Output", _
                                        mcPanelLocation.mcplBottom, _
                                        Nothing, mcControlType.mcctUserControl, _
                                        Nothing, _
                                        Nothing, _
                                        Nothing, _
                                        mcPanelsOptions.mcpoDoNotDispose _
                                        )
                                End If
    
    '                End If
    
                Else
    
    '                'Perform the operations to STORE the CONTENTS of the OUTPUT WINDOW and then HIDE the OUTPUT WINDOW
    '                If ( McApplication.ThisApplication.Panels.Control("Output") IsNot Nothing ) _
    '                    Then
    
                            'Store the contents of the OUTPUT WINDOW
                            _output = _
                                McApplication.ThisApplication.Panels.Control("Output")
    
                            'Hide the OUTPUT WINDOW
                            McApplication.ThisApplication.Panels.Remove("Output")
    
    '                    End If
    '
                End If
    
        End Sub

    also in the PUBLIC CLASS section of the same VB file.  Now when I CHECK and UNCHECK the

        checkBox_ShowOutputWindow

    the PREMIER OUTPUT WINDOW can cycle between SHOW and HIDE and maintain its CONTENTS whether it is DOCKED or UNDOCKED.  It also shows the correct status "around" the

        AUTOMATE RIBBON + TASK SECTION + OUTPUT PANEL

    control.

    While picking through this to understand how the code functions, I theorized that the

    If ( McApplication.ThisApplication.Panels.Control("Output") Is Nothing )

    was not needed.  I commented them out (seen in the code above) and everything seems to work super without them.  I left them in but COMMENTED OUT in case they were there to handle a situation that PREMIER is not in right now.  If this section of code acts up without those statements, I'll understand why you put them in.

    Thank you very much for your assistance.

    -- Matt





Sign In or Register to comment.