U++ Forum - RDF feed
type: channel
description: Main place for discussions about U++ cross platform development framework.
items: Slider with thermometer like scale
items: Re: Slider with thermometer like scale

Slider with thermometer like scale
type: item
description: 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.
creator: koldo
date: 2010-07-27T15:42:02-00:00

Re: Slider with thermometer like scale
type: item
description: 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
creator: avpavp
date: 2010-07-27T17:06:13-00:00

Re: Slider with thermometer like scale
type: item
description: 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
creator: jerson
date: 2010-07-27T17:33:04-00:00

Re: Slider with thermometer like scale
type: item
description: 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...
creator: avpavp
date: 2010-07-28T15:05:03-00:00

Re: Slider with thermometer like scale
type: item
description: 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
creator: jerson
date: 2010-07-28T15:21:10-00:00

Re: Slider with thermometer like scale
type: item
description: Hello avpavp Thank you for your improvements . 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
creator: koldo
date: 2010-07-28T15:30:03-00:00

Re: Slider with thermometer like scale
type: item
description: 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
creator: avpavp
date: 2010-07-29T02:27:32-00:00

Re: Slider with thermometer like scale
type: item
description: 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 : - 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? - 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 .
creator: koldo
date: 2010-07-29T06:46:22-00:00

Re: Slider with thermometer like scale
type: item
description: 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
creator: andrei_natanael
date: 2010-07-29T11:34:53-00:00

Re: Slider with thermometer like scale
type: item
description: 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
creator: avpavp
date: 2010-07-29T11:41:33-00:00

Re: Slider with thermometer like scale
type: item
description: Ok!
creator: koldo
date: 2010-07-29T13:36:05-00:00

Re: Slider with thermometer like scale
type: item
description: 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.
creator: mrjt
date: 2010-07-29T15:32:05-00:00

Re: Slider with thermometer like scale
type: item
description: Hi Anthony Since you're looking at the code anyway, could you look at the possibility of making the slider look something like these?
creator: jerson
date: 2010-07-30T01:05:12-00:00

Re: Slider with thermometer like scale
type: item
description: For the curved one you would want to modify the ctrl from this thread. You may only have to change the images.
creator: mrjt
date: 2010-07-30T10:47:54-00:00

Re: Slider with thermometer like scale
type: item
description: 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.
creator: koldo
date: 2010-07-30T12:11:36-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jerson If you want I can include very soon a knob ctrl like those in the image, and a light control.
creator: koldo
date: 2010-07-30T13:11:32-00:00

Re: Slider with thermometer like scale
type: item
description: 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
creator: jerson
date: 2010-07-30T13:15:14-00:00

Re: Slider with thermometer like scale
type: item
description: 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 . Let's go. Knob and light . .usc included so they will be useful in Layout Designer.
creator: koldo
date: 2010-07-30T13:46:05-00:00

Re: Slider with thermometer like scale
type: item
description: 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
creator: avpavp
date: 2010-08-05T23:28:14-00:00

Re: Slider with thermometer like scale
type: item
description: 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
creator: jerson
date: 2010-08-06T03:47:38-00:00

Re: Slider with thermometer like scale
type: item
description: 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 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
creator: avpavp
date: 2010-08-06T16:40:49-00:00

Re: Slider with thermometer like scale
type: item
description: 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 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
creator: jerson
date: 2010-08-06T18:07:04-00:00

Re: Slider with thermometer like scale
type: item
description: 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.
creator: jerson
date: 2010-08-11T17:46:40-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jerson I hate using other people posts . 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.
creator: koldo
date: 2010-08-11T20:31:46-00:00

Re: Slider with thermometer like scale
type: item
description: 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
creator: jerson
date: 2010-08-23T01:21:56-00:00

Re: Slider with thermometer like scale
type: item
description: This is how the fillslider and slide switch looks
creator: jerson
date: 2010-08-23T01:23:19-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jerson Please include a demo to test the controls and the .upp file with all of them. I will try it today.
creator: koldo
date: 2010-08-23T06:56:51-00:00

Re: Slider with thermometer like scale
type: item
description: 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
creator: jerson
date: 2010-08-23T08:52:41-00:00

Re: Slider with thermometer like scale
type: item
description: 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.
creator: koldo
date: 2010-08-23T11:07:43-00:00

