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 31-07-2010, 04:31
PAnderson PAnderson is offline
Member
 
Join Date: Nov 2003
Posts: 47
Default Toggle layer visibility with one key

I created this simple macro to hide/show the active layer (equivalent to clicking the eye in Object Manager). I assigned shortcut keys (0 to HideLayer and 9 to ShowLayer). Is there a way to make the visibility toggle on/off with one keystroke? For example, you can assign a shortcut to hide/show the grid...but that's on a menu, so I'm not sure it can be done for layer visibility.

Code:
Sub HideLayer()
    ActiveLayer.Visible = False
End Sub

Sub ShowLayer()
    ActiveLayer.Visible = True
End Sub
Patti

Last edited by PAnderson; 31-07-2010 at 11:32.
Reply With Quote
  #2  
Old 31-07-2010, 12:00
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,782
Blog Entries: 11
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 Toggle Layer Hide / Visible

You can set the .Visible to what ever .Visible is Not, like this:
Code:
Sub HideShowLayerToggle()
    ActiveLayer.Visible = Not ActiveLayer.Visible
End Sub
This should give you the toggle effect you want.

-Shelby
Reply With Quote
  #3  
Old 31-07-2010, 13:10
PAnderson PAnderson is offline
Member
 
Join Date: Nov 2003
Posts: 47
Default

Slapping forehead...now why didn't I think of that?!

So simple, so useful!
Patti
Reply With Quote
  #4  
Old 31-07-2010, 17:45
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Quote:
Originally Posted by shelbym View Post

This should give you the toggle effect you want.

-Shelby
Yes. Nice shorthand Shelby!

I wish I knew more of VBA shorts like this.
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
Toggle Snap t object by VBA aakkaarr CorelDRAW/Corel DESIGNER VBA 3 12-10-2009 21:40
toggle pick state in PP Jeff Harrison Corel Photo-Paint VBA 2 09-10-2009 18:10
Event needed for color toggle CWCN CorelDRAW/Corel DESIGNER VBA 2 20-10-2008 11:17
Problem with layer visibility Michael Cervantes CorelDRAW/Corel DESIGNER VBA 1 14-06-2004 10:14
I need to update objects visibility faster NEHovis Corel Photo-Paint VBA 0 18-07-2003 07:54


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


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