OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Corel User Forums > CorelDRAW > Macros/Add-ons

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-08-2011, 11:29
HeauxmBru
Guest
 
Posts: n/a
Default Issue with SelectShapesAtPoint

Hello all

I know that SelectShapesAtPoint returns cdrSelectionShape (8) regardless of the actual shape.type, which is ok. I want to prevent the user from selecting just any shape.type. To do that I am using ActiveShape.Type, which should allow me to select any single shape.type by type. Enter the problem. When selecting a cdrLinearDimensionShape (14), ActiveShape.Type returns cdrArtisticTextShape (6).

Can anyone tell me why this is?

When I use Findshapes to find the cdrLinearDimensionShape (14) I have no problem. Is this a bug possibly? Can you suggest a workaround?

Below is a portion of the code I am using.

Code:
    Set s = ActiveDocument.Selection
    If s.Shapes.Count = 0 Then
1000:
        While d.GetUserClick(x, y, Shift, 10, False, cdrCursorSmallcrosshair) = 0
            Set sel = d.ActivePage.SelectShapesAtPoint(x, y, False, -1)
            If sel.Shapes.Count > 0 Then
'                Allows me to see what .type is selected
                MsgBox "Selected is " & d.ActiveShape.Type, vbOKOnly
'                -8 is the present workaround
                If d.ActiveShape.Type <> cdrLinearDimensionShape - 8 Then
                    If MsgBox("You did not select a Dimension Line." _
                            & Chr(13) & "Would you like to try again?", _
                            vbYesNo, "Try Again") = 7 Then
                        d.ClearSelection
                        Exit Sub
                    Else
                        d.ClearSelection
                        GoTo 1000
                    End If
                End If
                
                If frmMacroProperties.optEntireDocument.Value = True Then
                    If MsgBox("This will BreakApart all" _
                                & Chr(13) & "dimensions on ALL pages." _
                                & Chr(13) & Chr(13) & "Do you want to continue?", _
                                vbOKCancel + vbCritical, "Break Apart Dimensions") = 2 Then
                        GoTo ExitSub
                    Else
                        For i = idx To d.Pages.Count
                            Set p = d.Pages(i)
                            p.Activate
                            
                            Set sr = p.ActiveLayer.FindShapes(, cdrLinearDimensionShape)
                            If sr.Shapes.Count <> 0 Then
                                For Each s In sr
                                    s.BreakApartEx
                                Next s
                            End If
                        Next i
                        d.ClearSelection
                        GoTo ExitSub
                    End If
The present workaround allows the macro to work unless cdrArtisticText is selected. This is not truly acceptable.

Thanx in advance

JC
Reply With Quote
  #2  
Old 12-08-2011, 14:00
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
Your selection shape can be many shapes. With activeshape you are referring to shape number 1 in the "shapes" that make up the selection shape.

So if sel.shapes.count = 1 then you can use activeshape to reference the single shape type correctly.

If the count is higher than 1 you will have to filter out the shape type needed either by looping the sel.shapes or a cql query with activeselection.shapes.findshapes().

~John
Reply With Quote
  #3  
Old 14-08-2011, 13:37
HeauxmBru
Guest
 
Posts: n/a
Default

Sometimes all it takes is to see things from a different point of view for everything to fall in place.

Thanks John for that other point of view.

I couldn't get the findshapes() to work, but the sel.shapes.count worked perfectly once I was able to see what was going on. Then I realized that all I needed was another if statement to eliminate any shapes that are less than 2. This leaves the dimesion shape which is a compound shape. I know this might leave me open to other compound shapes, but for now it works.

Again, thanks John for helping me focus.

JC
Reply With Quote
  #4  
Old 14-08-2011, 13:43
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
Glad to help. That selection shape can be a tricky little devil...lol
~John
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Having a bit of a timing issue gag546112 CorelDRAW/Corel DESIGNER VBA 7 22-08-2010 19:26
PMS color - X5 Issue biok CorelDRAW/Corel DESIGNER VBA 4 29-04-2010 14:52
SelectShapesAtPoint with C++ in plugin SanchoFilin CorelDRAW/Corel DESIGNER VBA 0 06-10-2009 14:22
Eraser issue jahmer General 0 17-01-2008 16:59
SetSize issue Dave Rowland CorelDRAW/Corel DESIGNER VBA 3 11-01-2008 17:36


All times are GMT -5. The time now is 08:44.


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