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 09-04-2005, 15:50
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default HOW-TO implement in VB : show/hide ALL toolbars (as AI)

HOW-TO implement in VB : show/hide ALL toolbars (as AI)
Reply With Quote
  #2  
Old 10-04-2005, 00:08
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: HOW-TO implement in VB : show/hide ALL toolbars (as AI)

Quote:
Originally Posted by wOxxOm
HOW-TO implement in VB : show/hide ALL toolbars (as AI)
Here is the code I came up with... I decided not to hide the main menu, status bar and toolbox. But you can modify the code to remove those as well.

Assign a shortcut key to ShowHideToolbars and you are all set. Note that there is no way to show/hide dockers through automation... unfortunately...

Code:
Option Explicit

Private Sub HideToolbars()
    Dim cmdbar As CommandBar
    Dim bars() As String
    Dim n As Long, nCount As Long
    Dim nSavedCount As Long
    
    nCount = CommandBars.Count
    nSavedCount = 0
    ReDim bars(0 To nCount - 1)
    For n = 1 To nCount
        Set cmdbar = CommandBars(n)
        If cmdbar.Name <> "Menu Bar" And cmdbar.Name <> "Status Bar" And cmdbar.Name <> "Toolbox" Then
            If cmdbar.Visible Then
                cmdbar.Visible = False
                ' Save the name of the toolbar so we can restore its visibility later
                bars(nSavedCount) = cmdbar.Name
                nSavedCount = nSavedCount + 1
            End If
        End If
    Next n
    ReDim Preserve bars(0 To nSavedCount - 1)
    SaveSetting "ShowHideToolbars", "ToolbarState", "Toolbars", Join(bars, ":")
End Sub

Private Sub RestoreToolbars(ByVal strSavedBars As String)
    Dim cbar As Variant
    For Each cbar In Split(strSavedBars, ":")
        CommandBars(cbar).Visible = True
    Next cbar
    ' Erase the previous state...
    SaveSetting "ShowHideToolbars", "ToolbarState", "Toolbars", ""
End Sub

Sub ShowHideToolbars()
    Dim strSavedBars As String
    
    strSavedBars = GetSetting("ShowHideToolbars", "ToolbarState", "Toolbars")
    If strSavedBars <> "" Then
        RestoreToolbars strSavedBars
    Else
        HideToolbars
    End If
End Sub

Last edited by Alex; 23-06-2005 at 12:13.
Reply With Quote
  #3  
Old 10-04-2005, 09:43
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

cool code,
thnx a lot
Reply With Quote
  #4  
Old 13-04-2005, 12:58
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

I tried to hide scrollbars by findwinow / showwindow and corel always recalculates MDI frame size and leaves 12 pixels unused though scrollbars are not shown... ;-( I want to extend "ShowHide toolbars" to hide scrollbars also. (I tried also window inspectors, so it's not code problem)

help please, Alex, it would be a great feature indeed!
Reply With Quote
  #5  
Old 13-04-2005, 18:07
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

I don't think you can do what you want. Just hiding scrollbar "window" won't make the rest of window content to take its place. When the document expects to have scrollbars and explicitly creates/shows them, it is not responsible for your actions to actually go and hide them. It still believes that the scrollbars are there and therefore leaves some screen realestate for them. Unless you want to find the actual document drawing pane window and resize it by calling MoveWindow or something...
Reply With Quote
  #6  
Old 23-06-2005, 10:10
ivelink
Guest
 
Posts: n/a
Question &lt;> ""

what is / &lt;> ""/
i always receive an error on this
Reply With Quote
  #7  
Old 23-06-2005, 12:14
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Quote:
Originally Posted by ivelink
what is / &lt;> ""/
i always receive an error on this
Well, it was supposed to be "<>". Apparently when I switched to new forum software there was some problem importing message database into the new system. Some of HTML codes weren't converted properly. I have fixed the code above...
Reply With Quote
  #8  
Old 09-03-2007, 11:06
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default Further evolution



ShowHideToolbars - toggles visibility of UI elements such as toolbars, palettes, menu, rulers, guides, dockers (undocked)
SetupShowHideToolbars - shows options dialog where you can setup what UI elements will be toggled

Download: http://recentfiles.netfirms.com/#wx_ToggleToolBars


Emergency restoring of menu visibility if you cannot relaunch the macro using keyboard shortcut:
1. press and hold Alt key (all the time to last step)
2. rightclick empty space in document window
3. in menu that appeared, rightclick any item
4. enable "Menu" (usual leftclick)
5. release Alt

Last edited by wOxxOm; 26-02-2008 at 21:59.
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
Is there a way to implement CorelDraw macro's in Designer Bellekom Macros/Add-ons 3 11-05-2005 12:32
How to implement Ctrl & alt keys in code xombie CorelDRAW/Corel DESIGNER VBA 2 08-01-2005 13:17
format text dialog box implement graphicdesigner CorelDRAW/Corel DESIGNER VBA 5 22-12-2004 14:37
closing dockers/interactive toolbars to speed up a macro Rick Randall CorelDRAW CS 1 09-12-2002 21:39


All times are GMT -5. The time now is 12:46.


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