Porbleme de scrollbar

chriscrepin1 Messages postés 13 Date d'inscription vendredi 23 juillet 2004 Statut Membre Dernière intervention 4 août 2004 - 28 juil. 2004 à 10:08
cs_obby Messages postés 91 Date d'inscription vendredi 10 octobre 2003 Statut Membre Dernière intervention 12 octobre 2006 - 1 août 2005 à 23:56
bonjour , je veux ajouter un srollbar a une boite de dialogue
je suis aller dans les propriete de ma boite et j'ai coché vertical scroll j'ai rajouter la fonction OnVscroll mais rien ne marche

je pensai associe le scrollbar de ma boite de dialog a une varable ScrollBar mais je peux pas car pas ID pour la scrollbar

Que faire ?

merci

4 réponses

cs_imanewin32 Messages postés 70 Date d'inscription mardi 30 mars 2004 Statut Membre Dernière intervention 12 août 2004
28 juil. 2004 à 12:58
je veux t'aider mais je ne conprend pas ce que tu veux exactement faire??????????????
0
chriscrepin1 Messages postés 13 Date d'inscription vendredi 23 juillet 2004 Statut Membre Dernière intervention 4 août 2004
28 juil. 2004 à 15:09
quand j'appuis sue la fleche bas ou haut du scrollbar ce fais rien

voila les declarations:
// Dialog Data
//{{AFX_DATA(CPARAMETERDlg1)
enum { IDD = IDD_PARAMATER };
CScrollBar m_parameter_scrollbar;
CButton m_parameter_bouton_cancel;
//}}AFX_DATA

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPARAMETERDlg1)
protected:
virtual void DoDataExchange(CDataExchange* pDX);
// DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:

// Generated message map functions
//{{AFX_MSG(CPARAMETERDlg1)
virtual BOOL OnInitDialog();
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

voila mon code :

void CPARAMETERDlg1::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
// Get the minimum and maximum scroll-bar positions.
// Determine the new position of scroll box.
int min_position=0,max_position;

CDialog::OnVScroll(nSBCode,nPos, pScrollBar);

max_position=206;
pScrollBar->GetScrollRange( &min_position, &max_position );
int m_position=pScrollBar->GetScrollPos();
switch (nSBCode)
{

case SB_LINEUP :
m_position=m_position-1;
pScrollBar->SetScrollPos(m_position,TRUE);
break;

case SB_LINEDOWN :
m_position=m_position+1;
pScrollBar->SetScrollPos(m_position,TRUE);
break;

case SB_THUMBTRACK :
pScrollBar->SetScrollPos(nPos,TRUE);
break;
} // Set the new position of the thumb (scroll box).

UpdateData(false);
}
0
cs_obby Messages postés 91 Date d'inscription vendredi 10 octobre 2003 Statut Membre Dernière intervention 12 octobre 2006
1 août 2005 à 23:20
slt, moi j'arrive bienà "dérouler" le scroll mais l'affichage ne suis pas!!!



cf le code de ma fonction :





void CDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)

{

CDialogBar::OnVScroll(nSBCode, nPos, pScrollBar);

int min_position=0,max_position;

max_position=206;



this->GetScrollRange (SB_VERT,&min_position, &max_position);

int m_position = this->GetScrollPos (SB_VERT);


//pScrollBar->GetScrollRange ( &min_position, &max_position
);

//int m_position=pScrollBar->GetScrollPos();





switch (nSBCode)

{



case SB_LINEUP :

m_position=m_position-1;

this->SetScrollPos(SB_VERT,m_position,TRUE);

break;



case SB_LINEDOWN :

m_position=m_position+1;

this->SetScrollPos(SB_VERT,m_position,TRUE);

break;



case SB_THUMBTRACK :

this->SetScrollPos(SB_VERT,nPos,TRUE);

break;



case SB_PAGEDOWN: //Scrolls one page down.

m_position += 5;

this->SetScrollPos(SB_VERT,m_position,TRUE);

break;

case SB_PAGEUP: //Scrolls one page up.

m_position -= 5;

this->SetScrollPos(SB_VERT,m_position,TRUE);



break;



case SB_THUMBPOSITION: //The user has dragged the scroll box (thumb)
and released the mouse button. The nPos parameter indicates the
position of the scroll box at the end of the drag operation.

break;





case SB_TOP: //Scrolls to the upper left.

break;

} // Set the new position of the thumb (scroll box).



UpdateData(false);

}
0
cs_obby Messages postés 91 Date d'inscription vendredi 10 octobre 2003 Statut Membre Dernière intervention 12 octobre 2006
1 août 2005 à 23:56
Je pense avoir résolu le problème, le code suivant permet de déplacer
la scrollbar d'une dlg et de déplacer l'affichage en meme tps.





@+

Mick



void CDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)

{



int min_position=0,max_position;

max_position=206;



this->GetScrollRange (SB_VERT,&min_position, &max_position);

int m_position = this->GetScrollPos (SB_VERT);


//pScrollBar->GetScrollRange ( &min_position, &max_position
);

//int m_position=pScrollBar->GetScrollPos();

int position = m_position;



switch (nSBCode)

{



case SB_LINEUP :

m_position=m_position-1;

this->SetScrollPos(SB_VERT,m_position,TRUE);

break;



case SB_LINEDOWN :

m_position=m_position+1;

this->SetScrollPos(SB_VERT,m_position,TRUE);

break;



case SB_THUMBTRACK :

this->SetScrollPos(SB_VERT,nPos,TRUE);

break;



case SB_PAGEDOWN: //Scrolls one page down.

m_position += 5;

this->SetScrollPos(SB_VERT,m_position,TRUE);

break;

case SB_PAGEUP: //Scrolls one page up.

m_position -= 5;

this->SetScrollPos(SB_VERT,m_position,TRUE);



break;



case SB_THUMBPOSITION: //The user has dragged the scroll box (thumb)
and released the mouse button. The nPos parameter indicates the
position of the scroll box at the end of the drag operation.

break;





case SB_TOP: //Scrolls to the upper left.

break;

} // Set the new position of the thumb (scroll box).



ScrollWindow(0,-(m_position-position));

UpdateData(true);



CDialogBar::OnVScroll(nSBCode, nPos, pScrollBar);

}
0
Rejoignez-nous