Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - [QUESTION] Customize PrintPreview Toolbar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[QUESTION] Customize PrintPreview Toolbar

 Post Reply Post Reply
Author
Message
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2187
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Topic: [QUESTION] Customize PrintPreview Toolbar
    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....
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1335
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2187
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post 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....
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1335
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.094 seconds.