Refonte pour utiliser le systeme de GUI #112
2 changed files with 14 additions and 7 deletions
|
@ -142,9 +142,9 @@ end
|
||||||
-- CANCEL FUNCTIONS
|
-- CANCEL FUNCTIONS
|
||||||
-- Add a widget as a "cancel" function
|
-- Add a widget as a "cancel" function
|
||||||
|
|
||||||
function MenuModel:setCancelWidget()
|
function MenuModel:setCancelWidget(id)
|
||||||
local page = self:getCurrentPage()
|
local page = self:getCurrentPage()
|
||||||
page:setCancelWidget()
|
page:setCancelWidget(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
function MenuModel:getCancelWidget()
|
function MenuModel:getCancelWidget()
|
||||||
|
|
|
@ -66,8 +66,8 @@ end
|
||||||
-- All the actions callback used by the widgets
|
-- All the actions callback used by the widgets
|
||||||
|
|
||||||
function Page:cancelAction()
|
function Page:cancelAction()
|
||||||
if (self.cancel ~= 0) then
|
if (self:getCancelWidget() ~= 0) then
|
||||||
self:action(self.cancel, "key")
|
self:action(self:getCancelWidget(), "key")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -134,11 +134,18 @@ end
|
||||||
-- Add a widget as a "cancel" function
|
-- Add a widget as a "cancel" function
|
||||||
|
|
||||||
function Page:setCancelWidget(id)
|
function Page:setCancelWidget(id)
|
||||||
self.cancel = #self.widgets
|
if (id == nil) then
|
||||||
|
id = #self.widgets
|
||||||
|
end
|
||||||
|
self.cancel = id
|
||||||
end
|
end
|
||||||
|
|
||||||
function Page:getCancelWidget(id)
|
function Page:getCancelWidget()
|
||||||
return self.cancel
|
if (self.cancel == "last") then
|
||||||
|
return #self.widgets
|
||||||
|
else
|
||||||
|
return self.cancel
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- CURSOR FUNCTIONS
|
-- CURSOR FUNCTIONS
|
||||||
|
|
Loading…
Reference in a new issue