![]() |
#1
|
|||
|
|||
![]()
I have this macro for selecting objects on the activelayer:
Code:
Dim l As Layer, s As Shape For Each s In ActivePage.Shapes If s.Type <> cdrTextShape Then s.AddToSelection Next s For Each s In ActiveSelection.Shapes If s.Type = cdrGroupShape Then tc = 0 For Each ss In s.Shapes If ss.Type = cdrTextShape Then tc = tc + 1 sc = sc + 1 Next ss ' MsgBox "Sc = " & sc & ", tc = " & tc If sc = tc And tc > 0 Then s.RemoveFromSelection End If End If Next s The problem is with the focus. If I click a layer in the object manager and tnen run the macro it selects all non-text objects but the focus remains on the object manger so when I press an arrow ley expecting to move the selected objects they stay put. How to get the focus back to the drawing? Thanks. |
#3
|
|||
|
|||
![]()
Hi, Shelby. I'm using X6.
|
#4
|
||||
|
||||
![]()
How are you running the macro, on icon on a toolbar? I gave it a shot and it worked.
Your code doesn't respect the layer, it is searching the entire page. But it does move with the arrow keys. mmmm, I must be doing something wrong. -Shelby |
#5
|
|||
|
|||
![]()
I'm running the macro from a keyboard shortcut. The macro was just a bad example. The problem is with where the focus is within CorelDraw itself. If I select a layer in the Object Manager (Current Page, Layers Only) and run macro that selects objects the focus remains on the Object Manager so that when I use the arrow keys I change the layer selection in the Object Manager. I have a kind of fix using tab keys to shift the focus back to the drawing. Here's the code I'm now using:
Code:
Sub selectcurrentlayerimages() 'i Dim l As Layer, s As Shape If ActiveSelection.Shapes.Count = 0 Then Set l = ActiveLayer For Each s In ActiveLayer.Shapes If s.Type <> cdrTextShape Then s.AddToSelection Next s Sendkeys "{tab} {tab}" Else For Each s In ActiveLayer.Shapes If s.Type <> cdrTextShape Then s.RemoveFromSelection Next s End If End Sub |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to avoid using CorelScript object when drawing in PhotoPaint | svc4 | Corel Photo-Paint VBA | 1 | 23-04-2011 15:55 |
One property of Object Manager | ager | CorelDRAW/Corel DESIGNER VBA | 0 | 07-07-2010 05:54 |
Move object to 0,0 | CWCN | General | 1 | 15-06-2010 14:55 |
Move an object | norbert_ds | CorelDRAW/Corel DESIGNER VBA | 6 | 01-05-2007 20:58 |
Sorting entries in the object manager | dan | CorelDRAW/Corel DESIGNER VBA | 1 | 18-08-2004 23:16 |