OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   Trapped in GetUserClick - unusual behavior? (http://forum.oberonplace.com/showthread.php?t=8207)

Joe 21-05-2012 05:13

Trapped in GetUserClick - unusual behavior?
 
Hi all,

I am using code that's basically straight from the help files to get a user click and do certain actions, however for some reason with this code ESC does not break the cycle (it actually triggers the click action) and neither does the timeout.

Code:

Sub SmoothSeg()
    Dim X As Double, Y As Double
   
    B = False
   
    Dim Seg As Segment, S As Shape
   
    Set S = ActiveSelection.Shapes.First
   
    While Not B
        B = ActiveDocument.GetUserClick(X, Y, 0, 1, False, cdrCursorSmallcrosshair)
       
        If Not B Then
            Set Seg = S.Curve.FindSegmentAtPoint(X, Y, 0, 0.1)
            If Not Seg Is Nothing Then
                Seg.EndNode.Type = cdrSmoothNode
                Seg.StartNode.Type = cdrSmoothNode
                Seg.Type = cdrCurveSegment
                Seg.EndNode.Type = cdrSmoothNode
                Seg.StartNode.Type = cdrSmoothNode
                Seg.Type = cdrCurveSegment
            End If
        End If
    Wend
End Sub

The same basic thing seems to work just fine in other situations, so I suspect it has to do with the curve manipulation.

Any ideas?

shelbym 24-05-2012 14:07

GetUserClick
 
Joe,

You never declare B as a Boolean, therefore your code does not know when to exit the While loop. ;-)

-Shelby

Joe 24-05-2012 14:09

That's what I get for kinda copying out just the "most important parts" from the examples... Gonna go and bow my head in shame...

Thanks, Shelby! ;)


All times are GMT -5. The time now is 13:22.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com