MCPcopy Create free account
hub / github.com/MyGUI/mygui / notifyComboAccept

Method notifyComboAccept

Demos/Demo_Console/Console.cpp:57–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 }
56
57 void Console::notifyComboAccept(MyGUI::ComboBox* _sender, size_t _index)
58 {
59 const MyGUI::UString& command = _sender->getOnlyText();
60 if (command.empty())
61 return;
62
63 MyGUI::UString key = command;
64 MyGUI::UString value;
65
66 size_t pos = command.find(' ');
67 if (pos != MyGUI::UString::npos)
68 {
69 key = command.substr(0, pos);
70 value = command.substr(pos + 1);
71 }
72
73 MapDelegate::iterator iter = mDelegates.find(key);
74 if (iter != mDelegates.end())
75 {
76 iter->second(key, value);
77 }
78 else
79 {
80 if (eventConsoleUnknowCommand.empty())
81 {
82 addToConsole(mStringUnknow + "'" + key + "'");
83 }
84 else
85 {
86 eventConsoleUnknowCommand(key, value);
87 }
88 }
89
90 _sender->setCaption(MyGUI::UString());
91 }
92
93
94 void Console::notifyButtonPressed(MyGUI::Widget* _sender, MyGUI::KeyCode _key, MyGUI::Char _char)

Callers

nothing calls this directly

Calls 7

UStringFunction · 0.85
substrMethod · 0.80
getOnlyTextMethod · 0.45
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45
setCaptionMethod · 0.45

Tested by

no test coverage detected