🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.interviews
Article #1576

Re: Ibuild example - question.

#1576
From: Alexander Gassmann
Date: Wed, 27 Jan 1993 13:53
44 lines
2459 bytes
In article <1993Jan27.084420.23833@wyrdrune.demon.co.uk>, guy@wyrdrune.demon.co.uk (Guy Gascoigne-Piggford) writes:
|> 
|> I've been working through the tutorial in the ibuild users guide,
|> building the Namer example and have run into an irritating problem,
|> I've related the pushButton instance to the StringEditor instance and
|> filled in the rest of the Namer::entered() method, but when I run the
|> program and test it I find that I go through this method TWICE instead
|> of once, regardless of whether I've pressed return in the string field
|> or clicked on the entered button.

Aaah yes, that sounds very familiar to me. I think it is a timing
problem... When the ButtonState is set to 1, the associated method
is called. But it seems that InterViews calls it twice, once
when the ButtonState is 1, a second time when the ButtonState is
0. To avoid that your method gets called twice, you need to do 
the following thing:

  Give your ButtonState a good name (in IBuild, e.g. ConfirmBS)

  Export the ButtonState from the core class (Check the Export-Box)

  Regenerate the source code of the core class

  In your associated method, you need to do the following things FIRST:

    int ButtonStateValue;
    ConfirmBS->GetValue(ButtonStateValue);
  
    // To make sure that the Dialog shows up only when needed:
    if (ButtonStateValue==0) return;

  At the end of the method, make sure the ButtonState is reset:

    // Now the Button can be reset
    ConfirmBS->SetValue(0);

Since I am quite new to InterViews myself, I am not sure it is the
best method. At least it works :-)

If anybody has a better suggestion, please feel free to correct me.

Hope that will help,

Alexander Gassmann
Technical Details
Message-ID: <1k6455INNhbv@rs2.hrz.th-darmstadt.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!scsing.switch.ch!univ-lyon1.fr!ghost.dsi.unimi.it!rpi!usc!howland.reston.ans.net!spool.mu.edu!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!news.th-darmstadt.de!kirsche!alex
References: <1993Jan27.084420.23833@wyrdrune.demon.co.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!scsing.switch.ch!univ-lyon1.fr!ghost.dsi.unimi.it!rpi!usc!howland.reston.ans.net!spool.mu.edu!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!news.th-darmstadt.de!kirsche!alex
From: alex@kirsche.intellektik.informatik.th-darmstadt.de (Alexander Gassmann)
Newsgroups: comp.windows.interviews
Subject: Re: Ibuild example - question.
Date: 27 Jan 1993 13:53:41 GMT
Organization: Technische Hochschule Darmstadt
Lines: 44
Sender: alex@kirsche (Alexander Gassmann)
Distribution: world
Message-ID: <1k6455INNhbv@rs2.hrz.th-darmstadt.de>
References: <1993Jan27.084420.23833@wyrdrune.demon.co.uk>
NNTP-Posting-Host: kirsche.intellektik.informatik.th-darmstadt.de