416-621-9348 cgreaves@chrisgreaves.com Visit www.ChrisGreaves.com for this image! Chris_GEDC1894_Head (Small).JPG
Home Site About Services Products

Best Fit Algorithm (Home) The Macro Building The Data Array Printing The Best Fit Results A Typical Data Table Results Of Best Fit

Best Fit Algorithm (Minimize Wasted Space)

Best-fit is a generalized means of making best use of resources. Best-fit is employed in my best-fit-toolbars macro, that re-arranges your displayed toolbars to make the best use of available space. All of the commands of BestFit may be accessed directly through the toolbar.

There’s no need to “Turn Off Unnecessary Toolbars”; no need to “Streamline the toolbars you keep”; feel free to go ahead and To add a word-count button, (click Tools > Customize,) or as many buttons as you want. My best-fit-toolbars macro will make the best use of the entire screen.

Installation is a snap - the package is self-installing, and yes, you can inspect the installation code.

That same algorithm can be used to determine the best sequence of transferring your old VCR video tapes to DVD discs.

The code is deceptively simple, once all the toolbars have been located:

''' Process any toolbar data found
If UBound(lngItemList, 2) > 0 Then ' we found some cb
ReDim Preserve lngItemList(UBound(lngItemList, 1), UBound(lngItemList, 2) - 1)
lngMaxRowIndex = lngMaxRowIndex + 1
''' Assign new positions to all command bars that can afford to share a row.
Call FitLessThanBuffer(lngItemList, lngBucketSize, lngMaxRowIndex)
''' Assign new positions to all command bars that won't even fit on a row by themselves.
Call FitGreaterThanBuffer(lngItemList, lngBucketSize, lngMaxRowIndex)
''' Now use the adjusted RowIndex settings to re-place the toolbars
Call PlaceToolbars(lngItemList, intcCBName, -1)
Else ' no cb found
End If

We need to build an array lngItemList() of data that reflects the VCR tapes, including the duration in minutes, then use the functions FitLessThanBuffer and FitGreaterThanBuffer; the function PlaceToolbars can merely dump a list of VCR names for each pass through the loop, each pass representing a single DVD disk.

The Macro


Loading

Toronto and Mississauga, Thursday, March 18, 2010 7:10 PM

Copyright © 1996-2010 Chris Greaves. All Rights Reserved.