On Sat, Dec 12, 2009 at 11:17 PM, Douglas G. Danforth <danforth{([at]})nowhere.xy
Antony,
When I save, unload the module, and then open the form again
I do not see my graph *unless* I explicitly perform an Open
on the pointer I extract from the form by scanning for my type
of view.
In my module, I declare
TYPE
View = POINTER TO RECORD (Views.View) END;
but I have no global variables of type View. View only appears in
definitions of type-bound procedures such as
PROCEDURE (v: View) Restore (f: Views.Frame; l, t, r, b: INTEGER);
So it seems that when the form containing the view is opened, the framework loads my module (controls on the form are linked to variables of my module, and the embedded view is of type View defined in my module). Since the View is an extension of Views.View, Views must be responsible to allocate space for the pointer and the record.
So my module and yours must have some differences that require you to Open on your pointer. It would be interesting to compare their structures. I'll create a simple module of the same structure and forward in a few days (my module has a lot of stuff specific to my application and imports some of my other modules - that obscures the things germane to this discussion)
The way I get a white background is with the notify procedure
in the redraw. I first draw a rectangle with s=Views.fill and
col=Ports.White and then draw my graph on top of that.
I have a gut feeling that by using Meta I can create a very small
procedure that will allow one to relink an arbitrary view embedded
in a opened form to a view variable. This assumes there is but one
instance of the view type in the form (is it possible to store a 'titled'
view and retrieve it based on its title?)
-Doug
Unless we're trying to do fundamentally different things, I'm not sure it is necessary. The conceptual breakthrough that I had based on this thread was that I didn't need to be calling NEW(v) in order to create a View on a form. I never explicitly deal with a view variable, other than extending the type-bound procedures. It's all taken care of by Views with no intervention on my part. I kept trying to figure out how to call something to create the view, but I don't have to (except to once create a view with Deposit to copy onto the form). In other words I was trying to solve a difficult problem that didn't exist!
The design pattern for me is creating a form that has a graphic that changes when the values of variables are changed. If I want to store the way it looks for a particular set of values, I would have to print it to a file as a pdf or ps file.
Antony Tersol wrote:
Douglas,
Thanks for initiating this discussion. I have been wondering how to accomplish something similar, but had not taken the time to explore it. Instead I was using a Command Button on a form calling a "Deposit" command from within my module followed by StdCmds.Open"
PROCEDURE Deposit*;
VAR v: View;
BEGIN NEW(v); Views.Deposit(v)
END Deposit;
This opens a document with the view (a graph) embedded. Other controls on the first form modify parameters, and a redraw is invoked by appropriate notify procedures.
I didn't understand how to embed the graph within the initial form, thinking I would have to call a Deposit procedure. Your "Still having problems" post prompted me to try to reproduce your problem. I selected the graph view from the opened document and copied it into the form. I saved the form, closed it and reopened and the graph was still there. Then I unloaded the module and did it again, and the graph was again there. So it is not necessary to call "NEW(v)" to create the graph. Storing the form with the embedded view is sufficient. When the form is opened, the module is loaded, and the view is instantiated. It is not necessary for my module to explicitly allocate a pointer to the view within my module, it is restored by Views.
One question: when I open the graph with the Deposit and Open commands it opens on a white background. On the form it is on a grey background. Something simple to make it white? I'm not seeing the obvious.
Thanks,
Antony
On Sat, Dec 12, 2009 at 7:09 PM, Douglas G. Danforth <danforth{([at]})nowhere.xy
Folks,
I found the major blunder that was causing the trap on attempted deselection.
I had an update within an update which was causing an infinite (slow)loop.
So almost there. Form now has an embedded graph with a white background
which I draw first and my curves appear correctly and change under button
pushing.
Only one problem remains and that is when the form is first opened I get this
trap
ASSERT(v.context IS Documents.Context, 24)
StdDialog.Open
StdDialog.ViewHook.Open
Views.Open
Views.OpenView
so it looks like my context is not a document context.
Am I opening the wrong type of 'view'?
-Doug
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
Received on Sun Dec 13 2009 - 10:01:32 UTC