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
Re: Slider with thermometer like scale [message #27849 is a reply to message #27838] Fri, 06 August 2010 18:40 Go to previous messageGo to next message
avpavp is currently offline  avpavp
Messages: 19
Registered: September 2009
Promising Member
I've spent quite some time looking at the alignment issue. I think there were a lot of issues with the drawing placement in the original SliderCtrl code, but no one could notice because there were no ticks or numbers Wink Anyway, I have fixed this up significantly, and cleaned up more of the SliderCtrl code in general.

You need to use:

slider.SetTickPosition( SliderCtrl::BOTTOM );

AutoSize would be nice.

Can you point me to some information on USC files? What do I need to do?

Anthony
  • Attachment: Slider.zip
    (Size: 3.70KB, Downloaded 236 times)
Re: Slider with thermometer like scale [message #27854 is a reply to message #27646] Fri, 06 August 2010 20:07 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 200
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi Anthony

Thank you for your updates. I'll check it out tomorrow, its almost midnight here and I'm too excited to bother with sleep. See my thread on the serial port.

I'm a newer newbie than you Laughing Anyway, pick any control you like and look at the usc code in its package. I think it is also documented in the Help file.

I was able to do some quick mods to make my own meter class out of the Controls4U meter, slider and textbox. What I did, was to pick the USC code of the meter and modify it in my own MyMeter.USC file.

If you have any issues, let me know, I'll try to help. This forum is really great and I've learned a lot since my first post.

Regards
Jerson
Re: Slider with thermometer like scale [message #27948 is a reply to message #27646] Wed, 11 August 2010 19:46 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 200
Registered: June 2010
Location: Bombay, India
Experienced Member

I've been silently working on adding to the work done by Anthony. I have not been able to do much, but, this is my contribution.

It is now a Slider with fill and has the vertical slider having its min on the bottom of the screen - like a vertical progress bar.

I'd like to have a class member to change the fill color eventually.
  • Attachment: Slider.zip
    (Size: 4.02KB, Downloaded 236 times)

[Updated on: Thu, 12 August 2010 07:22]

Report message to a moderator

Re: Slider with thermometer like scale [message #27951 is a reply to message #27948] Wed, 11 August 2010 22:31 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3228
Registered: August 2008
Senior Veteran
Hello Jerson

I hate using other people posts Smile.

A new post is open here http://www.ultimatepp.org/forum/index.php?t=msg&goto=279 50&#msg_27950 to talk about new Knob control.


Best regards
Iñaki
Re: Slider with thermometer like scale [message #28203 is a reply to message #27646] Mon, 23 August 2010 03:21 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 200
Registered: June 2010
Location: Bombay, India
Experienced Member

I have made a better fill slider and slide switch which I have attached here. However, I have hit on obstacles in tying the USC code to my class. I wonder if there is any more documentation on how USC handles things. For instance, I found the enum_property keyword that makes an enumeration of property values. I'd like to use that to define the behaviour of my Fillslider and slidesw

Right now, I have done something like that in the USC code, but it fails if I change from the default value of CONTROL to INDICATOR

These are the 2 new slider controls. Comments / peer review appreciated
Re: Slider with thermometer like scale [message #28204 is a reply to message #27646] Mon, 23 August 2010 03:23 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 200
Registered: June 2010
Location: Bombay, India
Experienced Member

This is how the fillslider and slide switch looksindex.php?t=getfile&id=2741&private=0

[Updated on: Mon, 23 August 2010 03:23]

Report message to a moderator

Re: Slider with thermometer like scale [message #28207 is a reply to message #28204] Mon, 23 August 2010 08:56 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3228
Registered: August 2008
Senior Veteran
Hello Jerson

Please include a demo to test the controls and the .upp file with all of them.

I will try it today.


Best regards
Iñaki
Re: Slider with thermometer like scale [message #28208 is a reply to message #27646] Mon, 23 August 2010 10:52 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 200
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi Koldo

I have done as you suggested. There are some places where I need to improve -

1 - how to set CONTROL or INDICATOR from USC code.
2 - in SlideSw, I am unable to set the value on the slidesw indicator when clicking on the slidesw control away from the thumb. If I click and move the thumb the indicator updates correctly.
3 - how to set the vector of Names from either USC or code. Right now, I am doing it right inside the control which is not desirable.

The controls in the file are JFSlider, SlideSw, JFStaticText and MyMeter. The last one of course is specific to my requirement, but, I let it remain in the group. Later I can plan to gather all the USC code into 1 file. Is there any more details on ESC script than what is in the documentation; it seems quite lacking in detail. Things like enum_property, >Ctrl, Frame frame @1; do not make sense at all and do not seem to appear in the docs.

Thanks for your help

[Updated on: Mon, 23 August 2010 11:19]

Report message to a moderator

Re: Slider with thermometer like scale [message #28211 is a reply to message #28208] Mon, 23 August 2010 13:07 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3228
Registered: August 2008
Senior Veteran
Hello Jerson

Here I enclose you the modified code. Check the differences with original. Some advices:

- I would include all slider classes in one. Both are almost the same, but some of the problems in .usc came from the names where very similar, but not right.

- You created Callback WhenSlideFinish but in main program you do <<= THISBACK(), so you assigned the callback function to WhenAction, so nothing happened when thumb was moved.
  • Attachment: JFControls.7z
    (Size: 15.23KB, Downloaded 254 times)


Best regards
Iñaki
Re: Slider with thermometer like scale [message #28213 is a reply to message #27646] Mon, 23 August 2010 15:06 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 200
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi Koldo

Thanks for your immense help. Because of your active help I am almost swimming in UPP Smile) I am now hooked to UPP.

I can now navigate the files effortlessly even though I stumble occasionally. Like I mentioned in my previous post, I plan to consolidate all the USC code for my controls into 1 grand file.

Can you enlighten me on Point 3 of my previous post. What I want to do is do a vector.clear operation and populate the vector either from the Main.cpp or from USC code (better option) so that I can visualize it correctly in the designer.

Any more rough drafts of the ESC documentation wherein more details can be obtained? I feel the ESC documentation is incomplete or maybe I am not looking correctly.

I am now so excited, I might contribute some more controls as I progress in UPP.

Best regards
Re: Slider with thermometer like scale [message #28217 is a reply to message #28213] Mon, 23 August 2010 15:56 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3228
Registered: August 2008
Senior Veteran
Hello Jerson

You are working very well.

About this:
Quote:

What I want to do is do a vector.clear operation and populate the vector either from the Main.cpp or from USC code (better option) so that I can visualize it correctly in the designer.
I do not know how to do it in .usc the easy way.

The less easy way could be to do a function like SetLabels("0;Begin;25;Medium;50;Top"). This works and you will visualize the result in layout designer.

Quote:

I feel the ESC documentation is incomplete or maybe I am not looking correctly.
You are right.

Quote:

I might contribute some more controls as I progress in UPP.
This is great from you Smile. Follow doing it this way and when your controls are stable and enough tested we can upload it for all to enjoy them.


Best regards
Iñaki
Re: Slider with thermometer like scale [message #28917 is a reply to message #28217] Sun, 26 September 2010 22:09 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3228
Registered: August 2008
Senior Veteran
Hello all

Up to now I cannot see any change implemented in SliderCtrl.

Who is maintaining it?. Would it be possible to include scale and numbers?.

I would like to use it Smile.


Best regards
Iñaki
Re: Slider with thermometer like scale [message #28943 is a reply to message #28917] Tue, 28 September 2010 21:14 Go to previous messageGo to next message
avpavp is currently offline  avpavp
Messages: 19
Registered: September 2009
Promising Member
Here is what I was working on. It does everything I needed it to do for my application. I was getting ready to submit it for inclusion in CtrlLib.

If you wanted to test it out a little first that would be great.

I don't know if this could be re-modified with the other changes by jerson, or if this could/should be included or ... Anyway, here it is, someone may find it useful...

See attached a zip, containing SliderCtrl.cpp|h and the tpp file (goes in src.tpp, in CtrlLib)
Re: Slider with thermometer like scale [message #28948 is a reply to message #27646] Wed, 29 September 2010 06:40 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 200
Registered: June 2010
Location: Bombay, India
Experienced Member

This is my contribution.

In this package you will find
- the slider control and indicator
- slide switch control and indicator
- a Text label which can have its own background color
- mymeter which is just some embellishment of meter
and JFControlsDemo to check it all together

It is a little fancier and may not be generally suited for all, but, for my instrumentation needs, it is just fine. The tpp may be out of sync as I strung it up in a hurry.

Regards
Re: Slider with thermometer like scale [message #28953 is a reply to message #28948] Wed, 29 September 2010 08:49 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3228
Registered: August 2008
Senior Veteran
Thank you all

I have tried both and they would have to be included in main SliderCtrl.

A detail. could it be possible to separate the labels from the marks?

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

Jerson, as I think your control is more different from classical Slider than avpavp version, could you propose improvements to have a joined and better SliderCtrl?.
  • Attachment: dib1.JPG
    (Size: 5.46KB, Downloaded 820 times)


Best regards
Iñaki
Re: Slider with thermometer like scale [message #28961 is a reply to message #28953] Wed, 29 September 2010 13:36 Go to previous messageGo to next message
avpavp is currently offline  avpavp
Messages: 19
Registered: September 2009
Promising Member
If you increase the vertical height of the slider, the labels will move from the ticks. Is that what you mean? Or what do you propose?
Re: Slider with thermometer like scale [message #28966 is a reply to message #28961] Wed, 29 September 2010 14:13 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3228
Registered: August 2008
Senior Veteran
Hello Avpavp

I see. Could you include this feature in any way in the layout editor (.usc)?. Also the lower side of the slider (without marks) remains empty. Perhaps it is a better behavior that the slider would fill its Rect. The only thing is that this way the slider line would not be centered. I mean (now and proposed):

index.php?t=getfile&id=2852&private=0
  • Attachment: dib1.PNG
    (Size: 2.30KB, Downloaded 749 times)


Best regards
Iñaki
Re: Slider with thermometer like scale [message #28967 is a reply to message #28966] Wed, 29 September 2010 14:41 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3228
Registered: August 2008
Senior Veteran
Anyway sorry, it looks very well! Smile

Last two petitions Smile :

- Now the labels are printed using AsString(). Could it be possible to set a user defined formatting function?

Imagine this case. The slider uses seconds and there are a major tick every minute. I would prefer to put "1" instead of "60" and so on:

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

- In addition, when it is clicked outside the thumb, it is called to Inc() or Dec(). Would it be possible instead, to move the thumb to the position that has been clicked?. This means the user wants to go to that position (imagine your are using VLC Smile)
  • Attachment: dib.png
    (Size: 1.98KB, Downloaded 711 times)


Best regards
Iñaki
Re: Slider with thermometer like scale [message #28977 is a reply to message #27646] Thu, 30 September 2010 00:00 Go to previous messageGo to next message
avpavp is currently offline  avpavp
Messages: 19
Registered: September 2009
Promising Member
- Click outside the thumb, there is a fn Jump(), call Jump( true ) to get the behaviour you are requesting.

- user defined formatting fn, this sounds like a great idea. So it would be a virtual fn I guess? Or is there a better way?

- I don't know much about .usc files, but I will try, can you point me to some information?

- Your idea to better use the space is a good one. I will look into this as well.

Anthony
Re: Slider with thermometer like scale [message #28979 is a reply to message #28977] Thu, 30 September 2010 08:36 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3228
Registered: August 2008
Senior Veteran
Quote:

- Click outside the thumb, there is a fn Jump(), call Jump( true ) to get the behavior you are requesting.

Great! Smile

Quote:

- user defined formatting fn, this sounds like a great idea. So it would be a virtual fn I guess? Or is there a better way?

I prefer a Callback, because:
- If it is used a virtual function
-- You need to create a derived new class
--- So in the layout designer you get an empty box instead of a nice widget Sad

To see an example, go to Scatter package, cbModifFormatX.

For example:

graph.LabelFormat = THISBACK(MyFormatFunction);
...
void MyClass::MyFormatFunction(String &s, int val) {
	int min  = int(val/60);
	int secs = val - 60*min;
	s = Format("%02d:%02d", min, sec);
}


Quote:

- I don't know much about .usc files, but I will try, can you point me to some information?

- Your idea to better use the space is a good one. I will look into this as well.

I would remove before the slider spacing. After that I would go to .usc, as usc will copy original C++ code as much as possible.


Best regards
Iñaki
Previous Topic: ProgressIndicater: Get / SetData missing?
Next Topic: ProgressIndicator::Set for large value of total
Goto Forum:
  


Current Time: Tue Nov 24 18:09:24 CET 2020

Total time taken to generate the page: 0.01425 seconds