Re: Slider with thermometer like scale
type: item
description: Hi Koldo Thanks for your immense help. Because of your active help I am almost swimming in UPP ) 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
creator: jerson
date: 2010-08-23T13:06:09-00:00

Re: Slider with thermometer like scale
type: item
description: 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 . Follow doing it this way and when your controls are stable and enough tested we can upload it for all to enjoy them.
creator: koldo
date: 2010-08-23T13:56:08-00:00

Re: Slider with thermometer like scale
type: item
description: 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 .
creator: koldo
date: 2010-09-26T20:09:57-00:00

Re: Slider with thermometer like scale
type: item
description: 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)
creator: avpavp
date: 2010-09-28T19:14:38-00:00

Re: Slider with thermometer like scale
type: item
description: 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
creator: jerson
date: 2010-09-29T04:40:44-00:00

Re: Slider with thermometer like scale
type: item
description: 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? 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?.
creator: koldo
date: 2010-09-29T06:49:39-00:00

Re: Slider with thermometer like scale
type: item
description: 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?
creator: avpavp
date: 2010-09-29T11:36:46-00:00

Re: Slider with thermometer like scale
type: item
description: 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):
creator: koldo
date: 2010-09-29T12:13:09-00:00

Re: Slider with thermometer like scale
type: item
description: Anyway sorry, it looks very well! Last two petitions : - 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: - 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 )
creator: koldo
date: 2010-09-29T12:41:15-00:00

Re: Slider with thermometer like scale
type: item
description: - 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
creator: avpavp
date: 2010-09-29T22:00:18-00:00

Re: Slider with thermometer like scale
type: item
description: Quote: - Click outside the thumb, there is a fn Jump(), call Jump( true ) to get the behavior you are requesting. Great! 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 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.
creator: koldo
date: 2010-09-30T06:36:18-00:00

Re: Slider with thermometer like scale
type: item
description: Hello avpavp Anything new?
creator: koldo
date: 2010-10-13T09:44:53-00:00

Re: Slider with thermometer like scale
type: item
description: Hello avpavp Could you post something new soon?. Specially the ability to include a formatting function for the labels would be great.
creator: koldo
date: 2010-12-04T22:32:29-00:00

Re: Slider with thermometer like scale
type: item
description: Hello avpavp and Mirek I have uploaded to Bazaar/SliderCtrlX the SliderCtrl improved version included by avpavp plus a label formatting function: Callback2<String&, int> LabelFormat; For example, if SliderCtrl contains time in seconds, but you want to visualize hour:min:sec format, you would do this: In the constructor: slider.LabelFormat = THISBACK(LabelFormatting); And after that: void LabelFormatting(String &str, int val) { str = SecondsToString(val, false); } And you would get something like this:
creator: koldo
date: 2010-12-08T00:10:26-00:00

Re: Slider with thermometer like scale
type: item
description: Very pretty! koldo wrote on Wed, 08 December 2010 02:10 Hello avpavp and Mirek I have uploaded to Bazaar/SliderCtrlX the SliderCtrl improved version included by avpavp plus a label formatting function: Callback2<String&, int> LabelFormat; For example, if SliderCtrl contains time in seconds, but you want to visualize hour:min:sec format, you would do this: In the constructor: slider.LabelFormat = THISBACK(LabelFormatting); And after that: void LabelFormatting(String &str, int val) { str = SecondsToString(val, false); } And you would get something like this:
creator: tojocky
date: 2010-12-08T08:34:18-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, In 3356 build, there is still no .usc for this. Is somebody working on it ? I should like to use this slider with the layout designer and plan to try making the .usc file, but I'm still newbie with UPP, so any help (partial code already done, documentation about .usc, advices etc.) would be appreciated !
creator: jibe
date: 2011-04-19T10:21:30-00:00

Re: Slider with thermometer like scale
type: item
description: I had uploaded my version of the slider control in post 28948. Here I attach what I use with my version of the slider called jfslider. It is not full fledged yet as I stopped work on it a long time ago.
creator: jerson
date: 2011-04-19T12:06:18-00:00

