MouseDown implementation

This function implementation creates the graphic iterator and traverses the group until the graphic that contains the selection point is found.

      Boolean
      MouseDown( TMouseDownEvent& mouseDown )
      {
          TGPoint selection( mouseDown.GetEventPosition() );
          GlobalToLocal( selection  );
      
          TGraphicIterator* iterator = fWagon->CreateIterator();
          MGraphic* aGraphic = iterator->First();
      
          while (aGraphic)
          {
              TGRect bounds( fWagon->GetGeometricBounds() );
              if ( bounds.Contains( selection ) )
                  qprintf( "Selected\n" );
              else        
                  qprintf( "not selected\n" );
                  aGraphic = iterator->Next();
          }
      
          iterator->Reset();
          
          Invalidate();
          
              return( TRUE);
      }


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker