OberonPlace.com Forums  

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

Thread Tools Search this Thread Display Modes
Old 28-02-2013, 05:02
FaneDuru FaneDuru is offline
Join Date: May 2012
Posts: 35
Question Select Shape after Undo...

I have a GMS file preparing a file for cutting. I treat some cases (powerClip, Group or simple lines nets) and during fine tuning I need to revert at the initial selection. For the cutting shape belonging to a group I try to select it again after Undo (programmatically), but it does not work...
I know the shape name and I use the next code:
Private Sub btUndo_Click()
    Application.Optimization = True
    Application.Optimization = False
End Sub
I also tried:
but it does not work
'Prnt' is the page where the group is, declared at the form class level and it is not nothing...
I mean this code put exactly instead of the line to create selection:
 Debug.Print Prnt.Shapes("xxx").Name
returns 'xxx'.
I can select the specific shape in a separate piece of code but not after Undo...
I tried also to put those lines in a separate procedure and call it but the same result...

Are there some limitations after using Undo?
How can a I select that shape after Undo?

I use CorelDRAW X5.

Thanks in advance!
Reply With Quote
Old 28-02-2013, 08:19
FaneDuru FaneDuru is offline
Join Date: May 2012
Posts: 35

In the meantime I did the next tests:
This simple code can be UNDO with shape selection:
Sub testSelForUNDO()
   Dim S As Shape
   ActiveDocument.BeginCommandGroup "CreareRect"
    Set S = ActivePage.ActiveLayer.CreateRectangle(50, 200, 22, 20)
    'ActiveDocument.AddPages (1)
End Sub
Sub UndoWithSelection()
End Sub
With the line adding a new page (commented now), it does not select the shape any more...
I also mention that the shape in discussion is part of a group but I do not think that can be a problem. FindShape works inside groups, too...

I also mention that this is not an issue which I really need but I would like to understand what happens and how it can be solved...
I can see that the shape (xxx) looks selected in Object Manager. If in 'UndoWithSelection' procedure I insert a line:
 Debug.Print ActiveShape.BottomY
it returns the real bootomY of the shape like selection exists...
If I put this line in another procedure and run it returns an error message (Object variable or With block variable not set), like anything is selected.
I tried ActiveWindow.Refresh, but without result.

What else should I try?

Last edited by FaneDuru; 01-03-2013 at 04:59. Reason: adding some text...
Reply With Quote
Old 01-03-2013, 07:24
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

Have you tried setting the active selection to a variable at the beginning of the code run?
Dim OrigSelection As ShapeRange
Set OrigSelection = ActiveSelectionRange
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
Old 01-03-2013, 11:51
FaneDuru FaneDuru is offline
Join Date: May 2012
Posts: 35

Firstly thanks for your wish to help me!

I am not sure I understand what you mean... To use that in the procedure involving Undo and my intention to select the shape (part or a group)?
If yes, I tried it now without success...
I also tried to declare it like a public shape at the class level and even if referencing it is good and the shape is not nothing it can not be selected.
Can you use your suggestion in the small example I posted?
I would like to mention that during the procedure involving Undo the selected shape is clearly identified and I am able to clone, copy, whatever can be done with a shape but not select it. Only inside this procedure... It appears to be selected for a moment and immediately is deselected... It just does not look like being selected (except in Object Manager) and it is not selected at all in order to be recognized as active shape in a future procedure...

Last edited by FaneDuru; 01-03-2013 at 11:54.
Reply With Quote

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
How to select shape of same width & height using CQL and not selecting groupshape aakkaarr CorelDRAW/Corel DESIGNER VBA 3 19-09-2011 08:44
Select objects within a shape nic Macros/Add-ons 10 20-08-2010 05:36
How to select the newly duplicated shape AdrianD Macros/Add-ons 2 06-03-2010 01:44
Undo Levels bprice CorelDRAW/Corel DESIGNER VBA 1 21-10-2008 11:13
How to select all shape ? -=HKLC=- CorelDRAW/Corel DESIGNER VBA 1 25-10-2004 00:10

All times are GMT -5. The time now is 00:11.

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