diff --git a/Basalt/Frame.lua b/Basalt/Frame.lua index 7b5ea76..863e42d 100644 --- a/Basalt/Frame.lua +++ b/Basalt/Frame.lua @@ -371,7 +371,17 @@ return function(name, parent, pTerm, basalt) getType = function(self) return objectType - end; + end, + + setZIndex = function(self, newIndex) + base.setZIndex(self, newIndex) + for k,v in pairs(activeEvents)do + if(v)then + self.parent:addEvent(k, self) + end + end + return self + end, setFocusedObject = function(self, obj) if(focusedObject~=obj)then diff --git a/Basalt/Object.lua b/Basalt/Object.lua index 51214d0..44bc11a 100644 --- a/Basalt/Object.lua +++ b/Basalt/Object.lua @@ -909,7 +909,6 @@ return function(name) eventHandler = function(self, event, p1, p2, p3, p4) local val = eventSystem:sendEvent("other_event", self, event, p1, p2, p3, p4) if(val~=nil)then return val end - return true end; getFocusHandler = function(self) @@ -944,4 +943,4 @@ return function(name) object.__index = object return object -end \ No newline at end of file +end diff --git a/Basalt/init.lua b/Basalt/init.lua index bb8e6b0..0f36267 100644 --- a/Basalt/init.lua +++ b/Basalt/init.lua @@ -1,10 +1,17 @@ local curDir = fs.getDir(table.pack(...)[2]) or "" -local defaultPath = package.path -local format = "%s;/%s/?.lua;/%s/?/init.lua" -package.path = string.format(format, package.path, curDir,curDir)..string.format(format, package.path, curDir.."/libraries",curDir.."/libraries")..string.format(format, package.path, curDir.."/objects",curDir.."/objects") +if not(packed)then + local defaultPath = package.path + local format = "path;/path/?.lua;/path/?/init.lua;" + local main = format:gsub("path", curDir) + local objFolder = format:gsub("path", curDir.."/objects") + local libFolder = format:gsub("path", curDir.."/libraries") + + + package.path = main..objFolder..libFolder..defaultPath +end local Basalt = require("main") package.path = defaultPath -return Basalt \ No newline at end of file +return Basalt diff --git a/Basalt/objects/Button.lua b/Basalt/objects/Button.lua index 6ae68b1..5e84122 100644 --- a/Basalt/objects/Button.lua +++ b/Basalt/objects/Button.lua @@ -60,8 +60,9 @@ return function(name) for n = 1, h do if (n == verticalAlign) then - self.parent:setText(obx, oby + (n - 1), utils.getTextHorizontalAlign(self:getValue(), w, textHorizontalAlign)) - self.parent:setFG(obx, oby + (n - 1), utils.getTextHorizontalAlign(tHex[self.fgColor]:rep(self:getValue():len()), w, textHorizontalAlign)) + local val = self:getValue() + self.parent:setText(obx + (w/2-val:len()/2), oby + (n - 1), utils.getTextHorizontalAlign(val, val:len(), textHorizontalAlign)) + self.parent:setFG(obx + (w/2-val:len()/2), oby + (n - 1), utils.getTextHorizontalAlign(tHex[self.fgColor]:rep(val:len()), val:len(), textHorizontalAlign)) end end end @@ -70,4 +71,4 @@ return function(name) } return setmetatable(object, base) -end \ No newline at end of file +end