StdDisplay: Fixed GetStdSize height for Null Value (now 0), ArrayCtrl: Fixed issue with unnecesarry Accepts when clicking outside

git-svn-id: svn://ultimatepp.org/upp/trunk@15914 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2021-04-16 16:42:11 +00:00
parent a0b6b63f7b
commit fa2ed4c909
3 changed files with 10 additions and 5 deletions

View file

@ -1333,7 +1333,7 @@ void ArrayCtrl::ClearModify() {
control[i].ctrl->ClearModify();
}
bool ArrayCtrl::AcceptRow() {
bool ArrayCtrl::AcceptRow(bool endedit) {
ASSERT(IsCursor());
if(acceptingrow) // prevent recursion
return true;
@ -1342,7 +1342,7 @@ bool ArrayCtrl::AcceptRow() {
Column& m = column[i];
if(m.edit && !m.edit->Accept())
return false;
if(IsCtrl(cursor, i)) {
if(IsCtrl(cursor, i) && !endedit) {
Ctrl *c = GetCellCtrl(cursor, i).ctrl;
acceptingrow++;
bool b = c->Accept();
@ -1363,7 +1363,8 @@ bool ArrayCtrl::AcceptRow() {
}
bool b = editmode;
EndEdit();
SetCtrls();
if(!endedit)
SetCtrls();
ClearModify();
if(b)
WhenAcceptEdit();
@ -1665,7 +1666,7 @@ void ArrayCtrl::DoPoint(Point p, bool dosel) {
SetCursor0(clickpos.y, dosel);
else
if(IsCursor())
AcceptRow();
AcceptRow(true); // true not to reenable ctrls
if(!HasFocusDeep())
SetWantFocus();
}

View file

@ -535,7 +535,7 @@ public:
int GetScroll() const;
void ScrollTo(int sc);
void ShowAppendLine();
bool AcceptRow();
bool AcceptRow(bool endedit = false);
void Move(int d);
void SwapUp();

View file

@ -148,6 +148,8 @@ void StdDisplayClass::Paint0(Draw& w, const Rect& r, const Value& q,
else
txt = IsString(q) ? q : StdConvert().Format(q);
Size tsz = GetTLTextSize(txt, font);
if(txt.GetCount() == 0)
tsz.cy = 0;
if(a == ALIGN_RIGHT)
x = r.right - tsz.cx;
if(a == ALIGN_CENTER)
@ -190,6 +192,8 @@ Size StdDisplayClass::GetStdSize(const Value& q) const
else
txt = IsString(q) ? q : StdConvert().Format(q);
Size sz = GetTLTextSize(txt, font);
if(txt.GetCount() == 0)
sz.cy = 0;
return Size(sz.cx + isz.cx, max(sz.cy, isz.cy));
}