Strangeness with Dialog.Update and Properties.CollectProp

From: [at]} <Stewart>
Date: Thu, 08 Jul 1999 15:44:07

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 (eg. 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 acheive this is to set up a background
task (Services.Action) to poll the properties of the Focus view using
Properties.CollectProp. 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. The notification

procedure for the dialog copies the properties and calls
Properties.EmitProp to update the view state.

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;

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.

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?

Thanks for your help.

Cheers,
- Stewart
Received on Thu Jul 08 1999 - 09:41:01 UTC

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