no more crashes for hotkey based selections in listboxes without translation.
This commit is contained in:
parent
0c00b49995
commit
dea351095c
|
@ -543,7 +543,8 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
||||||
bool bFound = false;
|
bool bFound = false;
|
||||||
if(advanceToItemStartingWith != "") {
|
if(advanceToItemStartingWith != "") {
|
||||||
for(int i = selectedItemIndex - 1; i >= 0; --i) {
|
for(int i = selectedItemIndex - 1; i >= 0; --i) {
|
||||||
string item = translated_items[i];
|
string item = items[i];
|
||||||
|
if(translated_items.size()>i) item=translated_items[i];
|
||||||
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
||||||
bFound = true;
|
bFound = true;
|
||||||
selectedItemIndex = i;
|
selectedItemIndex = i;
|
||||||
|
@ -551,8 +552,9 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(bFound == false) {
|
if(bFound == false) {
|
||||||
for(int i = translated_items.size() - 1; i >= selectedItemIndex; --i) {
|
for(int i = items.size() - 1; i >= selectedItemIndex; --i) {
|
||||||
string item = translated_items[i];
|
string item = items[i];
|
||||||
|
if(translated_items.size()>i) item=translated_items[i];
|
||||||
//printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str());
|
//printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str());
|
||||||
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
||||||
bFound = true;
|
bFound = true;
|
||||||
|
@ -572,8 +574,9 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
||||||
else if(b2) {
|
else if(b2) {
|
||||||
bool bFound = false;
|
bool bFound = false;
|
||||||
if(advanceToItemStartingWith != "") {
|
if(advanceToItemStartingWith != "") {
|
||||||
for(int i = selectedItemIndex + 1; i < translated_items.size(); ++i) {
|
for(int i = selectedItemIndex + 1; i < items.size(); ++i) {
|
||||||
string item = translated_items[i];
|
string item = items[i];
|
||||||
|
if(translated_items.size()>i) item=translated_items[i];
|
||||||
//printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str());
|
//printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str());
|
||||||
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
||||||
bFound = true;
|
bFound = true;
|
||||||
|
@ -583,7 +586,8 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
||||||
}
|
}
|
||||||
if(bFound == false) {
|
if(bFound == false) {
|
||||||
for(int i = 0; i <= selectedItemIndex; ++i) {
|
for(int i = 0; i <= selectedItemIndex; ++i) {
|
||||||
string item = translated_items[i];
|
string item = items[i];
|
||||||
|
if(translated_items.size()>i) item=translated_items[i];
|
||||||
//printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str());
|
//printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str());
|
||||||
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
||||||
bFound = true;
|
bFound = true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user