Article View: comp.windows.interviews
Article #989Re: ibuild example bug?
From: Graham Dumpleton
Date: Thu, 25 Apr 1991 02:24
Date: Thu, 25 Apr 1991 02:24
32 lines
1392 bytes
1392 bytes
In article <3650@lulea.telesoft.se>, petter@lulea.telesoft.se (Petter Bengtsson) writes:
|> InterViews 3.0 beta, Sun4, Sun C++ v2.0
|>
|> When running the `Namer' dialog box example (p9-23 of
|> "Ibuild User's Guide"), the text entered in the StringEditor
|> is printed twice.
|>
|> Why is Namer::entered() called twice?
|>
|> Has anyone else experienced this behavior?
|>
Yes. What is happening is that the event handler (entered()) is being called
on each change in the value of the button state, i.e 1->0 as well as 0->1.
Use the following code and things are okay.
void Namer::entered() {
int value = 0;
enterBS->GetValue(value);
if (value)
{
cout << stringEditor->Text() << endl;
enterBS->SetValue(0);
}
}
This will ensure that something is only done on 0->1 transition.
I presumed it was an oversight in the guide.
--
Graham Dumpleton (grahamd@otc.otca.oz.au)
Technical Details
Message-ID:
<2618@otc.otca.oz>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!munnari.oz.au!metro!otc!grahamdReferences:
<3650@lulea.telesoft.se>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!munnari.oz.au!metro!otc!grahamd From: grahamd@otc.otca.oz.au (Graham Dumpleton) Newsgroups: comp.windows.interviews Subject: Re: ibuild example bug? Message-ID: <2618@otc.otca.oz> Date: 25 Apr 91 02:24:53 GMT References: <3650@lulea.telesoft.se> Sender: news@otc.otca.oz Reply-To: grahamd@otc.otca.oz.au (Graham Dumpleton) Organization: OTC Development Unit, Australia Lines: 32