Skip to content

Commit a7a89c1

Browse files
committed
improve automatic size of EditBox and add methods getwidth and getheight
1 parent 5574567 commit a7a89c1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Guitor.winxed

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,12 +2048,13 @@ class EditBox : ChildWindow
20482048
self.inipos = 0;
20492049
self.pos = 0;
20502050
self.offset = 0;
2051+
int ascent = font.getAscent();
20512052
if (height == 0)
2052-
height = font.getHeight() + MARGINSUP;
2053+
height = ascent + font.getDescent() + MARGINSUP + 2;
20532054
if (width == 0)
20542055
width = 200;
20552056
self.height = height;
2056-
self.baseline = font.getAscent() + MARGINSUP + 1;
2057+
self.baseline = ascent + MARGINSUP + 1;
20572058
self.width = width;
20582059
self.has_focus = false;
20592060
self.ChildWindow(parent, x, y, width, height);
@@ -2072,6 +2073,8 @@ class EditBox : ChildWindow
20722073
self.OnSelectionRequest += function (event) { self.onselectionrequest(event); };
20732074
self.OnSelectionClear += function (event) { self.onselectionclear(event); };
20742075
}
2076+
function getwidth() { return int(self.width); }
2077+
function getheight() { return int(self.height); }
20752078
function getValue()
20762079
{
20772080
return self.text;

0 commit comments

Comments
 (0)