Slider value handles -ve values by clipping to zero
see http://nanapro.org/en-us/forum/index.php?u=/topic/1092/ggslider-value-range
This commit is contained in:
		
							parent
							
								
									02d082959f
								
							
						
					
					
						commit
						26c28ae4be
					
				| @ -151,7 +151,13 @@ namespace nana | |||||||
| 		bool vertical() const; | 		bool vertical() const; | ||||||
| 		void maximum(unsigned); | 		void maximum(unsigned); | ||||||
| 		unsigned maximum() const; | 		unsigned maximum() const; | ||||||
| 		void value(unsigned); | 
 | ||||||
|  | 		/** Set slider value
 | ||||||
|  |             @param[in] v new value for slider. | ||||||
|  |             v will be clipped to the range 0 to maximum | ||||||
|  |         */ | ||||||
|  | 		void value(int ); | ||||||
|  | 
 | ||||||
| 		unsigned value() const; | 		unsigned value() const; | ||||||
| 		unsigned move_step(bool forward);                         ///< Increase or decrease the value of slider.
 | 		unsigned move_step(bool forward);                         ///< Increase or decrease the value of slider.
 | ||||||
| 		unsigned adorn() const; | 		unsigned adorn() const; | ||||||
|  | |||||||
| @ -844,10 +844,14 @@ namespace nana | |||||||
| 			return get_drawer_trigger().get_model()->attribute().vmax; | 			return get_drawer_trigger().get_model()->attribute().vmax; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		void slider::value(unsigned v) | 		void slider::value(int v) | ||||||
| 		{ | 		{ | ||||||
| 			if(handle()) | 			if(handle()) | ||||||
| 			{ | 			{ | ||||||
|  | 			    // limit to positive values, vcur expects unsigned
 | ||||||
|  | 			    if( v < 0 ) | ||||||
|  |                     v = 0; | ||||||
|  | 
 | ||||||
| 				if(get_drawer_trigger().get_model()->vcur(v)) | 				if(get_drawer_trigger().get_model()->vcur(v)) | ||||||
| 					API::refresh_window(handle()); | 					API::refresh_window(handle()); | ||||||
| 			} | 			} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 James Bremner
						James Bremner