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 17-02-2008, 15:12
Tomasz Tomasz is offline
Junior Member
 
Join Date: Aug 2006
Posts: 21
Default is there any reference to selected layers?

Is there any way to make Draw VBA understanding, that a couple of layers are selected? LayerRange class seems to work only in PP VBA.

Tomasz
Reply With Quote
  #2  
Old 17-02-2008, 15:33
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

what goal do you pursue?
if you're processing shapes from several layers then a ShapeRange will do like this:
Code:
dim SR as shapeRange
set SR=ActiveDocument.Layers(1).FindShapes
SR.AddRange ActiveDocument.Layers(2).FindShapes
SR.Fill.ApplyUniformFill CreateCMYKColor(0,0,0,100)
Reply With Quote
  #3  
Old 18-02-2008, 14:55
Tomasz Tomasz is offline
Junior Member
 
Join Date: Aug 2006
Posts: 21
Default

Thank you wOxxOm.

I meant strictly operations on a couple of layers selected manually by an user. For example when one selects two or more layers (by ctrl clicking them), the macro would make these layers editable, printable and visible. Of course I can select all objects on the desired collection of layers, or I can just define an array with layers indexes to be processed. However the problem is how to make VBA aware that certain layers are selected.

Tomasz
Reply With Quote
  #4  
Old 18-02-2008, 15:06
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Unless I'm missing something, you can't select more than 1 layer at a time in CorelDRAW...
Reply With Quote
  #5  
Old 18-02-2008, 15:08
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

yeah, indeed, you'll have to make your own userform UI which would allow multiple selections
Reply With Quote
  #6  
Old 18-02-2008, 15:42
Tomasz Tomasz is offline
Junior Member
 
Join Date: Aug 2006
Posts: 21
Default

Well... actually... I can do it in my X3:

1. I click on a layer,
2. then holding Ctrl key pressed I click on other layers.
3. having collection of layers selected in that way, I can right click on them and for example make all of them invisible at once or all of them imprintable at once.

Of course it doesn't mean that all layers become activelayers. Only first clicked layer becomes "active", however UI does see other as selected.

Tomasz
Reply With Quote
  #7  
Old 18-02-2008, 15:48
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

ah, in the Layers mode view it's possible to multiselect, then I guess you can try to read the SysTreeView32 inside Object Manager using WinAPI
Reply With Quote
  #8  
Old 18-02-2008, 16:04
Tomasz Tomasz is offline
Junior Member
 
Join Date: Aug 2006
Posts: 21
Default

wOxxOm,

I had a slight hope that I would manage to do it easily with use of an overlooked cDraw class. As the hope vanished, I have to learn more about WinAPI classes

Tomasz
Reply With Quote
  #9  
Old 18-02-2008, 16:14
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

that's not too complicated, here's some code for FLOATING ObjectManager, something similar is required for docked OM.
Code:
dim h&
h=FindWindowExA(0,0,"Object Manager","Afx:62210000:1000:00010011:00000010:00000000")
if h=0 then msgbox "No ObjectManager window found"
h=FindWindowExA(h,0,vbNullString,"#32770")
h=FindWindowExA(h,0,vbNullString,"#32770")
h=FindWindowExA(h,0,vbNullString,"SysTreeView32")
now we have SysTreeView32 handle, use TV_ITEM with mask=TVIF_STATE+TVIF_TEXT in a loop, calling SendMessage h,TVM_GETITEM,0,byval varptr(tvi) - for each of the listview items (total number is determined by TVM_GETCOUNT sendmessage).

Search the internet for any TreeView examples, there are plenty of them
Reply With Quote
  #10  
Old 18-02-2008, 16:37
Tomasz Tomasz is offline
Junior Member
 
Join Date: Aug 2006
Posts: 21
Default

Thanks!
I understand that the first line returns the handle of the Object Manager itself. But why the window name of the Object Manager object is "Afx:62210000:1000:00010011:00000010:00000000"??
Has a docked OM object different window name here?
The next two lines are just to dig deeper, until the treeview handle is supposed to be found in the line no 4. Am I correct?

Tomasz
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
Copy Selected Objects to other pages maintaining layers knowbodynow Code Critique 6 13-12-2015 18:46
Layers And List Boxs knowbodynow CorelDRAW/Corel DESIGNER VBA 3 06-09-2007 07:05
Move objects to selected layer (either "a" or "b") 6fazer CorelDRAW/Corel DESIGNER VBA 3 07-03-2007 19:10
Copy Selected Objects to new page maintaining layers knowbodynow CorelDRAW/Corel DESIGNER VBA 5 07-03-2007 08:49
finding node angles? IanVincent CorelDRAW/Corel DESIGNER VBA 4 12-12-2003 23:32


All times are GMT -5. The time now is 01:29.


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