cbpporter Messages: 1401 Registered: September 2007
Ultimate Contributor
Hi Lance,
Thank you for the help. Unfortunately, I can't get your sample to link.
But it did help me to find out why my gates wouldn't compile: I had it take a const Value& parameter instead of a Value.
So now it works.
But I found a bug on TabBar. The closing mechanism is based on the current highlighted tab under mouse. Which is fine, until you Prompt in CancelClose, like I do:
bool EditorManager::OnCancelClose(Value val) {
int i = tabFiles.GetCursor();
if (i == -1)
return true;
if (IsChanged(i)) {
BeepQuestion();
String fn = DeQtf(tabFiles[i].key.ToString());
DUMP(tabFiles.GetHighlight());
int save = PromptSaveDontSaveCancel("[ph The following file was changed since last save:&-|[* " + fn + "]&Would you like to save it?]");
DUMP(tabFiles.GetHighlight());
if (save == 1)
Save(i);
else if (save == -1)
return true;
}
return false;
}
Between the two DUMPs, the highlight changes to -1. I tried this simple fix in TabBar.cpp:
void TabBar::MiddleDown(Point p, dword keyflags)
{
if (highlight >= 0)
{
Value v = tabs[highlight].key;
ValueArray vv;
vv.Add(v);
int highlightBack = highlight;
if (!CancelClose(v) && ! CancelCloseSome(vv)) {
Value v = tabs[highlightBack].key;
// 2014/03/06 - FIRST the callbacks, THEN remove the tab
// otherwise keys in WhenCloseSome() are invalid
WhenClose(v);
WhenCloseSome(vv);
TabClosed(v);
Close(highlightBack);
}
}
}