Print Page | Close Window

[QUESTION] Customize PrintPreview Toolbar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=17739
Printed Date: 21 November 2024 at 2:42pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [QUESTION] Customize PrintPreview Toolbar
Posted By: Aaron
Subject: [QUESTION] Customize PrintPreview Toolbar
Date Posted: 31 December 2010 at 7:21am
Hi,
 
I would like to add buttons to the printpreview toolbar... I succeeded in doing this, but how can I catch execute event if user clicks on added button?
 
Thanks a lot in advance
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....



Replies:
Posted By: jpbro
Date Posted: 31 December 2010 at 9:40am
I had hoped that something like this would work, but no luck:


Option Explicit

Private WithEvents mo_PreviewCommandBars As XtremeCommandBars.CommandBars

Private Sub Form_Load()
   Set mo_PreviewCommandBars = Me.PrintPreview1.ToolBar.Parent
End Sub

Private Sub mo_PreviewCommandBars_Execute(ByVal Control As XtremeCommandBars.ICommandBarControl)
   Debug.Print "EXECUTE"
End Sub


The Execute event never fires, even though the object appears to get set alright.

I can't imagine any other way to find out when a control is clicked - there are no appropriate events, and there is no hWnd property to try and do some subclassing.

Probably the best thing to do is to use the ToolbarVisible property (set to false) and then roll your own CommandBars. You need to use a little hack to get the PP to fill the available space after setting ToolbarVisible = False:


Private Sub Form_Load()
   With Me.PrintPreview1
      .ToolBarVisible = False
      ' HACK: After setting ToolBarVisible = False the PrintPreview area
      '       will have a blank space where the toolbar used to be.
      '       If you resize the PP window, it will then fill all of the
      '       available space.
      .Move .Left, .Top, .Width + Screen.TwipsPerPixelX, .Height
      .Move .Left, .Top, .Width - Screen.TwipsPerPixelX, .Height
   End With
End Sub


Happy New Year!


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Aaron
Date Posted: 01 January 2011 at 5:40am

Hi Jason,

Thanks for reply. I tried many things but seems that you can't get reference of the toolbar. Maybe support team can shed a light on this...

Happy new year to you too !!!

 



-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: jpbro
Date Posted: 16 January 2011 at 11:26am
Personally, I'd like to be able to hide the CJ CommandBar (which we can do), and use my own because I want to have different icons, and even have the buttons on a different part of my interface (not necessarily directly connected to the PrintPreview window).

The problem is, we don't have programmatic access to the following:

1) CurrentPage, TotalPages
2) PagesShown (i.e. 1x2, 3x3, etc... tiles of pages)
3) Working ZoomState Property*

Then we could do everything the current toolbar does, but customized to fit the look of our own apps. We could also then extend the functionality as required.



* ZoomState breaks the PrintPreview for me - if I set to to 100 for example, I get this output:



But if I click on a Zoom level in the CommandBar, I get the expected output:



So, this needs to be fixed :(




-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net