LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Interface Requests (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=5)
-   -   Locked Icon Module (https://www.lotrointerface.com/forums/showthread.php?t=1842)

Vald 07-08-2012 12:27 PM

Locked Icon Module
 
Several of the plugins I use create an icon to access the plugin's features. Unfortunately, some of these icons are not locked in place, which is a real pain the the butt. Clicking them often moves them slightly, so I', regularly having to move them back into position.

Two examples are Galuhad's ChatEdit and Raid Assistant. Galuhad hasn't responded in some time, so asking him to add this feature hasn't helped.

So, is it possible to add a standard block of code which could be added to any plugin file with an icon to lock in in place? Some icons are moved with the standard CNTRL+\, others by holding down a second button and dragging, etc.

I don't much care how the loch feature works, I just don't want to have to wait for an author to decide to lock his icon (if ever). I'd like to be able to add the code myself but just don't know how.

If anyone can help, I'd sure appreciate it.

MrJackdaw 07-08-2012 04:23 PM

This is one of the reasons I use DeusDictums Dragbar class - it matches the locking code to the standard "ctrl+#".

Vald 07-08-2012 06:08 PM

I have that class installed. Is there some block of code that ties to it that could be inserted into any plugin file to lock the icon?

D.H1cks 07-08-2012 07:06 PM

Try this:

First, put this near the start of the code for the icon:
Code:

import "Deusdictum.UI";
Then add this somewhere in the setup for the icon:

Code:

  self.DragBar = Deusdictum.UI.DragBar( self, "{name of icon}" );
I think that is all there is to it, let me know how it works.

Vald 07-08-2012 10:29 PM

I can't seem to get this right. I added the import code to main.lue and the icon code to IconWindow.lua for Raid Assistant. When I try to load it in game, I keep getting this error code:

...f the Rings Online\Plugins\Deusdictum\UI\DragBar.lua:59: attempt to index field 'wndTarget' (a nil value)

Does that mean I'm getting the icon name wrong? I can't seem to tell what it is, if that's the case.

D.H1cks 07-09-2012 04:59 AM

I think it should be placed in the IconWindow.lua file, but you will need to change the second line to:

Code:

wIcon.DragBar = Deusdictum.UI.DragBar( wIcon, "{name of icon}" );
I would try it myself but I am on the way out the door for work. If it doesn't work I will figure it out for sure tonight.

If it does work, you will need to delete the section of code that handles moving the icon, it starts with:

Code:

wIcon.MouseMove = function (sender, args)

D.H1cks 07-09-2012 06:20 PM

Ok, tried it out and here is what I found to make it work properly.

First, added the line following line to the very start of the IconWindow.lua file:

Code:

import "Deusdictum.UI";
Added the following right before the 'wIcon.MouseEnter = function (sender, args)' line:

Code:

wIcon.DragBar = Deusdictum.UI.DragBar( wIcon, "R.A. Icon" );
Completely removed the MouseMove function. Then added the following in its place:


Code:

        wIcon.PositionChanged = function(sender, args )
                SETTINGS.ICONX, SETTINGS.ICONY = wIcon:GetPosition();

                if SETTINGS.ICONX < 0 then SETTINGS.ICONX = 0 end
                if SETTINGS.ICONX > (SCREENWIDTH-32) then SETTINGS.ICONX = (SCREENWIDTH-32) end
                if SETTINGS.ICONY < 0 then SETTINGS.ICONY = 0 end
                if SETTINGS.ICONY > (SCREENHEIGHT-32) then SETTINGS.ICONY = (SCREENHEIGHT-32) end

                wIcon:SetPosition(SETTINGS.ICONX,SETTINGS.ICONY);
        end

Everything appears to be working.

Vald 07-09-2012 09:40 PM

Thank you very much, D. I got that one working. ChatEdit (also by Galuhad) is much harder. It has "parent" and "child" windows. So far, I've been able to disable the current drag function but can't seem to get DragBar working with it.

D.H1cks 07-10-2012 05:27 PM

I have been looking at ChatEdit and for some reason it will not attach the dragbar to the bOpen window, which is the icon.

Now to find out why....


All times are GMT -5. The time now is 12:42 PM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI