PDA

View Full Version : hover effect on sidebar icons



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

Dave0910
March 13th, 2019, 04:44
You overcomplicated it, a bit.
First, you need to add the hover image to the graphics_icons.xml file.

After that, go into the Scripts folder and add the hover icon to the end of the array for each structure.

For example, within the class construct: aDisplayIcon = { "button_classes", "button_classes_down", "button_classes_hover" },

Trenloe
March 13th, 2019, 04:59
The OP made this one post, 9 years ago. I'm sure they'll appreciate the assistance! ;-)

Dave0910
March 13th, 2019, 11:04
The OP made this one post, 9 years ago. I'm sure they'll appreciate the assistance! ;-)

Maybe not, but the next person who googles it will find this post, complete with answer.