Skip to content

Commit ed57b48

Browse files
author
justjuangui
committed
EditControl show value is not enabled
1 parent c2a2349 commit ed57b48

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/Classes/EditControl.lua

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,16 @@ local EditClass = newClass("EditControl", "ControlHost", "Control", "UndoHandler
6666
self.controls.buttonDown = new("ButtonControl", {"RIGHT",self,"RIGHT"}, {-2, 0, buttonSize, buttonSize}, "-", function()
6767
self:OnKeyUp("DOWN")
6868
end)
69+
self.controls.buttonDown.enabled = function()
70+
return self:IsEnabled()
71+
end
72+
6973
self.controls.buttonUp = new("ButtonControl", {"RIGHT",self.controls.buttonDown,"LEFT"}, {-1, 0, buttonSize, buttonSize}, "+", function()
7074
self:OnKeyUp("UP")
7175
end)
76+
self.controls.buttonUp.enabled = function()
77+
return self:IsEnabled()
78+
end
7279
elseif clearable then
7380
self.controls.buttonClear = new("ButtonControl", {"RIGHT",self,"RIGHT"}, {-2, 0, buttonSize, buttonSize}, "x", function()
7481
self:SetText("", true)
@@ -276,10 +283,8 @@ function EditClass:Draw(viewPort, noTooltip)
276283
end
277284
textX = textX + DrawStringWidth(textHeight, self.font, self.prompt) + textHeight/2
278285
end
279-
if not enabled then
280-
return
281-
end
282-
if mOver and not noTooltip then
286+
287+
if enabled and mOver and not noTooltip then
283288
SetDrawLayer(nil, 100)
284289
self:DrawTooltip(x, y, width, height, viewPort)
285290
SetDrawLayer(nil, 0)
@@ -289,7 +294,7 @@ function EditClass:Draw(viewPort, noTooltip)
289294
local marginR = self.controls.scrollBarV:IsShown() and 14 or 0
290295
local marginB = self.controls.scrollBarH:IsShown() and 14 or 0
291296
SetViewport(textX, textY, width - 4 - marginL - marginR, height - 4 - marginB)
292-
if not self.hasFocus then
297+
if not enabled or not self.hasFocus then
293298
if self.buf == '' and self.placeholder then
294299
SetDrawColor(self.disableCol)
295300
DrawString(-self.controls.scrollBarH.offset, -self.controls.scrollBarV.offset, "LEFT", textHeight, self.font, self.placeholder)

0 commit comments

Comments
 (0)