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 #29252 is a reply to message #27646] Wed, 13 October 2010 11:44 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello avpavp

Anything new? Smile



Best regards
Iñaki
Re: Slider with thermometer like scale [message #30041 is a reply to message #29252] Sat, 04 December 2010 23:32 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello avpavp

Could you post something new soon?.

Specially the ability to include a formatting function for the labels would be great.


Best regards
Iñaki
Re: Slider with thermometer like scale [message #30088 is a reply to message #30041] Wed, 08 December 2010 01:10 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
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:

index.php?t=getfile&id=2971&private=0
  • Attachment: dib.JPG
    (Size: 36.94KB, Downloaded 909 times)


Best regards
Iñaki
Re: Slider with thermometer like scale [message #30089 is a reply to message #30088] Wed, 08 December 2010 09:34 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

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:

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

Re: Slider with thermometer like scale [message #32050 is a reply to message #27646] Tue, 19 April 2011 12:21 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
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 !
Re: Slider with thermometer like scale [message #32052 is a reply to message #32050] Tue, 19 April 2011 14:06 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

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.
  • Attachment: JFSlider.usc
    (Size: 3.41KB, Downloaded 358 times)
Re: Slider with thermometer like scale [message #32055 is a reply to message #27646] Tue, 19 April 2011 15:49 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
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 Smile

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 Smile
Re: Slider with thermometer like scale [message #32091 is a reply to message #27646] Thu, 21 April 2011 15:19 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
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...) Smile

What is nidaqmx.lib mentionned in .upp file ? This was making a link error, so I suppressed it. Seems to not be missing...

[Updated on: Thu, 21 April 2011 15:20]

Report message to a moderator

Re: Slider with thermometer like scale [message #32097 is a reply to message #32091] Fri, 22 April 2011 08:30 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

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

[Updated on: Fri, 22 April 2011 08:31]

Report message to a moderator

Re: Slider with thermometer like scale [message #32098 is a reply to message #32097] Fri, 22 April 2011 08:57 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
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 Smile

[Updated on: Fri, 22 April 2011 08:58]

Report message to a moderator

Re: Slider with thermometer like scale [message #32103 is a reply to message #32098] Sun, 24 April 2011 16:55 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello

What is the opinion of main maintainer about this? Smile


Best regards
Iñaki
Re: Slider with thermometer like scale [message #32177 is a reply to message #27646] Fri, 29 April 2011 10:37 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
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 Wink

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.
Re: Slider with thermometer like scale [message #32197 is a reply to message #32177] Sat, 30 April 2011 09:41 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
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 Wink

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 Smile ).


Best regards
Iñaki
Re: Slider with thermometer like scale [message #32355 is a reply to message #27646] Thu, 12 May 2011 18:50 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
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 Wink

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.

Re: Slider with thermometer like scale [message #32361 is a reply to message #32355] Fri, 13 May 2011 04:40 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

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
Re: Slider with thermometer like scale [message #32364 is a reply to message #27646] Fri, 13 May 2011 10:22 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
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();		
	}
...
}
...


Shocked ... I don't understand...
Re: Slider with thermometer like scale [message #32375 is a reply to message #32364] Fri, 13 May 2011 22:32 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
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 Confused ):

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 ?


Best regards
Iñaki

[Updated on: Fri, 13 May 2011 22:34]

Report message to a moderator

Re: Slider with thermometer like scale [message #32376 is a reply to message #32375] Fri, 13 May 2011 23:10 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
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);



Best regards
Iñaki
Re: Slider with thermometer like scale [message #32380 is a reply to message #32375] Sat, 14 May 2011 15:39 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
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 Confused

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)

Sad What could be the reason ? I cannot experiment this, as I'm working under Linux...
Re: Slider with thermometer like scale [message #32383 is a reply to message #32380] Sat, 14 May 2011 21:32 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello

About the return *this;, it has been reported that gcc options in TheIDE could check more warnings like this Sad. 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 Smile ?

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.


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


Current Time: Fri Mar 29 00:47:02 CET 2024

Total time taken to generate the page: 0.03705 seconds