Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Negative range for the slider control
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Negative range for the slider control

 Post Reply Post Reply
Author
Message
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post Topic: Negative range for the slider control
    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)
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 20 August 2008 at 2:10am
Hi,
 
Use SetMin method of CXTPPropertyGridInplaceSlider.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.029 seconds.