focus the search field when showing
This commit is contained in:
@@ -1158,7 +1158,7 @@ bool cDialog::hasControl(std::string id) const {
|
||||
}
|
||||
|
||||
void cDialog::setDefaultButton(std::string defbtn) {
|
||||
if(!hasControl(defbtn)){
|
||||
if(!defbtn.empty() && !hasControl(defbtn)){
|
||||
// this is likely because the dialogxml is malformed. maybe the linter already checks this,
|
||||
// but the engine might as well also.
|
||||
throw std::string { "Requested default button does not exist: " } + defbtn;
|
||||
@@ -1166,8 +1166,10 @@ void cDialog::setDefaultButton(std::string defbtn) {
|
||||
if(!defaultButton.empty()){
|
||||
getControl(defaultButton).setDefault(false);
|
||||
}
|
||||
defaultButton = defbtn;
|
||||
getControl(defaultButton).setDefault(true);
|
||||
if(!defbtn.empty()){
|
||||
defaultButton = defbtn;
|
||||
getControl(defaultButton).setDefault(true);
|
||||
}
|
||||
}
|
||||
|
||||
const char*const xBadVal::CONTENT = "$content$";
|
||||
|
||||
@@ -169,6 +169,7 @@ bool cStringChoice::onOkay(cDialog& me){
|
||||
bool cStringChoice::onSearch(cDialog& me){
|
||||
if(!search_open){
|
||||
me["search-field"].show();
|
||||
me.setFocus(&(dynamic_cast<cTextField&>(me.getControl("search-field"))));
|
||||
me["search-label"].show();
|
||||
me["reverse"].show();
|
||||
me.setDefaultButton("search");
|
||||
|
||||
Reference in New Issue
Block a user