How to scroll the wxListBox one page ?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
manianis
Experienced Solver
Experienced Solver
Posts: 72
Joined: Mon Jan 15, 2007 11:00 am

How to scroll the wxListBox one page ?

Post by manianis » Tue Jan 30, 2007 11:26 pm

I'm using the MSW version of wxWidgets and the function GetScrollPageSize is not available. How to scroll manually by one page on MSW ?

loptr
Earned some good credits
Earned some good credits
Posts: 110
Joined: Tue Jan 23, 2007 12:22 pm
Location: Kiel, Germany
Contact:

Post by loptr » Wed Jan 31, 2007 7:27 am

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...?

manianis
Experienced Solver
Experienced Solver
Posts: 72
Joined: Mon Jan 15, 2007 11:00 am

Post by manianis » Wed Jan 31, 2007 10:13 am

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);
	}
}


Post Reply