Product : Engine, Version : 4.0.2.1020, ArticleID : 41020126

HowTo : Cancel and Cancel1 commands

Article41020126
TypeHowTo
ProductEngine
Version4.0.2.1020
Date Added5/23/2003
Submitted byRobbert Nieuwerf
Keywords

Subject

Cancel and Cancel1 commands

Summary

The Cancel1 and Cancel methodes, when used, don't cancel the jobs directly, so the events, JobEnd isn't fired after the Cancel method. Also the Openloops functions stays on 1 if one loop was open before calling Cancel1 method. Calling the Cancel method should decrease the number of loops, I would think... Now it's impossible to stop all open commands through a loop using Cancel1 or just by using the Cancel method...

Solution

Create a simple project in VB 6.0 with a VectorDraw Professional (or Standard) and 2 command Buttons and add this code :

Private Sub cmdCommand_Click()
    Dim A As Variant
    A = Array(0, 0, 0)
    A = VDPro1.Utility.GetPoint
    MsgBox "Command Button:  Openloops= " + CStr(VDPro1.CommandAction.OpenLoops) + Chr(10) + "The CommandAction.Cancel message now is executed." + Chr(10) + "Back to the code after the Utility.GetPoint."
    If Not (IsEmpty(A)) Then
        MsgBox A(0)
    End If
End Sub

Private Sub cmdCancel_Click()
    MsgBox "Cancel Button:  Openloops= " + CStr(VDPro1.CommandAction.OpenLoops) + Chr(10) + "Running the CommandAction.Cancel after this."
    VDPro1.CommandAction.Cancel1 ' VDPro1.CommandAction.Cancel
    MsgBox "Cancel Button:  Openloops= " + CStr(VDPro1.CommandAction.OpenLoops) + Chr(10) + "The CommandAction.Cancel just runned and posted a Message." + Chr(10) + "The .Cancel command (message) is posted and will execute after the other messages are finished."
End Sub

Private Sub Form_Load()
    MsgBox "Press the 'Command' button and after that the 'Cancel' Button"
End Sub

The Cancel1 and Cancel commands post a message to the VDraw. This message will execute when the other messages (messages and NOT commands) are finished.