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

CODE to learn state of HIDE OR SHOW OVERLAY . . .

2019-03-26-182056

All --

In IMAGE-PRO 10, the

    COUNT/SIZE + SELECT + HIDE OR SHOW OVERLAY TOOL

allows a USER select this OPTION.

When a MACRO is recorded of this OPTION being turned OFF and ON, the following CODE is generated.

    Public Function NewMacro() As SimpleScript
        NewMacro = New SimpleScript
        Dim doc1

        With Application.DocumentCommands.Active(NewMacro)
            .Run(doc1)
        End With

        With Measure.MeasurementsCommands.ShowOverlay(NewMacro)
            .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Unchecked
            .Run(doc1)
        End With

        With Measure.MeasurementsCommands.ShowOverlay(NewMacro)
            .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Checked
            .Run(doc1)
        End With

    End Function

I would like my CODE to be able to check the STATUS of the OVERLAY (HIDDEN or SHOWING).

I have attempted to get the STATUS using

        Debug.Print "11"
        Debug.Print measure.MeasurementsCommands.ShowOverlay(Nothing).CheckState

        Debug.Print "22"
        If (measure.MeasurementsCommands.ShowOverlay(Nothing).CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.checked) _
            Then
                Debug.Print "TRUE"
            Else
                Debug.Print "FALSE"
            End If
within a routine that is run once per second but I get

11
Indeterminate
22
FALSE

in my IMMEDIATE WINDOW whether the OVERLAY is HIDDEN or SHOWING.

I can HIDE or SHOW the overlay with a routine that is similar to NewMacro but that routine is controlled by a SHOW OVERLAY CHECKBOX in my DIALOG BOX.  I would like the CHECKBOX to have a STATUS that matches the HIDE / SHOW OVERLAY.

Is there a way to check the OVERLAY STATUS via CODE?

Thanks.

-- Matt

Best Answer

  • Answer ✓
    Hi Matt,

    You can check visibility of measurements overlay directly:

        Public Sub CheckVisible
            'check visibility of measurements overlay
            Debug.Print "Overlay visible = " & ThisApplication.ActiveImage.MeasurementsData.Overlay.Visible
        End Sub
    

    Yuri

Answers

  • 2019-03-27-081330

    Yuri --

    Thank you for the info.

    I'll wire it into the APP later today.

    Thanks again.

    -- Matt


  • 2019-03-27-082148

    Yuri --

    FYI . . .

    I got close when I tried

    '        Debug.Print "ThisApplication.ActiveImage.ImageToolsOverlay.Visible"
    '        Debug.Print ThisApplication.ActiveImage.ImageToolsOverlay.Visible

    ; - )

    -- Matt



  • Yes, Matt, this is the same logic, only Measurements use different overlay.

    Yuri

Sign In or Register to comment.