How can I hide/inactivate a toolbar button/option

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
adenismern
User
Posts: 6
Joined: Thu Jul 16, 2015 7:35 pm

How can I hide/inactivate a toolbar button/option

Post by adenismern »

Hi,

I would like to know how can I hide/inactivate a toolbar button/option so it is not visible to the end user

Code sample would be appreciated (vb.net, c# or PowerBuilder)

Thank you.

Alain.
User avatar
Patrick-Tracker Supp
Site Admin
Posts: 1645
Joined: Thu Mar 27, 2014 6:14 pm
Location: Vancouver Island
Contact:

Re: How can I hide/inactivate a toolbar button/option

Post by Patrick-Tracker Supp »

Hello Alain,

Thank you for the post. Most commands in the Viewer may be accessed to enable or disable them by changing their State to Online or Offline.
To Disable the "Print" command, to prevent any printing from the Viewer, set the command as:

Code: Select all

SetProperty("Commands["Print"].State", "Offline", 0);
You will find more information here:https://help.pdf-xchange.com/DEV/de ... _a_command

I hope this helps!
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.

Cheers,

Patrick Charest
Tracker Support North America
adenismern
User
Posts: 6
Joined: Thu Jul 16, 2015 7:35 pm

Re: How can I hide/inactivate a toolbar button/option

Post by adenismern »

Hi,

Thank you for the reply.
It work for the print command.
Now the button is greyed but still visible on the toolbar.
Is there a way to make it completely disappear ?

Thanks and have a great day !

Alain.
User avatar
Will - Tracker Supp
Site Admin
Posts: 6815
Joined: Mon Oct 15, 2012 9:21 pm
Location: London, UK
Contact:

Re: How can I hide/inactivate a toolbar button/option

Post by Will - Tracker Supp »

Hi Alain,

I'm afraid that there's no way to do this for individual tools, only to make the whole toolbar disappear.

Cheers,
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.

Best regards

Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
adenismern
User
Posts: 6
Joined: Thu Jul 16, 2015 7:35 pm

Re: How can I hide/inactivate a toolbar button/option

Post by adenismern »

Ok.

There is too many options that would be disabled on the toolbars and will have users requesting things we don't want them to do.
We only want them to insert notes, highlight, print and zoom.

So...

Is there a way then to create a sticky note and highlight without using the toolbar button (we can have our own tool bar) ?
Would like it to work just like when you click the toolbar button, getting into "sticky note mode"
Would also like to define the notes propertie and prevent the user to access the note properties so he can't change what we put in by default.

Code for sticky note, highlight and properties blocking would be welcome :D .

Thanks.

Alain.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17823
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: How can I hide/inactivate a toolbar button/option

Post by Tracker Supp-Stefan »

Hello Alain,

Install the end user Viewer, and customize the toolbars in it - leaving only the commands and bars you want. Then export those to a data file. You can then LoadSettings() and the interface of the ViewerAX will look exactly as you want it.
After that you can lock the View and make sure that users do not see unwanted tools and menus.

Alternatively - if you want to hide our UI completely and provide your own button - You can use Tool.Active to specify which tool to be activated when your users click your own button.

Regards,
Stefan
adenismern
User
Posts: 6
Joined: Thu Jul 16, 2015 7:35 pm

Re: How can I hide/inactivate a toolbar button/option

Post by adenismern »

Hello,

Thank you again for prompt responses.

The: SetProperty( 'Tools.Active', 'StickyNote', 0 ) is working pretty well.

Now, how can I :
- set the note properties to be created
- disable the properties access to the end user

Thanks again for you support !!

Alain
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17823
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: How can I hide/inactivate a toolbar button/option

Post by Tracker Supp-Stefan »

Hello Alain,

The command you are calling activates the sticky note tool, and then lets the customer use it as if he had activated it himself.
If you want to just place a sticky note via code (as apparently you want to control all the settings) - there are easier methods.
You can e.g. allow your customer to click the button for placing your custom stamp, then record the next mouse click, capture the position of that click on the document, and place an annotation/stamp/sticky note using those mouse and page coordinates entirely in the background with JS.

Regards,
Stefan
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: How can I hide/inactivate a toolbar button/option

Post by Vasyl-Tracker Dev Team »

Hi Alain.
Now, how can I :
- set the note properties to be created
- disable the properties access to the end user
You may try to use:

Code: Select all

int curStyleID = 0;
GetProperty("Tools.StickyNote.Style", out curStyleID);
// change tool props
string pathToCurProps = "Commenting.StickyNote.Styles[#" + curStyleID + "]";
int newFillClr = RGB(255,0,0); // red 
SetProperty(pathToCurProps + ".FColor", newFillClr);
SetProperty(pathToCurProps + ".Opacity", 0.5);
SetProperty(pathToCurProps + ".Type", "Star");
To disable properties - you may hide the properties toolbar and block access to 'Properties...' command:

Code: Select all

SetProperty("View.Bars["Properties"].Visible", false);
SetProperty("Commands[#36333].State", "Offline");
HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
adenismern
User
Posts: 6
Joined: Thu Jul 16, 2015 7:35 pm

Re: How can I hide/inactivate a toolbar button/option

Post by adenismern »

Hi,

GetProperty always return null value.

I tried GetProperty and DoVerb( 'General.AllowAllAccelerators', 'getNamed', DataIn, DataOut, 0 )
Also tried only "get" with DoVerb

Any ideas ?
Do I need to initialize something, all toolbars are hidden.

Code is in PowerBuilder, here is a sample taken from your help pdf document and modified to PowerBuilder
------------------
Any DataIn, DataOut

Ole_PDF.Object.GetProperty( 'General.AllowAllAccelerators', DataOut, 0 )
Ole_PDF.Object.DoVerb( 'General.AllowAllAccelerators', 'getNamed', DataIn, DataOut, 0 )
------------------

Thanks

Alain.
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: How can I hide/inactivate a toolbar button/option

Post by Vasyl-Tracker Dev Team »

Hi, Alain.
GetProperty always return null value.
Strange. It looks like that something is wrong with obtaining variant-type on PowerBuilder's side. With C#/C++/Delphi/VB6 - everything is OK with GetProperty/SetProperty.

Try to use other way to get/set props using standard property-accessor:

curVal = pdfViewer.Property("PropertyName", 0);
...
pdfViewer.Property("PropertyName", 0) = newVal;

Sorry, I'm not PowerBuilder programmer ..

HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Post Reply