Initializing Slider Controls in a CDialogBar
Jeff Yates X5389 -- jeffy@dv.callawaygolfco.com
Friday, December 13, 1996
Environment: VC++ 4.2b, NT 4.0
I am attempting to add several slider controls to a CDialogBar and cannot
determine where I should be initializing them (ie: m_slider.SetRange(...) and
m_slider.SetTicFreq(...)). I can't do this in CmyDialogBar::OnCreate() since
the controls haven't been created. Neither can I do it in
CMainFrame::OnCreate(). Could someone tell me where/how this should
be done?
Thank You!
Roy G. Browning -- ctf@sccsi.com
Sunday, December 15, 1996
[Mini-digest: 3 responses]
At 11:12 AM 12/13/96 -0500, you wrote:
> Environment: VC++ 4.2b, NT 4.0
>
>I am attempting to add several slider controls to a CDialogBar and cannot
>determine where I should be initializing them (ie: m_slider.SetRange(...) and
>m_slider.SetTicFreq(...)). I can't do this in CmyDialogBar::OnCreate() since
>the controls haven't been created. Neither can I do it in
>CMainFrame::OnCreate(). Could someone tell me where/how this should
>be done?
>
int
CMainFrame::OnCreate( LPCREATESTRUCT lpCreateStruct )
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
....
....
// initiate the animation toolbar
if ( !m_wndAnimationBar.InitInstance( this, TRUE ) ) {
TRACE0("Failed to create animation bar\n");
return -1; // fail to create
}
....
....
}
BOOL
CAnimationBar::InitInstance( CWnd * pParentWnd, BOOL bToolTips )
{
m_bVertical = FALSE;
// start out with no borders
DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_SIZE_DYNAMIC;
if (bToolTips)
dwStyle |= (CBRS_TOOLTIPS | CBRS_FLYBY);
if ( !Create( pParentWnd, dwStyle, ID_VIEW_ANIMATION_BAR ) )
return FALSE;
LoadToolBar( IDR_ANIMATION );
CRect rect( -SLIDER_WIDTH, -SLIDER_HEIGHT, 0, 0 );
if ( !m_cAnimationDelay.Create( WS_CHILD |
WS_BORDER |
TBS_TOP |
TBS_AUTOTICKS ,
rect,
this,
ID_ANIMATION_SLIDER_CONTROL ) ) {
return FALSE;
}
if( !SetHorizontal() )
return FALSE;
m_cAnimationDelay.SetRange( 0, 100 );
m_cAnimationDelay.SetTicFreq( 50 );
return TRUE;
}
The above works for me!
Roy Browning
////////////////////////////////////////
C o n t r o l l i n g the F u t u r e
Software Design & Development
www.CtF.net
800-CTF-0032
Roy Browning - ctf@msn.com
///////////////////////////////////////
-----From: Peter.Walker@ubs.com
You should override ON_MESSAGE(WM_INITDIALOG, HandleInitDialog),
and call the base class
CDialogBar::HandleInitDialog(..)
See bardlg.cpp line 123.
Peter Walker
Peter.Walker@ubs.com
______________________________ Forward Header __________________________________
Subject: PUBLIC: Initializing Slider Controls in a CDialogBar
Author: owner-mfc-l at zhux/DD.RFC-822=owner-mfc-l@majordomo.netcom.com
Date: 13/12/96 15:12
Environment: VC++ 4.2b, NT 4.0
I am attempting to add several slider controls to a CDialogBar and cannot
determine where I should be initializing them (ie: m_slider.SetRange(...) and
m_slider.SetTicFreq(...)). I can't do this in CmyDialogBar::OnCreate() since
the controls haven't been created. Neither can I do it in
CMainFrame::OnCreate(). Could someone tell me where/how this should
be done?
Thank You!
-----From: "Daniel Munoz"
Environment: VC++ 4.2, Win 95, NT 3.51, NT 4.00
Hi Jeff,
> I am attempting to add several slider controls to a CDialogBar and cannot
> determine where I should be initializing them (ie: m_slider.SetRange(...)
and
I do this on the CDialog::OnInitialUpdate () message, after a
CDialog::UpdateData (FALSE).
Daniel Munoz
dmunoz@socabim.fr
| Вернуться в корень Архива
|