Re: Slider with thermometer like scale
type: item
description: Thank you a lot, jerson ! I like also your slider too, and didn't plan to use it mainly because of the lack of .usc file ! This reason is no more available now However, I should prefer to use an "official" control from bazaar. I'll try to make a .usc file for Koldo's slider starting from yours... I opened a new topic on how to make .usc files. I would appreciate if somebody can help me getting started with that
creator: jibe
date: 2011-04-19T13:49:42-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, Obviously, you have developped your sliders under Windows, jerson ! There are several problems with uppercase / lowercase under Linux ! Here is a version working under Linux, hoping it still works under Windows (should, but not tested...) What is nidaqmx.lib mentionned in .upp file ? This was making a link error, so I suppressed it. Seems to not be missing...
creator: jibe
date: 2011-04-21T13:19:46-00:00

Re: Slider with thermometer like scale
type: item
description: I checked it on WinXP and it still works. NiDaqMx is the driver for National Instruments Data Acquisition MAX package. It was being used to test modbus functions and stayed in the package. Definitely not needed for these functions. Regards
creator: jerson
date: 2011-04-22T06:30:57-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, jerson wrote on Fri, 22 April 2011 08:30 I checked it on WinXP and it still works. Nice ! I was quite sure, as I changed only upper/lowercases, but we can be sure only when tested ! I'll go on studying all that. I already compared Koldo's and avpavp's one : they are the same except Koldo's LabelFormatting ability lastly added. I'll now compare with your version and try to make something with .usc file... Thanks for your help
creator: jibe
date: 2011-04-22T06:57:07-00:00

Re: Slider with thermometer like scale
type: item
description: Hello What is the opinion of main maintainer about this?
creator: koldo
date: 2011-04-24T14:55:22-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, If you talk about avpavp, I'm afraid that he doesn't come here anymore... His last visit was on November 10, 2010, almost 6 month. I think that : - As avpavp doesn't reply anymore, - As he put here his code, - As you put it in bazaar, - As you made Controls4U, where this enhanced slider could take place, you should try a last time to contact avpavp by email and consider yourself as main maintener of the package For me, I'm busy on other things for now, but I'll try to mix the bazaar version and jerson's one ASAP (I hope to have time in 1 or 2 weeks). I think that there is some good ideas in jerson's version that could easily be included in SliderCtrlX.
creator: jibe
date: 2011-04-29T08:37:27-00:00

