Re: Strangeness with Dialog.Update and Properties.CollectProp

From: [at]} <gruntz{>
Date: Thu, 15 Jul 1999 18:24:04 +0200

> Hi Folks,
>
> I'm wondering if someone can help me here...
>
> I have a view (PrivGraph.View) that displays a directed graph. The display
> is affected by a number of different parameters, so I defined a
> Properties.Property to represent them:
>
> Prop* = POINTER TO PropDesc;
> PropDesc* = RECORD (Properties.Property)
> options* : SET;
> xAngle*, yAngle* : REAL;
> separation* : REAL;
> nodeColour*, edgeColour* : Ports.Color;
> ...
> END;
>
> ...
>
> VAR graphProp* : Prop;
>
> The view responds to Properties.SetMsg and Properties.PollMsg.
>
> I want to be able to control some of the view's properties are directly via
> mouse interaction (e.g.. rotation changes xAngle, yAngle) and some via a
> dialog. I want it to work like the control Inspector: the dialog edits the
> properties of the focus view, and updates automatically when these change.
>
> As far as I can see, the only way to achieve this is to set up a background
> task (Services.Action) to poll the properties of the Focus view using
> Properties.CollectProp.
yes, an action is necessary in order to update the dialog.
The information, that the selection changed in a container
is not distributed by any broadcast. Thus, you have to define your
own action or you define a guard which adjust your dialog. Guards
are executed regularly (in order to have a chance to react upon the
change of a selection).

> My Action copies these properties into a global
> variable (graphProp) which is linked to my dialog. It then calls
> Dialog.Update(graphProp) to update the dialog state.
ok. The Action in ObxCubes first checks, whether a cube is
visible at all. If not, the action terminates. It is restarted in the
restore procedure of ObxCubes. Second it picks the singleton
view and checks, whether it is a cube. If this is the case, then
it is compared with the last singleton cube view. If it is different,
then the properties of the new cube are picked and stored in
the interactor, and then Dialog.Update is called to update the
dialog.

> The notification
> procedure for the dialog copies the properties and calls
> Properties.EmitProp to update the view state.
I do not see why this is necessary, as only the dialog needs
to be updated, not your view.


> It seems to work ... up to a point. Two problems that have me mystified.
>
> 1) In order to receive a Properties.PollMsg from the framework, it seems
> that my view must be part of the selection within its container. I used
> ObxCubes as an example of how this should work. In ObxCubes, if the user
> clicks on the view with the modifier key, the view opens a dialog, and sets
> itself as a singleton selection using:
>
> c := Containers.Focus();
> IF c.opts # Containers.mask THEN
> ...
> c.SetSingleton(v);
> END;
yes, this is not the most elegant solution, probably we will change this
for a next release. The usual case is that the view is selected as singleton
in order to be manipulated by a property editor. Second, the editor
should be accessible over the Edit->Object Properties menu.

> Once my view is a selected singleton, it a receives Properties.PollMsg in
> response to Properties.CollectProp. Unfortunately, in this state it doesn't
> receive any control messages. Even when deposited in its own window, the
> views container interprets control messages (eg. for resizing, moving, etc)
> so I can no longer interact with it using the mouse.
>
> Question 1: How do I make my view so that it can receive PollMsgs AND
> control messages at the same time? I realise that I can implement this
> myself by bypassing the Properties/Focus mechanism, but it ought to be
> possible to do within the framework.
ok. In general, properties are only collected from the selection, thus your
view has to be selected in order to receive Properties.PollMsg/SetMsg.

However, the methods Properties.EmitMsg/CollectMsg are sent to the
focus view (these are controller messages!). If the focus is a container,
then he asks for the properties of its selection (and returns the intersection
of all the properties). If the focus is a simple view as in your case,
then the these two messages have to be answered as well. You have
to send a PollMsg/SetMsg to the view itself. Then you can change
the properties even if the view has the focus.

I have attached a simple view with a color. This color attribute can be
changed using the Attributes menu either if the view is contained in a
selection or if the view has the focus.

> 2) I tried to link my dialog to a property. As declared above, graphProp is
> a pointer to a record. Thus, in my control link fields I have values like:
>
> PrivGraph.graphProp.separation
>
> The problem is that Dialog.Update(graphProp^) does not update the dialog.
> If I declare graphProp as
>
> VAR graphProp : PropDesc;
>
> it seems to work fine.
>
> Question 2: Why doesn't Dialog.Update work if the interactor is a heap
> object accessed via a pointer? Do interactors only work if the record
> itself is declared as a global variable?
no, this should work. I just linked an integer field to M.para.val defined as
    para*: POINTER TO RECORD val*: INTEGER END;
and both, Dialog.Update(para) and Dialog.Update(para^) work. Dialog.Update also works,
if the interactor record contains a reference.

Hope, this helps,

- Dominik

StdCoder.Decode ..,, ..ud....3Qw7uP5PRPPNR9Rbf9b8R79FTvMf1GomCrlAy2xhX,Cb2x
hXhC6FU1xhiZiVBhihgmRiioedhgrZcZRiXFfaqmSrtuGfa4700zdGrr8rmCLLCJuyK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
HE.6wlgR0Oxad.az86Utj00LCjaUojC0eY....
--- end of encoding ---
Received on Thu Jul 15 1999 - 18:30:15 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:43 UTC