OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 19-03-2012, 10:02
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 431
Default X5 shaperange bug?

Create a couple of rectangles near the top of the page and overlap them. Select both rectangles and run the following code:

Code:
sub ShapeRangeTest()

dim sr as ShapeRange, sd as Shaperange

        Set sr = ActiveSelectionRange
              
        If sr.Shapes.Count > 0 Then
            sr.Group
            MsgBox "GROUPED"
        End If
              
        Set sd = sr.Duplicate
        sd.Group
        sd.AlignToPageCenter cdrAlignHCenter
        sd.AlignToPageCenter cdrAlignVCenter
              
        sd.CreateSelection
        
        MsgBox "Test"
        
        sr.CreateSelection

End Sub
When I run this code Ibget the GROUPED message but the duplicated shapes are centred and the grouping is ignored. Moreover if I click on the desktop and then reselect one of the groups all four objects are selected as one group. If I comment out the line sd.group I still end up with all the objects grouped. What's going on? Please don't tell me there are no bugs!

I guess what I really want to know is how to remember a particular collection of objects so I can reselect it later. I was really comfortable coding with CD12 but find X5 a nightmare. Thanks.

Last edited by knowbodynow; 19-03-2012 at 10:02. Reason: code tags missing
Reply With Quote
  #2  
Old 19-03-2012, 12:00
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,770
Blog Entries: 10
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default ShapeRage.Group

The issue is when you Group a ShapeRange is returns a Shape, not a ShapeRange. You can look at me previous post on your Save issue, have to fix this.

I would recommend that you use step each line of code with F8, so you can watch what your code is doing. This will help find these types of issues.

-Shelby

Last edited by shelbym; 19-03-2012 at 12:03.
Reply With Quote
  #3  
Old 20-03-2012, 18:56
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 431
Default

Thanks for the reply but I don't get why the objects in the grouped shape end up centred, this defeats the point of grouping them. I do use F8 when testing code, also exit sub to test parts in isolation. Cheers!
Reply With Quote
  #4  
Old 20-03-2012, 23:08
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,770
Blog Entries: 10
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default ShapeRange

Do this, by hand, not in code. Create say three rectangles and group them. Then hold down CTRL and click one of the rectangles, notice the handles change from rectangles to circles, this is because you are selecting the shape, inside the group.

Another way to look at it, same three rectangles in the group. Open the Object Manager docker. Expand the group, and you will see the three rectangles select one from the Object Manager, and you see the same circle handles, shift select and you can select all three, but again you are selection the shapes in the group, not the group. Press P to align to page, and notice they align as individual shapes.

This is exactly what your code is doing, because you are selecting the ShapeRange, aka a range of shapes, it is selecting the shapes inside the group, and not the group itself, so when you do your align, it aligns them as individual shapes.

Does that make sense? If not, let me know, and I will try to explain another way.

-Shelby
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
Shapes in ShapeRange gebp CorelDRAW/Corel DESIGNER VBA 2 22-11-2011 15:02
shaperange.add HeauxmBru Macros/Add-ons 10 30-06-2011 22:15
Create multiple elements in shaperange(faster) isvaljek Macros/Add-ons 2 24-03-2009 13:06
Shaperange to Layer ebu CorelDRAW/Corel DESIGNER VBA 2 19-01-2008 04:44
Draw X3: VBA: rotate behaviour for shaperange changed wOxxOm CorelDRAW/Corel DESIGNER VBA 0 30-01-2006 12:08


All times are GMT -5. The time now is 17:30.


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