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 25-08-2012, 12:50
PAnderson PAnderson is offline
Member
 
Join Date: Nov 2003
Posts: 47
Default X6.1 Align & Distribute changes

I have two macros that creates some of my frequently used shapes at the click of a button. It supposed to place the shape in the center of the document (Align to Center of Document) when a radio button is ticked (its the default setting for position). After 6.1 was installed the shapes are now being placed spots on the page.

Below is the section of code that controls the position of the shape from one of the macros.

Code:
Sub CreateShape(m As Integer)
    Dim s As Shape
    Dim clickBool As Boolean
    Dim xpos As Double, ypos As Double
    Dim x As Double, y As Double, shift As Long, b As Boolean
    
    On Error GoTo createShape_Error

    sms 'Save settings sub below
    
    ActiveDocument.ReferencePoint = cdrBottomLeft
    
    If formBlockShapes1.txtXPos = "" Then formBlockShapes1.txtXPos = 0
    If formBlockShapes1.txtYPos = "" Then formBlockShapes1.txtYPos = 0
    xpos = CDbl(formBlockShapes1.txtXPos)
    ypos = CDbl(formBlockShapes1.txtYPos)
    
    clickBool = False
    If formBlockShapes1.rdPosClick Then
        clickBool = True
    End If
    
'Align to center of page------------
    If clickBool Then
        createIt(m).AlignToPageCenter cdrAlignHCenter
        ActiveSelection.AlignToPageCenter cdrAlignVCenter
    Else
        createIt(m).SetPosition xpos, ypos
    End If
'-----------------------------------

   On Error GoTo 0
   Exit Sub

createShape_Error:
    MsgBox "Please try again." & vbNewLine & "I'm terribly sorry but there has been an error." & vbNewLine & Err.Number & " (" & Err.Description & ") in procedure createShape of Module PAQ"

End Sub
Any thoughts? Works as expected in X5 and X4, but I want it to work in X6.1 as well.

Thanks in advance...
Patti
Reply With Quote
  #2  
Old 25-08-2012, 22:04
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,788
Blog Entries: 12
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 AlignToPageCenter

Patti,

I can confirm for you that AlignToPageCenter is broken in 6.1, I will report this and hopefully we can get it fixed for 6.2

To make it work for 6.1 you could write a little function to get the center of the page and align to it, yes a little more work than you should have to do. ;-)

-Shelby
Reply With Quote
  #3  
Old 26-08-2012, 11:34
PAnderson PAnderson is offline
Member
 
Join Date: Nov 2003
Posts: 47
Default

Quote:
Originally Posted by shelbym View Post
Patti,

I can confirm for you that AlignToPageCenter is broken in 6.1, I will report this and hopefully we can get it fixed for 6.2

To make it work for 6.1 you could write a little function to get the center of the page and align to it, yes a little more work than you should have to do. ;-)

-Shelby
Thanks for checking on that, Shelby. At least now I know it wasn't my imagination!

I actually have a position coordinates option on my macro form as well. So for now I'll use that so I can at least predict where my shapes will go on the page.

Patti
Reply With Quote
  #4  
Old 29-08-2012, 21:01
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default

Quote:
Originally Posted by shelbym View Post
Patti,

I can confirm for you that AlignToPageCenter is broken in 6.1, I will report this and hopefully we can get it fixed for 6.2

-Shelby
Any idea when 6.2 might appear? I hesitated to install 6.1 after reading what Foster had to say about it on teh Corel forums and the fact that it breaks AlignToPageCenter seems to be another reason to stay away. Thanks.
Reply With Quote
  #5  
Old 30-08-2012, 07:09
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

If you need to align items to the center of the page, there is the built in shortcut key "p" that centers all selected items on the page. If you need to do it programatically, you can use SendKeys
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #6  
Old 09-09-2012, 17:45
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,788
Blog Entries: 12
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 AlignToPageCenter

Just a quick note that in X6 Update 1 they have added a new way to do this:
Code:
Sub NewAlign()
    ActiveSelectionRange.AlignAndDistribute cdrAlignDistributeHAlignCenter, cdrAlignDistributeVAlignCenter, cdrAlignShapesToCenterOfPage
End Sub
The old method has been reported as a bug and hopefully they will get it fixed for Update 2 so that older macros will continue to work as expected.

-Shelby
Reply With Quote
  #7  
Old 20-09-2012, 12:18
katruax katruax is offline
Member
 
Join Date: Jan 2012
Posts: 35
Default

I have a question for you Shelby that relates to this...

Can I use the CorelDRAW X4 or X5 Library in CorelDRAW X6 in the VBA Editor?... If so, could you tell me how to about it?...

In CorelDRAW X6.1 this does work...

Origselection.Shapes.All.AlignAndDistribute cdrAlignDistributeHDistributeLeft, cdrAlignDistributeVDistributeTop

But in X6.0 it does not nor does it work in CorelDRAW X5... I don't have the AlignAndDistribute option....

So I have to create something similar that will work in CorelDRAW X5 and CorelDRAW x6.0.

Thank you,

Kevin
Reply With Quote
  #8  
Old 21-09-2012, 01:56
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,788
Blog Entries: 12
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 AlignToPageCenter

No, what you need to do is put in a case statement for the version and then use the new function in X6, but use the old way in older versions.

-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
distribute in pages buga Macros/Add-ons 4 28-02-2011 13:13
Align Outside GMS kenpoist CorelDRAW/Corel DESIGNER VBA 3 22-12-2010 09:05
Align Outside the Shape macrofan CorelDRAW/Corel DESIGNER VBA 2 14-11-2009 02:30
How to distribute the program? ricky0721 CorelDRAW/Corel DESIGNER VBA 3 26-03-2008 10:26
how to distribute a macro file mgmcs Macros/Add-ons 4 25-05-2006 08:23


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


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