Re: Fix for odd button behavior

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue May 11 1999 - 13:06:17 MEST


Hi Glen,

   thanks for looking at this problem. A better fix is the following:

   if (fgDbw != event->fWindow) return kTRUE;

instead of your proposed fix. I've added this to the development version.


Cheers, Fons.



Glen R. Salo wrote:
> 
> Dear Rooters,
> 
> I've noticed an odd behavior in TGTextButtons, TGRadioButtons, and
> TGCheckButtons.  Run test/guitest, click on select Dialog... from the Test pull
> down menu and click on Tab 2.  Then press mouse button 1 over Button 1.  Now,
> without releasing the mouse button, move the cursor over Button 2, Check 1,
> Check 2, etc. The Text buttons will depress when you move the mouse over them,
> the Check buttons will become checked, and the radio buttons will be selected.
> In fact, it is possible to get all of the radio buttons selected at one time!
> My fix for this behavior is given below.  I hope this helps someone.
> 
> Glen
> 
> *********************************************************************
> 
> Glen R. Salo                                   g.r.salo@ieee.org
> Mission Research Corporation                   (937)429-9261 Ext. 119
> 3975 Research Boulevard                        (937)429-2625 Fax
> Dayton, Ohio 45430-2108
> 
> *********************************************************************
> 
> Bool_t TGButton::HandleCrossing(Event_t *event)
> {
>    // Handle mouse crossing event.
> 
>    if (fTip) {
>       if (event->fType == kEnterNotify)
>          fTip->Reset();
>       else
>          fTip->Hide();
>    }
> 
>    if (!event->fCode) return kTRUE;  // My fix
> 
>    if (!(event->fState & (kButton1Mask | kButton2Mask | kButton3Mask)))
>       return kTRUE;
> 
>    if (fState == kButtonEngaged || fState == kButtonDisabled) return kTRUE;
> 
>    if (event->fType == kEnterNotify)
>       SetState(kButtonDown);
>    else
>       SetState(kButtonUp);
> 
>    return kTRUE;
> }
> 
> Bool_t TGCheckButton::HandleCrossing(Event_t *event)
> {
>    // Handle mouse crossing event.
> 
>    if (fTip) {
>       if (event->fType == kEnterNotify)
>          fTip->Reset();
>       else
>          fTip->Hide();
> 
>    }
> 
>    if (!event->fCode) return kTRUE;  // My fix
> 
>    if (!(event->fState & (kButton1Mask | kButton2Mask | kButton3Mask)))
>       return kTRUE;
> 
>    if (fState == kButtonDisabled) return kTRUE;
> 
>    if (event->fType == kEnterNotify) {
>       PSetState((fPrevState == kButtonUp) ? kButtonDown : kButtonUp);
>    } else {
>       PSetState(fPrevState);
>    }
>    return kTRUE;
> }
> 
> Bool_t TGRadioButton::HandleCrossing(Event_t *event)
> {
>    // Handle mouse crossing event.
> 
>    if (fTip) {
>       if (event->fType == kEnterNotify)
>          fTip->Reset();
>       else
>          fTip->Hide();
> 
>    }
> 
>    if (!event->fCode) return kTRUE;  // My fix
> 
>    if (!(event->fState & (kButton1Mask | kButton2Mask | kButton3Mask)))
>       return kTRUE;
> 
>    if (fState == kButtonDisabled) return kTRUE;
> 
>    if (event->fType == kEnterNotify) {
>       PSetState(kButtonDown);
>    } else {
>       PSetState(fPrevState);
>    }
>    return kTRUE;
> }

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:32 MET