Home » U++ Library support » U++ Widgets - General questions or Mixed problems » DropList bug
DropList bug [message #6464] |
Mon, 13 November 2006 13:14 |
zsolt
Messages: 698 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;
}
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sat May 04 17:54:57 CEST 2024
Total time taken to generate the page: 0.02798 seconds
|