Skip to content

Commit 571900d

Browse files
author
justjuangui
committed
EditControl show value is not enabled
1 parent 6acf69b commit 571900d

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
@@ -67,9 +67,16 @@ local EditClass = newClass("EditControl", "ControlHost", "Control", "UndoHandler
6767
self.controls.buttonDown = new("ButtonControl", {"RIGHT",self,"RIGHT"}, {-2, 0, buttonSize, buttonSize}, "-", function()
6868
self:OnKeyUp("DOWN")
6969
end)
70+
self.controls.buttonDown.enabled = function()
71+
return self:IsEnabled()
72+
end
73+
7074
self.controls.buttonUp = new("ButtonControl", {"RIGHT",self.controls.buttonDown,"LEFT"}, {-1, 0, buttonSize, buttonSize}, "+", function()
7175
self:OnKeyUp("UP")
7276
end)
77+
self.controls.buttonUp.enabled = function()
78+
return self:IsEnabled()
79+
end
7380
elseif clearable then
7481
self.controls.buttonClear = new("ButtonControl", {"RIGHT",self,"RIGHT"}, {-2, 0, buttonSize, buttonSize}, "x", function()
7582
self:SetText("", true)
@@ -277,10 +284,8 @@ function EditClass:Draw(viewPort, noTooltip)
277284
end
278285
textX = textX + DrawStringWidth(textHeight, self.font, self.prompt) + textHeight/2
279286
end
280-
if not enabled then
281-
return
282-
end
283-
if mOver and not noTooltip then
287+
288+
if enabled and mOver and not noTooltip then
284289
SetDrawLayer(nil, 100)
285290
self:DrawTooltip(x, y, width, height, viewPort)
286291
SetDrawLayer(nil, 0)
@@ -290,7 +295,7 @@ function EditClass:Draw(viewPort, noTooltip)
290295
local marginR = self.controls.scrollBarV:IsShown() and 14 or 0
291296
local marginB = self.controls.scrollBarH:IsShown() and 14 or 0
292297
SetViewport(textX, textY, width - 4 - marginL - marginR, height - 4 - marginB)
293-
if not self.hasFocus then
298+
if not enabled or not self.hasFocus then
294299
if self.buf == '' and self.placeholder then
295300
SetDrawColor(self.disableCol)
296301
DrawString(-self.controls.scrollBarH.offset, -self.controls.scrollBarV.offset, "LEFT", textHeight, self.font, self.placeholder)

0 commit comments

Comments
 (0)