Page 1 of 1

How to scroll the wxListBox one page ?

Posted: Tue Jan 30, 2007 11:26 pm
by manianis
I'm using the MSW version of wxWidgets and the function GetScrollPageSize is not available. How to scroll manually by one page on MSW ?

Posted: Wed Jan 31, 2007 7:27 am
by loptr
could you provide some more information please?

in which context are you trying to use GetScrollPageSize?
where did you this method expect to be located?
for what object did you try to use the method?

maybe some code...?

Posted: Wed Jan 31, 2007 10:13 am
by manianis
I've a wxPanel with a wxTextCtrl and a wxListBox. The user can search the values in the wxListBox by typing in the wxTextCtrl.

I'm trying to make it intercat like the index search in CHM files.

Code: Select all

void ClientListPanel::OnClientTextCtrlKeyDown(wxKeyEvent& event)
{
	int nSel = m_clientList->GetSelection();
	wxString strSel;
	if (nSel == wxNOT_FOUND)
	{
		return;
	}
	if (event.GetKeyCode() == WXK_UP)
	{
		if (nSel > 0) nSel--;
		m_clientTextCtrl->SetEvtHandlerEnabled(false);
		strSel = m_clientList->GetString(nSel);
		m_clientList->SetSelection(nSel);
		m_clientTextCtrl->SetValue(strSel);
		m_clientTextCtrl->SetSelection(strSel.Len(), -1);
		m_clientTextCtrl->SetEvtHandlerEnabled(true);
	}
	else if (event.GetKeyCode() == WXK_DOWN)
	{
		if (nSel < m_clientList->GetCount()) nSel++;
		m_clientTextCtrl->SetEvtHandlerEnabled(false);
		strSel = m_clientList->GetString(nSel);
		m_clientList->SetSelection(nSel);
		m_clientTextCtrl->SetValue(strSel);
		m_clientTextCtrl->SetSelection(strSel.Len(), -1);
		m_clientTextCtrl->SetEvtHandlerEnabled(true);
	}
	else if (event.GetKeyCode() == WXK_PAGEUP)
	{
		// don't know how to handle it
	}
	else if (event.GetKeyCode() == WXK_PAGEDOWN)
	{
		// don't know how to handle it
	}
	else if (event.GetKeyCode() == WXK_RETURN)
	{
		NotifyUserSelected(nSel);
	}
}