Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » DropList bug
DropList bug [message #6464] Mon, 13 November 2006 13:14 Go to previous message
zsolt is currently offline  zsolt
Messages: 702
Registered: December 2005
Location: Budapest, Hungary
Contributor
Testcase:
#include <CtrlLib/CtrlLib.h>

struct MyApp : TopWindow {
	DropList dl;

	MyApp()
	{
		dl.Add("Alpha");
		dl.Add("Beta");
		dl.Add("Gamma");
		Add(dl.HSizePos().TopPos(5, Ctrl::STDSIZE));
		SetRect(0, 0, 200, 70);
	}
};

GUI_APP_MAIN
{
	MyApp().Run();
}


The problem is, that pressing 'a' key, "Alpha" is not selected. Generally, you can never select the first row of the list, pressing its first lettel on keyboard.

Fix:
I commented out one line, but I'm not sure, if it doesn't break any other thing.
bool DropList::Key(dword k, int) {
	if(IsReadOnly()) return false;
	switch(k) {
	case K_ALT_DOWN:
		Push();
		break;
	case K_DOWN:
	case K_RIGHT:
		Change(1);
		break;
	case K_UP:
	case K_LEFT:
		Change(-1);
		break;
	default:
		if(k >= 32 && k < 256) {
			//list.SetCursor(key.Find(value));
			int c = list.GetCursor();
			bool b = list.Key(k, 1);
			if(list.GetCursor() != c) Select();
			return b;
		}
		return false;
	}
	return true;
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to set the ***initial*** focus to an option?
Next Topic: AlignDisplay bug (?)
Goto Forum:
  


Current Time: Tue Jun 03 05:30:46 CEST 2025

Total time taken to generate the page: 0.02743 seconds