From: swallace@lurch.cme.nist.gov (Sarah Wallace)
Newsgroups: comp.windows.interviews
Subject: Problems with mapping in world->InsertTransient()
Date: 28 Aug 92 21:29:39 GMT
Organization: National Institute of Standards and Technology, Gaithersburg, MD

Hi, I have a problem which, as far as I can tell, is the result
of an inconsistancy in InterViews. It seems that world->InsertTransient
doesn't always map all elements of a scene correctly.

I am using version 2.6 and compiling it with g++.

I have a class called SingleChooser which is declared as follows:

class SingleChooser : public VBox {
public:

  SingleChooser(Interactor*, CharsList*, char*, char*);

  CharsList* GetList();
  void SetList(CharsList*);

  void HandleButtonPress();
  void BuildBrowser();
protected:

  Interactor* Interior();
  Interactor* AddScroller(Interactor*);
  
  void AddSelection(char*);
  void DeleteSelection();

  StringBrowser* browser;
  ButtonState* state;
  CharsList* cl;
  char* prompt;
  char* title;
  Interactor* underlying;
};

SingleChooser creates the browser like this:

browser = new StringBrowser(state, 4, BROWSERWIDTH);

then inserts the browser into itself inside some Boxes and Glue.


I use SingleChooser in two different places. In both cases I am inserting
a SingleChooser into a subclass of MonoScene, either ERSNamer or DeallocationNamer.
The hierachy looks like this:

                          MonoScene
                              |
                          DialogBox
                           /     \
                    ERSNamer    DeallocationNamer

In order to appear in the world, both ERSNamer and DeallocationNamer use the
following method:

void DialogBox::PopUp () {
    World* world = underlying->GetWorld();
    Coord x, y;
    underlying->Align(Center, 0, 0, x, y);
    underlying->GetRelative(x, y, world);
    world->InsertTransient(this, underlying, x, y, Center);
}

Here is where the problem lies. When I call this method from DeallocationNamer,
everything works fine. But when I call it from ERSNamer, the browser field of
the SingleChooser doesn't get mapped correctly. More specifically, the display
(which is a TextDisplay*) doesn't get mapped and placed on the screen.

For DeallocationNamer, the singlechooser->browser->display fields are either 0 or
null pointers before the call to InsertTransient, but then are set in that method.
But for ERSNamer, the fields all remain 0 or null even after the call to
InsertTransient.

The obvious answer is that I am doing something differently between ERSNamer and
DeallocationNamer. But myself and several others have checked my code very thoroughly
and we've all concluded that everything is being inserted correctly into ERSNamer.
The only difference we can come up with is that when ERSNamer is called it is the
final of about 5 cascading transient windows and also has two SingleChoosers in it. While 
DeallocationNamer is the only transient window open at the time and has only one
SingleChooser.

If there is a known bug in InsertTransient or any of the Config or DoConfig methods
could someone please point me to a patch. Or if anyone has any ideas, I would
appreciate any help at all. Thank you.

Dylan Ginsburg &
Sarah Wallace 
Newsgroups: comp.windows.interviews