Esempio n. 1
0
//___________________________ 
void RangeClicked() {

	TPad *pad = (TPad *) gCanvas->GetSelectedPad();
	if (!pad) return;

	int eventtype = pad->GetEvent(); 
	
	if ( pad->GetEvent() == 12 && !gMinimumIsSet && !gMaximumIsSet) {   //   kButton1Down   //kButton1Double=61    //middle button 1 click = 12

		//Get the abscissa  
		gMin = pad->GetEventX();
		gMin = pad->AbsPixeltoX(gMin);
		printf(" [ %.3f , \n",gMin);
		gMinimumIsSet = true ;
		gMaximumIsSet = false ; 
		return ; // after this return the condition of the block below will be satisfied  
		} 
		
	if ( pad->GetEvent() == 12 && gMinimumIsSet && !gMaximumIsSet) {

		//Get the abscissa  
		gMax = pad->GetEventX();
		gMax = pad->AbsPixeltoX(gMax);
		
		//print the values
		if(gMin>=gMax) {	cout << " WARNING : Min >= Max , "<< " choose a value > "<< gMin << " \n" << endl ; return ; }
		else printf(" [ %.3f , %.3f ]\n",gMin,gMax);
		
		//reset 
		gMinimumIsSet=false ;
		gMaximumIsSet=false ;
		return ; 
		}
	
	return ;

}