Hi folks,
  I'm developing an app using Base with Basic macros.  I've got a form that
displays a customized label for each of a number of retail items.  The
layout code is all done with macros, by copying the data from the form's
query into labels.  I used labels rather than the supplied data-bound edit
boxes because their backgrounds are transparent, allowing them to overlap
and reduce unused space in the information-intensive and space-restricted
labels.  I've created a sub called LayoutLabel that sets the size of each
label to fit the text that it contains and then lays them out appropriately.
  I'd like to be able to do the following:
  - display the label in another form that provides a search for retail
items based on their names and descriptions
  - print the label from that form without having to (visibly) open another
window.

I've learned how to load a form into a new component and frame/window, using
either ThisComponent.Parent.CurrentController.LoadComponent or
ThisComponent.Parent.FormDocuments.LoadComponentFromURL.  I've also learned
how to load a new writer document into a hidden window using
ThisComponent.Parent.CurrentController.Frame.LoadComponentFromURL and
passing the Hidden=true parameter.  I've even found some code that shows me
how to create a frame as a subframe of another frame.
But these techniques don't seem to fit together.  Loading Form components
seems to work in a different sphere of operation from loading other
components.  I've tried giving an already-created frame as the target of
ThisComponent.Parent.FormDocuments.LoadComponentFromURL; this doesn't work
even when a new writer document can be loaded into the same frame.  Passing
the Hidden=true parameter to
ThisComponent.Parent.FormDocuments.LoadComponentFromURL results in a
half-formed component object being returned that has Identifier set to an
empty string and crashes OOo when I try to expand a watch set on it.  I'm
also not able to retrieve the Form object from that component.

Currently my workaround is this: I've copied over the controls and the code
from the label form to the search form, and I'm opening a new window in
order to print the label.  Programmatically printing the label works okay
but attempts to close a window containing a form, even a very basic one that
does not contain controls, raises a CloseVetoException.  I can close a
component containing a new writer document without problems.

So, any help is greatly appreciated.  I've considered creating a Draw
document and modifying its contents in lieu of loading the form and running
LayoutLabel, but am concerned that this will open another can of cans of
worms.  Note that this database is not registered in OpenOffice, and I'd
like to keep it that way, both for ease of installation and so that the
system won't break if somebody moves the file.

Reply via email to