Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » Knob control
Re: Knob control [message #28137 is a reply to message #27950] Wed, 18 August 2010 15:00 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi Koldo

I think I caught some bugs on the knob USC. SetMajorMarks to 3, SetMinorMarks to 4 and the widget display is wrong. However, the CPP paint does its job well. Same way, set SetMajorMarks to 4, SetMinorMarks to 5 and the USC code crashes.

Another minor suggestion, I would define major and minor marks differently like this; but, that's my opinion.

MajorTickInterval and MinorTickInterval so user can decide the tick interval in terms of a quantum of the range. MajorTickinterval of 25 means a major tick every 25 counts of the range and minortick of 5 means a dot every 5 counts of the range

I've done something like that in the slider.cpp file I uploaded on the slider thermometer thread.
this is the relevant paint code
	// draw gradations	
	for( 	int i = Min(); 
			( m_nMajorTicks > 0 ) && ( i <= Max() ) ;
			i += ( m_nMinorTicks == 0 ? m_nMajorTicks : m_nMinorTicks ) ) {
		
		int nPos = SliderToClient( i );
		
		if( ( m_nMajorTicks != 0 ) && ( i % m_nMajorTicks ) == 0 )
			DrawTick( w, MAJOR, (HOVE)HoVe( HORZ, VERT ), nPos, i );
		else if( ( m_nMinorTicks != 0 ) && ( i % m_nMinorTicks ) == 0 )
			DrawTick( w, MINOR, (HOVE)HoVe( HORZ, VERT ), nPos, i );
	}

Best Regards

Re: Knob control [message #28140 is a reply to message #28137] Wed, 18 August 2010 17:01 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
Hello Jerson

Quote:

I think I caught some bugs on the knob USC. SetMajorMarks to 3, SetMinorMarks to 4 and the widget display is wrong. However, the CPP paint does its job well. Same way, set SetMajorMarks to 4, SetMinorMarks to 5 and the USC code crashes.

Solved.

Quote:

MajorTickInterval and MinorTickInterval so user can decide the tick interval in terms of a quantum of the range. MajorTickinterval of 25 means a major tick every 25 counts of the range and minortick of 5 means a dot every 5 counts of the range

I understand the algorithm but I do not know the reason. Why to have MajorTickinterval, MinorTickInterval and range instead of simply MajorTickinterval and MinorTickInterval?


Best regards
Iñaki
Re: Knob control [message #28141 is a reply to message #28140] Wed, 18 August 2010 17:09 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

koldo wrote on Wed, 18 August 2010 20:31


I understand the algorithm but I do not know the reason. Why to have MajorTickinterval, MinorTickInterval and range instead of simply MajorTickinterval and MinorTickInterval?


Simply MajorTickInterval and MinorTickInterval should be fine. Range is nothing more than Min & Max and stays as it is.

An example. If I have Max = 100, MinorTickInterval = 5 and MajorTickInterval = 20, I will get minor marks at 5,10,15, major mark at 20, minor at 25,30,35, major at 40 and so on. Only reason I suggested this arrangement is it is easier to understand while designing the UI.


Re: Knob control [message #28148 is a reply to message #28141] Wed, 18 August 2010 22:27 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
jerson wrote on Wed, 18 August 2010 17:09

koldo wrote on Wed, 18 August 2010 20:31


I understand the algorithm but I do not know the reason. Why to have MajorTickinterval, MinorTickInterval and range instead of simply MajorTickinterval and MinorTickInterval?


Simply MajorTickInterval and MinorTickInterval should be fine. Range is nothing more than Min & Max and stays as it is.

An example. If I have Max = 100, MinorTickInterval = 5 and MajorTickInterval = 20, I will get minor marks at 5,10,15, major mark at 20, minor at 25,30,35, major at 40 and so on. Only reason I suggested this arrangement is it is easier to understand while designing the UI.


Oh. In fact the first version was like this, like in Meter.

If everything agrees I will implement it tomorrow.


Best regards
Iñaki
Re: Knob control [message #28166 is a reply to message #28148] Thu, 19 August 2010 23:17 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
Changes uploaded.

Included SetMajorStep() and SetMinorStep(). If the minor step is not multiple of major step, it is rounded.


Best regards
Iñaki
Re: Knob control [message #28168 is a reply to message #27950] Fri, 20 August 2010 03:22 Go to previous message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

thanks Koldo. Perfect Smile
Previous Topic: Single Threaded RS232
Next Topic: Docking - Saved Layout - Main window size?
Goto Forum:
  


Current Time: Thu Apr 18 04:28:04 CEST 2024

Total time taken to generate the page: 0.01905 seconds