Verokh
June 3rd, 2010, 15:04
i´ve tried to establish a hover effect on sidebar icon. But it still does not work. So here are the functions in manager_desktop.lua and the commands in desktop.lua. Can some find the bug or my mistakes within the scripts?
operation function in manager_desktop.lua
function registerStackShortcut(iconNormal, iconPressed, iconHover, tooltipText, className, recordName)
function createFunc()
createStackShortcut(iconNormal, iconPressed, iconHover, tooltipText, className, recordName);
end
if window == nil then
table.insert(delayedCreate, createFunc);
else
createFunc();
end
end
function createStackShortcut(iconNormal, iconPressed, iconHover, tooltipText, className, recordName)
local control = window.createControl("desktop_stackitem", tooltipText);
table.insert(stackcontrols, control);
control.setIcons(iconNormal, iconPressed, iconHover);
control.setValue(className, recordName or "");
control.setTooltipText(tooltipText);
updateControls();
end
function registerDockShortcut(iconNormal, iconPressed, iconHover, tooltipText, className, recordName, useSubdock)
function createFunc()
createDockShortcut(iconNormal, iconPressed, iconHover, tooltipText, className, recordName, useSubdock);
end
if window == nil then
table.insert(delayedCreate, createFunc);
else
createFunc();
end
end
function createDockShortcut(iconNormal, iconPressed, iconHover, tooltipText, className, recordName, useSubdock)
local control = window.createControl("desktop_dockitem", tooltipText);
if useSubdock then
table.insert(subdockcontrols, control);
else
table.insert(dockcontrols, control);
end
control.setIcons(iconNormal, iconPressed, iconHover);
control.setValue(className, recordName or "");
control.setTooltipText(tooltipText);
updateControls();
end
desktop.lua just an example
function onInit()
if not User.isLocal() then
if User.isHost() then
DesktopManager.registerStackShortcut("button_light", "button_light_down", "", "Lighting", "lightingselection");
DesktopManager.registerDockShortcut("button_people", "button_people_down", "button_people_hover", "Personalities", "npclist", "npc");
else
etc
Verokh
operation function in manager_desktop.lua
function registerStackShortcut(iconNormal, iconPressed, iconHover, tooltipText, className, recordName)
function createFunc()
createStackShortcut(iconNormal, iconPressed, iconHover, tooltipText, className, recordName);
end
if window == nil then
table.insert(delayedCreate, createFunc);
else
createFunc();
end
end
function createStackShortcut(iconNormal, iconPressed, iconHover, tooltipText, className, recordName)
local control = window.createControl("desktop_stackitem", tooltipText);
table.insert(stackcontrols, control);
control.setIcons(iconNormal, iconPressed, iconHover);
control.setValue(className, recordName or "");
control.setTooltipText(tooltipText);
updateControls();
end
function registerDockShortcut(iconNormal, iconPressed, iconHover, tooltipText, className, recordName, useSubdock)
function createFunc()
createDockShortcut(iconNormal, iconPressed, iconHover, tooltipText, className, recordName, useSubdock);
end
if window == nil then
table.insert(delayedCreate, createFunc);
else
createFunc();
end
end
function createDockShortcut(iconNormal, iconPressed, iconHover, tooltipText, className, recordName, useSubdock)
local control = window.createControl("desktop_dockitem", tooltipText);
if useSubdock then
table.insert(subdockcontrols, control);
else
table.insert(dockcontrols, control);
end
control.setIcons(iconNormal, iconPressed, iconHover);
control.setValue(className, recordName or "");
control.setTooltipText(tooltipText);
updateControls();
end
desktop.lua just an example
function onInit()
if not User.isLocal() then
if User.isHost() then
DesktopManager.registerStackShortcut("button_light", "button_light_down", "", "Lighting", "lightingselection");
DesktopManager.registerDockShortcut("button_people", "button_people_down", "button_people_hover", "Personalities", "npclist", "npc");
else
etc
Verokh