Help with CSliderCtrl 
Author Message
 Help with CSliderCtrl

Hi,

I'm new to VC++ and MFC, but am slowly getting up to speed. Please forgive
me for the newbie question.

I have an MFC Doc/View app and I want to add a slider control to the View
class. The code I am using is modified from the sample Common Controls app:

 int rc = mSlider.Create(WS_VISIBLE | WS_CHILD | TBS_HORZ | TBS_BOTH |
TBS_AUTOTICKS | WS_TABSTOP,
  rect,
  this,
  IDC_SLIDER)

 if (rc == 0)
 {
  m_Slider.SetTicFreq(1);
  m_Slider.SetLineSize(1);
  m_Slider.SetPageSize(5);
  m_Slider.SetRange(10, 20, TRUE);
 }

I know that IDC_SLIDER is a dialog resource. However, I'm not using a dialog
for this app. Is there a way to get the slider to display on the View
itself? Any and all help is appreciated.

Thanks,

Steve



Fri, 27 May 2005 04:34:34 GMT  
 Help with CSliderCtrl
Upon further experimentation, I replaced IDC_SLIDER with 0, and it works.
But I feel that this is improper. Could anyone verify this?

Thanks,

Steve


Quote:
> Hi,

> I'm new to VC++ and MFC, but am slowly getting up to speed. Please forgive
> me for the newbie question.

> I have an MFC Doc/View app and I want to add a slider control to the View
> class. The code I am using is modified from the sample Common Controls
app:

>  int rc = mSlider.Create(WS_VISIBLE | WS_CHILD | TBS_HORZ | TBS_BOTH |
> TBS_AUTOTICKS | WS_TABSTOP,
>   rect,
>   this,
>   IDC_SLIDER)

>  if (rc == 0)
>  {
>   m_Slider.SetTicFreq(1);
>   m_Slider.SetLineSize(1);
>   m_Slider.SetPageSize(5);
>   m_Slider.SetRange(10, 20, TRUE);
>  }

> I know that IDC_SLIDER is a dialog resource. However, I'm not using a
dialog
> for this app. Is there a way to get the slider to display on the View
> itself? Any and all help is appreciated.

> Thanks,

> Steve



Fri, 27 May 2005 05:13:17 GMT  
 Help with CSliderCtrl


Quote:
> Upon further experimentation, I replaced IDC_SLIDER with 0, and it works.
> But I feel that this is improper. Could anyone verify this?

IDC_SLIDER is simply a definition - for dialogue resources it is defined as
part of creating the control on the dialogue, but there's nothing stopping
you from providing your own definition for this ID in a header file (the
view's would be most appropriate) yourself, e.g.,

#define IDC_SLIDER               101

--
--
Jason Teagle

-----------------------------------------------------------
A list of programming resources I use:
ML: www.windev.org, www.codecipher.com, www.beginthread.com
MB: www.codeguru.com, www.codeproject.com
NG: comp.lang.java.*
OI: www.php.net
-----------------------------------------------------------



Fri, 27 May 2005 17:21:18 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help with using a Trackbar-CSliderCtrl in a dialog

2. CSliderCtrl and its Buddy - help!

3. HELP CSliderCtrl not visible after Create call...

4. CSliderCtrl HELP NEEDED

5. Caption bar color & CSliderCtrl Color

6. CSliderCtrl problem

7. Qn on Slider Control ( CSliderCtrl ) in VC++ dialog box

8. Why cant I Catch Messages from CSliderCtrl?

9. Custom CSliderCtrl not responding to OnHScroll

10. need example of implementing CTabCtrl and CSliderCtrl

11. CSliderCtrl & OnHScroll

12. CSliderCtrl problems

 

 
Powered by phpBB® Forum Software