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 » U++ Library support » Slider&ProgressIndicator » Slider with thermometer like scale
Slider with thermometer like scale [message #27646] Tue, 27 July 2010 17:42 Go to next message
koldo is currently offline  koldo
Messages: 3402
Registered: August 2008
Senior Veteran
Hello all

Is it planned in short term to mark the slider on its side with gradations like a thermometer scale?

If no, do you have any aesthetic ideas about how to do it?

Did you include it in the same Slider ctrl or you would do a new LengthMarkings class.


Best regards
Iñaki
Re: Slider with thermometer like scale [message #27650 is a reply to message #27646] Tue, 27 July 2010 19:06 Go to previous messageGo to next message
avpavp is currently offline  avpavp
Messages: 19
Registered: September 2009
Promising Member
Hi, I have made a lot of improvements to the slider ctrl, including the ability to have a variable number of labels on the side.

Also, multiple thumbs on the same slider, and ctrls that are tied to the slider for output (ie a label ctrl that is updated automatically with the slider value).

I have been planning to submit this for incorporation into Upp, but I haven't had time to do much testing on it yet. Also, I haven't figured out how to add the Upp documentation yet...

I am using it in my own project, it seems to be working fine so far.

Anthony
Re: Slider with thermometer like scale [message #27651 is a reply to message #27650] Tue, 27 July 2010 19:33 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

I'm relatively new to UPP and will like to learn how to do this. Do you think you could share the relevant parts of how you did this scale?

Thank you in advance for any assistance you may provide
Jerson
Re: Slider with thermometer like scale [message #27663 is a reply to message #27651] Wed, 28 July 2010 17:05 Go to previous messageGo to next message
avpavp is currently offline  avpavp
Messages: 19
Registered: September 2009
Promising Member
Here are my files for your reference. replace the ones in the ctrllib folder.

If you make any additions, let me know, as possibly we can include them as well.

I still plan to submit this for inclusion to the core asap...
  • Attachment: Slider.zip
    (Size: 2.95KB, Downloaded 433 times)
Re: Slider with thermometer like scale [message #27664 is a reply to message #27663] Wed, 28 July 2010 17:21 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Anthony

thank you so much. I'll let you know if I can add anything to what you've done; though I'm not counting on it. I'm a newbie yet.

Regards
Jerson
Re: Slider with thermometer like scale [message #27665 is a reply to message #27663] Wed, 28 July 2010 17:30 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3402
Registered: August 2008
Senior Veteran
Hello avpavp

Thank you for your improvements Smile.

Some questions and comments:

- With SetTextLabels(int n) we can set the number of labels. How it is possible to paint the length markings or gradations?.

- Now the thumb goes under the labels. It seems to be more natural that the thumb is over the labels

index.php?t=getfile&id=2688&private=0
  • Attachment: dib.PNG
    (Size: 8.45KB, Downloaded 1227 times)


Best regards
Iñaki
Re: Slider with thermometer like scale [message #27671 is a reply to message #27665] Thu, 29 July 2010 04:27 Go to previous messageGo to next message
avpavp is currently offline  avpavp
Messages: 19
Registered: September 2009
Promising Member
I changed it so the thumbs are on top and added the gradations

SetGradations( int n );

You may need to size the slider in the layout manager to make the text etc fit best.

Anthony
  • Attachment: Slider.zip
    (Size: 3.14KB, Downloaded 431 times)
Re: Slider with thermometer like scale [message #27672 is a reply to message #27671] Thu, 29 July 2010 08:46 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3402
Registered: August 2008
Senior Veteran
avpavp wrote on Thu, 29 July 2010 04:27

I changed it so the thumbs are on top and added the gradations

SetGradations( int n );

You may need to size the slider in the layout manager to make the text etc fit best.

Anthony


Hello avpavp

Thank you very much for your fast response!

I would like to comment you some additional details Smile :

- Now it is not possible to use GetData() because it is ambiguous. If you use GetData() the compiler does not know which of both to use:
 	virtual Value GetData(int nIndex = 0) const;
	virtual Value GetData() const;



- Gradations are there, but they are not very visible. Would it be possible to increase its length and/or width?

index.php?t=getfile&id=2690&private=0

- Screenshot above has these lines:

		slider.SetTextLabels(5);
		slider.SetGradations(3);


It seems more natural to have the same number of gradations and labels.

Thank you again Smile.
  • Attachment: dib.PNG
    (Size: 9.53KB, Downloaded 1266 times)


Best regards
Iñaki
Re: Slider with thermometer like scale [message #27678 is a reply to message #27672] Thu, 29 July 2010 13:34 Go to previous messageGo to next message
andrei_natanael is currently offline  andrei_natanael
Messages: 262
Registered: January 2009
Experienced Member
Hi,

I disagree a bit with API. What about having...
SetTickNum(int n); // SetTickCount
TickHaveLabel(bool b = true); // TickHaveNum , TickHaveText, HaveTickText, etc.

or something similar.

Andrei
Re: Slider with thermometer like scale [message #27679 is a reply to message #27672] Thu, 29 July 2010 13:41 Go to previous messageGo to next message
avpavp is currently offline  avpavp
Messages: 19
Registered: September 2009
Promising Member
Thanks for your feedback.

I'll add some customization to the gradients over the next day or two. Probably I will add some ability for major and minor ticks (different sizes).

I think the ticks and labels should be independent. Commonly (I think) you might want more ticks than labels.

Anything else I should consider or other ideas while I'm working on this?

Thanks,
Anthony
Re: Slider with thermometer like scale [message #27685 is a reply to message #27679] Thu, 29 July 2010 15:36 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3402
Registered: August 2008
Senior Veteran
Ok!

Best regards
Iñaki
Re: Slider with thermometer like scale [message #27696 is a reply to message #27685] Thu, 29 July 2010 17:32 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Have the labels determined by a Convert instance (or StdConvert by default). It'll be simpler but more flexible interface.

The Paint code could use a little improvement too. The labels are too close to the 'track' IMO and the tick could also extend slightly further upwards.
Re: Slider with thermometer like scale [message #27704 is a reply to message #27679] Fri, 30 July 2010 03:05 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi Anthony

Since you're looking at the code anyway, could you look at the possibility of making the slider look something like these?
index.php?t=getfile&id=2692&private=0
  • Attachment: slider1.gif
    (Size: 5.67KB, Downloaded 1467 times)
Re: Slider with thermometer like scale [message #27716 is a reply to message #27704] Fri, 30 July 2010 12:47 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
For the curved one you would want to modify the ctrl from this thread.

You may only have to change the images.
Re: Slider with thermometer like scale [message #27720 is a reply to message #27716] Fri, 30 July 2010 14:11 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3402
Registered: August 2008
Senior Veteran
mrjt wrote on Fri, 30 July 2010 12:47

For the curved one you would want to modify the ctrl from this thread.

You may only have to change the images.

Hello mrjt

I think the curved one is a meter like the one in Controls4U.


Best regards
Iñaki
Re: Slider with thermometer like scale [message #27724 is a reply to message #27720] Fri, 30 July 2010 15:11 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3402
Registered: August 2008
Senior Veteran
Hello Jerson

If you want I can include very soon a knob ctrl like those in the image, and a light control.

index.php?t=getfile&id=2694&private=0
  • Attachment: dib.JPG
    (Size: 14.09KB, Downloaded 1175 times)


Best regards
Iñaki
Re: Slider with thermometer like scale [message #27725 is a reply to message #27724] Fri, 30 July 2010 15:15 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi Koldo

You know what - it will be just fantastic. The controls that excite me the most are found in National Instruments LabVIEW and these knobs look cool

Regards
Jerson
Re: Slider with thermometer like scale [message #27728 is a reply to message #27725] Fri, 30 July 2010 15:46 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3402
Registered: August 2008
Senior Veteran
jerson wrote on Fri, 30 July 2010 15:15

Hi Koldo

You know what - it will be just fantastic. The controls that excite me the most are found in National Instruments LabVIEW and these knobs look cool

Regards
Jerson

I know they are cool Smile.

Let's go. Knob and light Cool.

.usc included so they will be useful in Layout Designer.


Best regards
Iñaki
Re: Slider with thermometer like scale [message #27835 is a reply to message #27728] Fri, 06 August 2010 01:28 Go to previous messageGo to next message
avpavp is currently offline  avpavp
Messages: 19
Registered: September 2009
Promising Member
Here's my latest SliderCtrl.

I changed the way most of the labels and ticks were handled. Now things are based on Major and Minor ticks.

Major ticks have text labels. If you had a slider going from say, 0 - 200, you might set MajorTicks to 25, which would put larger ticks and text labels at 0, 25, 50, 75 ... 200.

Then you might set MinorTicks to 5, which would put minor ticks (smaller, no text) at 5, 10, 15, 20, 30, 35, ...

Also, you can set the tick sizes for Major and minor, 0 to 100 % of the size of the ctrl from the slider line to the edge.

Finally, you can set the tick location to above/below the line (left and right too).

I'd like to submit this for inclusion in the core once all the kinks are worked out. I gather I should generate the topic++ files or something? I looked around as much as I could, and couldn't really figure out how to do this. If Ultimate++ wants tpp or t++ or topic++ files I humbly suggest you make it a little better known how to create such files...

Thanks,
Anthony

  • Attachment: Slider.zip
    (Size: 4.10KB, Downloaded 411 times)
Re: Slider with thermometer like scale [message #27838 is a reply to message #27835] Fri, 06 August 2010 05:47 Go to previous messageGo to previous message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi Anthony

This looks very good. Couple of things that you might like to look into

1. There is a skew between the ticks and the thumb position. Like if the slider.Range is 100, the thumb almost always is left aligned to the tick when on the left of the median and right aligned as you go to the right of the median.

2. I could not get the slider.SetTickPosition to work. Keeps throwing up an error. Maybe I am doing something wrong due to inexperience in UPP
This is the relevant code cut from the sliderprogress package modified to use the new slider control
	App() {
		Add(slider.BottomPosZ(5, 50).HSizePos(10, 10));
		Add(progress.VSizePos(10, 50).HCenterPos(50));
		Add(text.LeftPos(5, 200).TopPos(5, 40));
		slider <<= THISBACK(Slider);
		slider.Range(100);
		slider <<= 5;
		slider.SetMajorTicks(10);
		slider.SetMinorTicks(1);
		slider.SetMinorTicksSize(40);
		slider.SetMajorTicksSize(50);
		//slider.SetTickPosition(BOTTOM);
		Slider();
		Sizeable().Zoomable();
	}


Would it be possible to autosize the Major and Minor ticks as a % of the slider size? A USC file to help set the slider in layout will be great help.

Thank you very much for your help with this.

Jerson
Previous Topic: ProgressIndicater: Get / SetData missing?
Next Topic: ProgressIndicator::Set for large value of total
Goto Forum:
  


Current Time: Sun Dec 08 03:42:22 CET 2024

Total time taken to generate the page: 0.03489 seconds