Re: Slider with thermometer like scale
type: item
description: jibe wrote on Fri, 29 April 2011 10:37 Hi, If you talk about avpavp, I'm afraid that he doesn't come here anymore... His last visit was on November 10, 2010, almost 6 month. I think that : - As avpavp doesn't reply anymore, - As he put here his code, - As you put it in bazaar, - As you made Controls4U, where this enhanced slider could take place, you should try a last time to contact avpavp by email and consider yourself as main maintener of the package For me, I'm busy on other things for now, but I'll try to mix the bazaar version and jerson's one ASAP (I hope to have time in 1 or 2 weeks). I think that there is some good ideas in jerson's version that could easily be included in SliderCtrlX. Perfect. Prepare the new version and while it waits to be included in main U++, it can be in Controls4U (with the necessary references to the authors ).
creator: koldo
date: 2011-04-30T07:41:45-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, Here is a new version of SliderCtrlX, with many enhancements, most of them inspired by jeson. See the source for details. Any comments and ideas are welcome There is still things that I should like to adjust better, mainly alignments and positions, and also the .usc file to have a better look of the control... I'll try to see that when I have some free time. There is a bug that I cannot solve : the FillColor is not working with the layout designer.
creator: jibe
date: 2011-05-12T16:50:29-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jibe Nice work. The program crashes if I compile it with 'optimal' settings. It only works in 'debug' mode. I have not been able to identify the cause yet. SSE2 extensions on/off makes no difference to the crashing. I'll let you know if I find anything. Regards
creator: jerson
date: 2011-05-13T02:40:51-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, Yes, it's weird... This works well : JBControlsTest.h : #ifndef _JBControlsTest_JBControlsTest_h #define _JBControlsTest_JBControlsTest_h #include <CtrlLib/CtrlLib.h> #include <Controls4U/Controls4U.h> #include <JBControls/SliderCtrlX.h> using namespace Upp; class JBControlsTest : public TopWindow { public: typedef JBControlsTest CLASSNAME; JBControlsTest(); SliderCtrlX slider; }; #endif JBControlsTest.cpp : #include "JBControlsTest.h" JBControlsTest::JBControlsTest() { Add(slider.FillColor(Color(255, 85, 0)).SetThickness(3).SetThumbType(4).LeftPosZ(63, 330).TopPosZ(220, 52)); slider.Jump(true); } GUI_APP_MAIN { JBControlsTest().Run(); } Just move "Jump", and you get an "Invalid memory access" at run time... #include "JBControlsTest.h" JBControlsTest::JBControlsTest() { Add(slider.FillColor(Color(255, 85, 0)).SetThickness(3).SetThumbType(4).Jump(true).LeftPosZ(63, 330).TopPosZ(220, 52)); } GUI_APP_MAIN { JBControlsTest().Run(); } Part of SliderCtrlX.h : ... private: ... bool m_bJump; // Jumps directly to mouse pos if click on the scale ... public: ... SliderCtrlX& Jump(bool v = false) { m_bJump = v; } ... Part of SliderCtrlX.cpp : ... SliderCtrlX::SliderCtrlX() : m_nMin(0) , m_nMax(100) , m_bInverted(false) , m_nStep(1) , m_bRound_step(false) , m_bJump(false) , m_bUseCustomThumbs( 0 ) , m_nMajorTicks( 10 ) , m_nMinorTicks( 2 ) , m_nMajorTickSize( 30 ) , m_nMinorTickSize( 20 ) , m_nTickPosition( TOP ) , m_nThickness( 2 ) , m_nSliderType( 0 ) , m_nThumbNumber( 1 ) { ... } ... void SliderCtrlX::LeftDown(Point pos, dword keyflags) { ... else if( m_bJump ) { m_vValues[0] = ClientToSlider(p); WhenSlideFinish(); UpdateActionRefresh(); } ... } ... ... I don't understand...
creator: jibe
date: 2011-05-13T08:22:26-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jibe and Jerson First jibe version works well in debug and optimal just doing these changes: In SliderCtrlX.h SliderCtrlX& Jump(bool v = false) { m_bJump = v; return *this; } // Added return *this; In SliderCtrlX.cpp, void SliderCtrlX::Paint(Draw& w) method (this line was hard to understand for me ): w.DrawImage(max( SliderToClient(m_vValues[i]) - ( ( m_bUseCustomThumbs ? m_vThumbImgs[i].GetSize().cx : m_ThumbImg.GetSize().cx ) >> 1 ), 0), m_nThickness + ((size.cy - ( m_bUseCustomThumbs ? m_vThumbImgs[i].GetSize().cy : (m_ThumbImg.GetSize().cy ))) >> 1), // Added parenthesis HasCapture() || HasFocus() ? (m_bUseCustomThumbs ? m_vThumbImgsFocus[i] : m_ThumbImg) : (m_bUseCustomThumbs ? m_vThumbImgs[i] : m_ThumbImg)); PD: What is the problem with FillColor ?
creator: koldo
date: 2011-05-13T20:32:19-00:00

Re: Slider with thermometer like scale
type: item
description: Oh, there is something else... It works with MSC debug and optimal and with MinGW debug, but with MinGW optimal it hangs in SliderCtrlX& SliderCtrlX::SetThumbType(int n) here: m_ThumbImg = SliderThumbsImg::Get(m_nThumbType);
creator: koldo
date: 2011-05-13T21:10:21-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, koldo, koldo wrote on Fri, 13 May 2011 22:32 First jibe version works well in debug and optimal just doing these changes: In SliderCtrlX.h SliderCtrlX& Jump(bool v = false) { m_bJump = v; return *this; } // Added return *this; So, it was that simple ! I already had a missing "return *this", but it was making an error at run time, so I didn't think about that... Why the compiler (I'm using GCC, under Linux) does not complains, at least with a warning ? Normally, it should detect that a return statement is needed... koldo wrote on Fri, 13 May 2011 22:32 this line was hard to understand for me Yes, it's true ! I kept it from the original version of SliderCtrlX that you put in bazaar, but hesitate to use some intermediate variables... Probably, it's to do to have a more readable code! What do you think ? koldo wrote on Fri, 13 May 2011 22:32 What is the problem with FillColor ? Just try to change it from the graphic layout designer : you'll get an "invalid memory access" error. koldo wrote on Fri, 13 May 2011 22:32 it hangs in SliderCtrlX& SliderCtrlX::SetThumbType(int n) What could be the reason ? I cannot experiment this, as I'm working under Linux...
creator: jibe
date: 2011-05-14T13:39:50-00:00

