Print Page | Close Window

Negative range for the slider control

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=11891
Printed Date: 05 July 2025 at 9:11am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Negative range for the slider control
Posted By: dennisV
Subject: Negative range for the slider control
Date Posted: 19 August 2008 at 6:17pm
Hello all,

I can't seem to be able to set a negative range on the property grid slider control.

For example, if I want the slider to be from -100 to +100, how can I do that?

In the PropertyGrid sample, I've tried doing this (for the "Spin and Slider" item), of course checking that underlying slider window actually exists first:

->GetSliderCtrl()->SetRange(-100, 100);

but that doesn't work. It produces a slider that has a correct range, but when you try to slide it (or use the up/down buttons) to go below 0, it just stops (halfway in this example, so the range is actually set correctly, I presume).

Can you please advise on how to solve this?

Thanks,

   Dennis


-------------
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)



Replies:
Posted By: Oleg
Date Posted: 20 August 2008 at 2:10am
Hi,
 
Use SetMin method of CXTPPropertyGridInplaceSlider.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: dennisV
Date Posted: 20 August 2008 at 4:51am
I tried SetMin() first and it doesn't work either :(

-------------
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)


Posted By: Oleg
Date Posted: 20 August 2008 at 6:25am
Hi,
 
Its because you have also Spin with wrong range:
 
Here modification in sample to make it work:
 
  pItem = pButtons->AddChildItem(new CXTPPropertyGridItemNumber(_T("Spin And Slider"), 60));
  CXTPPropertyGridInplaceSlider* pSlider = pItem->AddSliderControl();
  pSlider->SetMin(-100);
  //pItem->AddSpinButton();


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: dennisV
Date Posted: 20 August 2008 at 8:12am
Originally posted by oleg oleg wrote:

Hi,
 
Its because you have also Spin with wrong range:
 
Here modification in sample to make it work:
 
  pItem = pButtons->AddChildItem(new CXTPPropertyGridItemNumber(_T("Spin And Slider"), 60));
  CXTPPropertyGridInplaceSlider* pSlider = pItem->AddSliderControl();
  pSlider->SetMin(-100);
  //pItem->AddSpinButton();

Hi,

Yes, it works without a spin button, but how can I make it work with a spin button as well?

Thanks!

   Dennis



-------------
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)


Posted By: Oleg
Date Posted: 20 August 2008 at 8:33am
Obviously in that case you need set minimum range for spin too:
 
  CXTPPropertyGridInplaceSpinButton* pSpin = pItem->AddSpinButton();
  pSpin->SetMin(-100);


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: dennisV
Date Posted: 20 August 2008 at 8:40am
Originally posted by oleg oleg wrote:

Obviously in that case you need set minimum range for spin too:
 
  CXTPPropertyGridInplaceSpinButton* pSpin = pItem->AddSpinButton();
  pSpin->SetMin(-100);

Yes, that's my stupidity - I had exactly the same piece of code as you have above, but I named the button *pButton, which already appeared before that (referencing a different class) and that didn't have a SetMin() method. Oh well... Thank you for the help!


-------------
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net