From 973bb1b8ef25365d6f4e706de5443c580312d281 Mon Sep 17 00:00:00 2001 From: Kenny Shields Date: Thu, 7 Nov 2013 18:24:23 -0500 Subject: [PATCH] method name changes and misc fixes Renamed textinput:SetPlaceholder to textinput:SetPlaceholderText Renamed textinput:GetPlaceholder to textinput:GetPlaceholderText Fixed textinput placeholder text not displaying correctly in multiline mode Fixed columnlist row selection issues --- changelog.txt | 2 ++ objects/columnlist.lua | 6 ++++-- objects/textinput.lua | 40 ++++++++++++++++++++-------------------- skins/Blue/skin.lua | 4 ++-- 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/changelog.txt b/changelog.txt index 77c3ece..368b4e3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -13,6 +13,8 @@ Version 0.9.6.4 - Alpha (Release Date TBD) [ADDED] a new textinput method: GetMasked() [ADDED] a new textinput method: SetMaskChar(char) [ADDED] a new textinput method: GetMaskChar() +[ADDED] a new textinput method: SetPlaceholderText(text) +[ADDED] a new textinput method: GetPlaceholderText() [ADDED] a new text method: SetLinksEnabled(enabled) [ADDED] a new text method: GetLinksEnabled() [ADDED] a new text event callback: OnClickLink(object, text) diff --git a/objects/columnlist.lua b/objects/columnlist.lua index 9215017..5e2e5f2 100644 --- a/objects/columnlist.lua +++ b/objects/columnlist.lua @@ -513,8 +513,10 @@ function newobject:SelectRow(row, ctrl) onrowselected(self, row, row:GetColumnData()) end end - elseif v ~= row and not multiselect and not ctrl then - v.selected = false + elseif v ~= row then + if (not multiselect and ctrl) or (not multiselect and not ctrl) or (multiselect and not ctrl) then + v.selected = false + end end end diff --git a/objects/textinput.lua b/objects/textinput.lua index bad55ff..0856aed 100644 --- a/objects/textinput.lua +++ b/objects/textinput.lua @@ -1325,26 +1325,6 @@ function newobject:GetText() end ---[[--------------------------------------------------------- - - func: SetText(text) - - desc: sets the object's placeholder ---]]--------------------------------------------------------- -function newobject:SetPlaceholder(text) - - self.placeholder = text - -end - ---[[--------------------------------------------------------- - - func: GetText() - - desc: gets the object's placeholder ---]]--------------------------------------------------------- -function newobject:GetPlaceholder() - - return self.placeholder - -end - --[[--------------------------------------------------------- - func: SetMultiline(bool) - desc: enables or disables allowing multiple lines for @@ -1972,3 +1952,23 @@ function newobject:GetMaskChar() return self.maskchar end + +--[[--------------------------------------------------------- + - func: SetPlaceholderText(text) + - desc: sets the object's placeholder text +--]]--------------------------------------------------------- +function newobject:SetPlaceholderText(text) + + self.placeholder = text + +end + +--[[--------------------------------------------------------- + - func: GetPlaceholderText() + - desc: gets the object's placeholder text +--]]--------------------------------------------------------- +function newobject:GetPlaceholderText() + + return self.placeholder + +end \ No newline at end of file diff --git a/skins/Blue/skin.lua b/skins/Blue/skin.lua index b733fcc..eeb5d60 100644 --- a/skins/Blue/skin.lua +++ b/skins/Blue/skin.lua @@ -908,7 +908,7 @@ function skin.DrawTextInput(object) local text = object:GetText() local multiline = object:GetMultiLine() local lines = object:GetLines() - local placeholder = object:GetPlaceholder() + local placeholder = object:GetPlaceholderText() local offsetx = object:GetOffsetX() local offsety = object:GetOffsetY() local indicatorx = object:GetIndicatorX() @@ -1031,7 +1031,7 @@ function skin.DrawTextInput(object) local maskchar = object:GetMaskChar() str = str:gsub(".", maskchar) end - love.graphics.print(#str > 0 and str or (i == 1 and placeholder or ""), textx, texty + theight * i - theight) + love.graphics.print(#str > 0 and str or (#lines == 1 and placeholder or ""), textx, texty + theight * i - theight) end else str = lines[1]