Re: Slider with thermometer like scale
type: item
description: Hello About the return *this;, it has been reported that gcc options in TheIDE could check more warnings like this . It is very simple to add it to TheIDE. About that line, it came from original code from avpavp. Avpavp, if you are there, do you agree to split this line ? About the FillColor, I change it in layout designer without problems... About the hanging in MinGW, do you mean that in Linux it works now well? It is very strange.
creator: koldo
date: 2011-05-14T19:32:01-00:00

Re: Slider with thermometer like scale
type: item
description: Hello, koldo, koldo wrote on Sat, 14 May 2011 21:32 Hello About the return *this;, it has been reported that gcc options in TheIDE could check more warnings like this . It is very simple to add it to TheIDE And it has never been done ? This kind of warning is very important... I lost a lot of time with that, as I was not looking there, being sure that I should have get a warning... koldo wrote on Sat, 14 May 2011 21:32 About the FillColor, I change it in layout designer without problems... That's weird... With 3412 under Ubuntu 10.04, I can't get it working... Well, I'll verify the return statements koldo wrote on Sat, 14 May 2011 21:32 About the hanging in MinGW, do you mean that in Linux it works now well? It is very strange. Mmm... What I mean is that I didn't try with Mingw, as I work under Linux and cannot test windows exes. Under Linux with Gcc, it's working well. If I can, I'll try on a windows computer, or with wine...
creator: jibe
date: 2011-05-16T06:34:01-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, Here is a new version of SliderCtrlX, with : - Koldo's and other minor corrections, - Focused Thumb images - split line drawing the thumb (as avpavp didn't say anything... who is silent consents ) I created also a new control, named StarIndicator, to have stars for votes. See code (and code header ) for details. BTW : I wanted to have a hand cursor when it goes on the thumb. How can I do that ?
creator: jibe
date: 2011-05-26T17:06:01-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jibe It works well in XP. Just do this change or similar to avoid MSVC complains: void StarIndicator::Layout() { ... int y = int(ceil(double(x/5)));
creator: koldo
date: 2011-05-26T20:41:16-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, koldo wrote on Thu, 26 May 2011 22:41 Just do this change or similar to avoid MSVC complains Done. Koldo, if you want to put it in Controls4U, no problem for me. More : I think that it could be good to have all enhanced controls in one library. About other authors : - I used indirectly avpavp's code, as I took your version of SliderCtrlX - I took many ideas from jeson's version, but no code, - No other authors for StarIndicator, but I picked some parts of code from ProgressIndicator in CtrlLib. jibe wrote on Thu, 26 May 2011 19:06 BTW : I wanted to have a hand cursor when it goes on the thumb. How can I do that ? If somebody has an idea... I can't find a simple way to do that...
creator: jibe
date: 2011-05-27T13:26:48-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jibe A detail to check:
creator: koldo
date: 2011-05-27T14:23:10-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, Yes, I know that... I'll add this in the 2do list in the header : /*********************************************************************************************** * SliderCtrlX * * Enhanced Slider Control / Slider indicator * * Autors : avpavp, jerson, jibe, koldo * Last modified : May 28, 2011 * * 2do : adjust DrawTicks() in every position * Thumbs are not always at the right position at Min and Max values (we should have a half * thumb). * adjust default values when changing CONTROL/INDICATOR * Known bugs : Invalid memory access when choosing FillColor with .lay designer (seems to be * only with ubuntu. See http://www.ultimatepp.org/forum/index.php?t=msg&th=6022&start=0& **********************************************************************************************/ There is also a bad position of the scale (ticks), it was already in the 2do list. I never had time to see that : seems to be not so easy to find how to adjust all that... I'll try to take time for that, but if somebody has some idea...
creator: jibe
date: 2011-05-28T09:42:16-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, Here is a new version correcting the thumb and ticks positions.
creator: jibe
date: 2011-06-06T16:08:34-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jibe Sorry for being too picky, but see the thumb at the begin and the end: It could be great if the control would check the thumb size to make it always visible
creator: koldo
date: 2011-06-07T14:47:48-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, Better this way...
creator: jibe
date: 2011-06-09T09:39:13-00:00

Re: Slider with thermometer like scale
type: item
description: Almost perfect The thumb in the beginning touches the end of the control, but at the end there is a little gap between it and the end of the control. Anyway, if you want it can be included in Controls4U, changing a little bit the authors list of course .
creator: koldo
date: 2011-06-09T10:44:25-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, koldo wrote on Thu, 09 June 2011 12:44 The thumb in the beginning touches the end of the control, but at the end there is a little gap between it and the end of the control. Yes, I don't understand why... I think that I could make it more symetric, but not a clean way... So, I left it like this, waiting for a good solution... koldo wrote on Thu, 09 June 2011 12:44 changing a little bit the authors list of course Did I miss somebody ? If so, I'm very sorry... BTW : I'm looking for somebody better than me in graphics designing to make better thumbs for SliderCtrlX and better stars for StarIndicator. Any help or suggestion will be appreciated
creator: jibe
date: 2011-06-10T06:17:17-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jibe See this: It happens the same to the horizontal ones. About this: Quote: changing a little bit the authors list of course I meant changing Controls4U authors list .
creator: koldo
date: 2011-06-10T08:11:36-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, koldo, koldo wrote on Fri, 10 June 2011 10:11 See this: It happens the same to the horizontal ones. Excuse me, I'm not sure to understand what you mean... Is it about this ? koldo wrote on Thu, 09 June 2011 12:44 The thumb in the beginning touches the end of the control, but at the end there is a little gap between it and the end of the control. I know that there is this little gap, but don't know why and don't know how to avoid it in a clean way... I think that I could do so that there is a symetric gap, but not a clean way : this is the reason why I didn't do anything about it... If you were showing me another problem, please explain as I don't see... ----------- Here is a new version, with enhancements on StarIndicator : - More readable text - Possibility to show value/votes permanently - Possibility to show or not the total (ie : 3.6/5 or only 3.6) - Possibility to show the percent or the value/5 (ie : 2.5 or 50%)
creator: jibe
date: 2011-06-10T13:27:43-00:00

Re: Slider with thermometer like scale
type: item
description: Hello all Now SliderCtrlX Bazaar package has been removed as now is included in Controls_4U. In addition JBControls have been included in Controls4U.
creator: koldo
date: 2011-08-20T23:44:54-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, Sorry to be so late to reply... busy on other things... Thanks to have put my controls in Controls4u ... but you didn't take the last version of StarIndicator ! Pls, could you take the last one I posted, just before your post ? It has some interesting enhancements (see my post upper) Could somebody advice me about how I could obtain more beautiful stars ? Depending on the dimensions, they are very ugly
creator: jibe
date: 2011-11-28T15:35:05-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jibe Welcome home . Is the version you say in "JBControls110613.zip"? About the stars, the best way to paint something resizable in U++ is using Painter.
creator: koldo
date: 2011-11-28T15:56:03-00:00

Re: Slider with thermometer like scale
type: item
description: koldo wrote on Mon, 28 November 2011 16:56 Is the version you say in "JBControls110613.zip"? Yes, but I changed a little thing to a better display of the text, and made my stars bigger. Takes some more space, but it's a lot better. => here is a new version of StarIndicator. koldo wrote on Mon, 28 November 2011 16:56 About the stars, the best way to paint something resizable in U++ is using Painter. Uh ? Of which Painter are you talking about (and which OS ) ? Or do you mean your PainterSvg package in the bazaar ? Don't know how to use some svg or vectorial drawing in a layer ? With your PainterSvg ? I'll see that...
creator: jibe
date: 2011-11-28T17:17:39-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jibe Painter is the way in U++ to do antialiasing graphics. It is compatible with Draw but it adds much more features. There are many samples in PainterExamples package. Anyway I can try to help you to translate the stars into Painter.
creator: koldo
date: 2011-11-28T19:44:44-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jibe I have tried new StarIndicator version and it works well for me. It is rather easy to translate the Paint function to Painter. If you want I can do a simple version for you to extend it when you learn more. One comment about comments . For example StarIndicator& StarIndicator::SetVotes(int n) /*********************************************************************************************** * Sets the number of votes and the associated color * virtual - public **********************************************************************************************/ { m_nVotes=n; if (n<0) SetColor(LtCyan); else if (n < m_nVotesLow) SetColor(Color(255,128,128)); else if (n < m_nVotesHigh) SetColor(Yellow); else SetColor(LtGreen); Refresh(); return *this; } If I were you I would move all the comments like this to a .tpp help file. This way they will be accessible to help system and they will appear in web .
creator: koldo
date: 2011-11-29T08:07:42-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, koldo, Don't know what to do about that... I will first have to know what is painter exactly and how to use it (Some "getting starting doc would be usefull ! Is there some doc that you could advice to me ?). For now, in the last version I sent yesterday, it seems not so bad. I'm using iml images. If Painter cannot use iml images, I'm afraid that it will be a lot of changes. Are we sure that the result will be really better ? Another thing : I tried yesterday to compile your PaiterSvgDemo, but I got an error (with 4205) in line 506 of ParseSvg.cpp. Seems not serious (conversion requested), but as I have not so much time for now, I didn't check why there is this error. I'm afraid that it hides another one... EDIT : Pls see next post...
creator: jibe
date: 2011-11-29T09:58:18-00:00

Re: Slider with thermometer like scale
type: item
description: Ooops... I was called on the phone for a long time and did not see your last message koldo wrote on Tue, 29 November 2011 09:07 It is rather easy to translate the Paint function to Painter. If you want I can do a simple version for you to extend it when you learn more. If you have some time for that and think that it is a better way/better result, Ok. But as I said, I have to learn Painting from the very beginning ! I know almost nothing about image processing, and I'm even not very sure to know well what is antialiasing !!! However, if I have some time, I should be happy to learn more about all that ! koldo wrote on Tue, 29 November 2011 09:07 If I were you I would move all the comments like this to a .tpp help file. This way they will be accessible to help system and they will appear in web Smile. Yes, doc is important. Could you point me a doc or example on how to do and how to make it similar to other docs ?
creator: jibe
date: 2011-11-29T10:21:20-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jibe Here Mirek left excellent Painter examples. A good thing is that with Painter we would not use star images and we could get nice visual effects. About .tpp help file I can begin one for you for StarIndicator and you could complete it.
creator: koldo
date: 2011-11-29T16:02:21-00:00

Re: Slider with thermometer like scale
type: item
description: Hi Koldo, koldo wrote on Tue, 29 November 2011 17:02 Here Mirek left excellent Painter examples. Yes, I saw that yesterday. It gives a good idea of what can be done with Painter, but to know how it works and how to use it, the only way is to study the code. I didn't look at the code, because when you lack time it's not easy, sometimes very difficult, if you don't have any idea on what it is exactly. And if you know very few about the subject (I never coded anything about images and drawing), I'm afraid that the code will be veeeeeeeery veeeeeeeery long to study and understand ! So, I'm afraid that studying the code will not be very usefull for me, unless I spend a big amount of time, as I'm just supposing without being sure that Painter is a kind of vectorial drawing... koldo wrote on Tue, 29 November 2011 17:02 A good thing is that with Painter we would not use star images and we could get nice visual effects. Yes, no doubt about that ! I'm just afraid that it will be a big and long work when the result is already good in the last version ! More especialy when I have first to learn how to code drawings + what is painter exactly and how to use it... As I said, I should be happy to learn about all that, but I have few time and the lack of doc is discouraging. koldo wrote on Tue, 29 November 2011 17:02 About .tpp help file I can begin one for you for StarIndicator and you could complete it. Thank you for your help ! I found those explanations and I think that I can do that. Just give me some time, and I'll send you a version with .tpp help. I prefer that you spend time to convert StarIndicator to Painter or document Painter I'm just beginning to study that and did not found yet how to do to have translations. I think that I will find quickly, or if you can point some doc about that, I'll make also the translation in french. If Honza can publish his explanations in the doc, it will be better seen and could be completed (ie for translations), so that we can find easily …
creator: jibe
date: 2011-11-30T14:40:50-00:00

Re: Slider with thermometer like scale
type: item
description: I found how to have translated .tpp files. In fact, it's easy and intuitive in the special editor of TheIde. => I'll do en-us and fr-fr .tpp files for StarIndicator and SliderCtrlX ASAP.
creator: jibe
date: 2011-11-30T15:16:12-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jibe If you want I can include Painter in StarIndicator with few and commented changes from original code for you to understand better. When you learn more you can add nice effects to the stars like shades and reflections... if it makes sense .
creator: koldo
date: 2011-11-30T16:57:10-00:00

Re: Slider with thermometer like scale
type: item
description: Ok, it's kind for you If you can, this will help me to learn how works Painter ! I don't think that reflexion and shade will be good in this control, but if you think that it's better to use Painter and can do it, why not ? I began to make the .tpp file. Not so difficult ! I'm just surprised that I cannot change the text color with the editor, but I worked around this by copying/pasting from other files...
creator: jibe
date: 2011-11-30T18:23:19-00:00

Re: Slider with thermometer like scale
type: item
description: Quote: I'm just surprised that I cannot change the text color with the editor
creator: koldo
date: 2011-11-30T20:13:48-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, koldo, Yes, I saw the tools in the toolbar, but when I click, nothing happens... (4205-lucid-i386-nogtk)
creator: jibe
date: 2011-12-02T07:58:30-00:00

Re: Slider with thermometer like scale
type: item
description: Here is the .tpp file for StarIndicator. Pls let me know if it's Ok or if there are some changes to do. I'll make the SliderControlX tpp ASAP.
creator: jibe
date: 2011-12-02T13:36:30-00:00

Re: Slider with thermometer like scale
type: item
description: Be carefull if you already downloaded the StarIndicator.tpp.zip file : I changed it just now, because I discovered that I forgot to finish the links with the source
creator: jibe
date: 2011-12-02T14:57:52-00:00

Re: Slider with thermometer like scale
type: item
description: Great doc. It is added
creator: koldo
date: 2011-12-02T23:32:05-00:00

Re: Slider with thermometer like scale
type: item
description: Hi, Here is the doc for SliderCtrlX, and some minor corrections/adds to StarIndicator doc. It could be good that somebody re-reads and corrects these docs : even if I did them carefully, I could have make some mistakes !
creator: jibe
date: 2011-12-26T10:20:35-00:00

Re: Slider with thermometer like scale
type: item
description: Added !. Thank you.
creator: koldo
date: 2011-12-26T12:25:51-00:00

Re: Slider with thermometer like scale
type: item
description: Hi Koldo, I just discover that the link to SliderCtrlX is missing in your widget list, Also, the doc seems not to be on the web (while StarIndicator do is there). Could you correct this, please ?
creator: jibe
date: 2013-03-20T15:52:39-00:00

Re: Slider with thermometer like scale
type: item
description: Ok. I will check it.
creator: koldo
date: 2013-03-21T07:27:35-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jibe It is now uploaded. However remember that uppweb shows in internet all tpp pages that are linked. I mean, if anybody adds a new tpp help page and it is not linked by any other, it will not be shown in the web.
creator: koldo
date: 2013-03-22T23:27:56-00:00

Re: Slider with thermometer like scale
type: item
description: Hi Koldo, koldo wrote on Sat, 23 March 2013 00:27 It is now uploaded. Good Thank you ! koldo wrote on Sat, 23 March 2013 00:27 However remember that uppweb shows in internet all tpp pages that are linked. I mean, if anybody adds a new tpp help page and it is not linked by any other, it will not be shown in the web. Yes. So, it was the reason why SliderCtrlX was not visible in the web... and why it is now that you add the link in your widget list. By the way, you told me in your message #34574 : koldo wrote on Wed, 30 November 2011 17:57 Hello Jibe If you want I can include Painter in StarIndicator with few and commented changes from original code for you to understand better. When you learn more you can add nice effects to the stars like shades and reflections... if it makes sense . It would be good if we can use painter, as the images are not so good. Just to make them better, or why not to add some shadow or 3D effect to make it more beautiful. But there is no emergency : if and when you have some free time... I could probably do it myself, but I have no time and no other need for now to learn painter.
creator: jibe
date: 2013-03-26T09:10:04-00:00

Re: Slider with thermometer like scale
type: item
description: Hello Jibe Painter is different but rather simple. StaticRectangle and StaticEllipse (Controls4U.cpp) are very simple Painter samples. Remember that Painter primitives use double instead of int to have subpixel accuracy.
creator: koldo
date: 2013-04-02T06:26:45-00:00

Re: Slider with thermometer like scale
type: item
description: Hi Koldo, Ok, thank you. I'll look at all this when I have some time.
creator: jibe
date: 2013-04-03T06:49:15-00:00