Toggling Zoom with a Custom Toolbar

The Libronix Digital Library System is a very modular framework. The user interface is separate from the system internals. This modularity not only makes for a better application architecture, it allows us to deliver new features and user interface without changing the underlying system. (Below I am going to show you how to add a “Toggle Zoom” feature right now, without downloading anything.)

The Libronix DLS exposes its internal interfaces publicly, allowing external applications to control it. It also allows users to add their own functionality, either with an external programming language or with JavaScript inside custom toolbar commands.

The documentation for the scriptable object model is available as a free Libronix DLS compatible resource. The automation newsgroup is where you can ask questions about automating the Libronix DLS and get help from Logos programmers and other users.

I'm going to show you how to add a custom toolbar with a new command that toggles resource windows between their default zoom and 200% zoom. (This is really useful when you are projecting Logos Bible Software in a classroom, or even just leaning back to read.)

First, right-click on a toolbar and select Customize... Then choose New... and give your toolbar a name, like “Logos Blog Toolbar”.

The Category drop down lets you choose from the kind of commands you can add to your customer toolbar. Different categories contain most of the menu commands in the system. We want to create a new command, though, not use an existing one. So choose Special from the Category drop down and then select Run Script Code and click the Add button to move it to your toolbar list on the right.

Now click Details... to edit the Run Script Code item. In the Command Details dialog give your command the name Toggle Zoom and choose a display style – I use Image and Text for custom commands. The Change... button lets you choose an icon for the button.

Now, in the Script Code box, copy and paste the script below.

// Toggle the zoom of a resource window

var objWindow = Application.ActiveWindow;

if ( objWindow != null )
{
	if ( objWindow.Type == "resource" )
	{
		var objView = objWindow.View;

		if ( objView && objView.IsOpen() )
		{
			var objDisplayPane = objView.Panes("display");

			if ( objDisplayPane )
			{
				var strZoom = objDisplayPane.Control.Zoom;

				if ( strZoom == "auto" || strZoom == "100%" )
					strZoom = "200%";
				else
					strZoom = "auto";

				objDisplayPane.Control.Zoom = strZoom;
			}
		}
	}
}

Now use OK and Close to get out of the dialogs, and you should see your new toolbar on the screen. (You can drag it wherever you would like using the left-side of the toolbar.) Open a resource and click your button to toggle the zoom factor back and forth. (You can edit the script code you pasted to choose something other than 200%, too.)

2 Comments

Thanks for that, Bob. I can use this same outline for some other coding ideas that require access to the active window.

Thanks
Richard

Thanks. I am currently learning Java and this was a cool little script.

~ Reid

Leave a comment

Subscribe

Enter your email address:

Bible.Logos.com

Bible Search

Verse:
John 3:16; Jn 3:16; John 3

Keyword:
Salvation, Jesus, Gospel

With Operators:
AND, OR, NOT, “ ”

Add this to your site!

Social Networking

RefTagger

Bible Options

Add this to your site!

Recent Comments

  • Reid Curry: Thanks. I am currently learning Java and this was a read more
  • Richard L: Thanks for that, Bob. I can use this same outline read more

September 2009

Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      

Archives

Employee Blogs

Bob Pritchett
RSS FireSomeoneToday
RSS BobPritchett.com
Rick Brannan
RSS Ricoblog
RSS PastoralEpistles.com
Mike Heiser
RSS The Naked Bible
RSS Scribal Practices
RSS PaleoBabble
Steve Runge
RSS NT Discourse
Bill Nienhuis
RSS OriginalExpression
Sean Boisen
RSS Blogos
Phil Gons
RSS PhilGons.com
Ryan Burns
RSS Going to Seminary
John Barry
RSS The Infinite in Everything

Poll

  • What’s your favorite kind of blog post?