Activating and using the SPLIT TOOL via a BUTTON in an APP . . .

All --

I have an application where I would like a button to:

    ** Turn on the SPLIT TOOL
    ** Allow the user to SPLIT OBJECTS
    ** Apply the SPLITS
    ** Turn off the SPLIT TOOL

The SplitDemo code below is the guts of the function I currently have supporting my SPLIT BUTTON.  Unfortunately if the user presses OK without actually creating a SPLIT LINE then the SPLITCOMMANDS.APPLY performs an AUTO SPLIT.  If the user presses CANCEL everything is okay.

It looks like the
                    .UseLines = True
is meant to control this behavior but it doesn't seem to work if there are no SPLIT LINES on the image.

Is there a way to check if there are any SPLIT LINES on the image between the
                'Activate the SPLIT TOOL and give the user a prompt
                With Measure.Measurements.ToolsCommands.SplitTool(Nothing)
and the
                'Perform any SPLITS
                With Measure.Measurements.SplitCommands.Apply(Nothing)
sections of this code?

Also . . .

Is there a good way to DEACTIVATE the SPLIT TOOL?  The only way that I could work out is to activate another TOOL (I chose the MEASUREMENT SELECT TOOL).

Thanks.

-- Matt

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

Public Sub SplitDemo ()

        Try

                'Activate the SPLIT TOOL and give the user a prompt
                With Measure.Measurements.ToolsCommands.SplitTool(Nothing)
                    .Tool = eMMTool.splittool
                    .Prompt = "Please SPLIT the appropriate POSITIVE AREAS and then press OK."
                    .Interactive = True
                    .Run(ThisApplication.ActiveDocument)
                End With

                'Perform any SPLITS
                With Measure.Measurements.SplitCommands.Apply(Nothing)
                    .UseLines = True
                    .SelectedOnly = False
                    .Run(ThisApplication.ActiveDocument)
                End With

            Catch

                'Do nothing

            Finally

                'Do nothing

            End Try

        'Activate the MEASUREMENT SELECT TOOL for the user
        With Measure.Measurements.ToolsCommands.Select(Nothing)
            .Tool = eMMTool.SelectionTool
            .Run(ThisApplication.ActiveDocument)
        End With

End Sub

Best Answers

  • Accepted Answer
    Hi Matt,

    Here is the function that can test for Split lines:

        Public Function HasSplitLines As Boolean
            Dim im =ThisApplication.ActiveImage
            Return im IsNot Nothing AndAlso im.Properties.Exists("SplitLines") AndAlso im.SplitLines.Count>0
        End Function
    
        Public Sub TestSplitLines
            MsgBox "Spilt lines = " & HasSplitLines
        End Sub
    
    

    Activating any other tool is one of the ways of switching tools. You can also switch to NoTool:

            With Measure.Measurements.ToolsCommands.Select(Nothing)
                .Tool = eMMTool.NoTool
                .Run(ThisApplication.ActiveDocument)
            End With
    

    Yuri
  • Accepted Answer
    Yuri --

    Thank you for those two pieces of CODE.

    They look like they will provide the missing links needed to resolve this challenge.

    I'll wire them in this afternoon.

    Thanks again.

    -- Matt
Sign In or Register to comment.