WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   nUI: Developer Chat (https://www.wowinterface.com/forums/forumdisplay.php?f=96)
-   -   Quest Tracker Info Panel (https://www.wowinterface.com/forums/showthread.php?t=29499)

Marthisdil 12-22-09 08:01 AM

Quest Tracker Info Panel
 
Quote:

Originally Posted by Xrystal (Post 170048)
Rofl, so which panels were you thinking of ? hmm hmm :D

Would be nice to have quest objective tracker as a panel ;) Would get that hruge window off the screen ;)

Xrystal 12-22-09 08:23 AM

Quote:

Originally Posted by Marthisdil (Post 171346)
Would be nice to have quest objective tracker as a panel ;) Would get that hruge window off the screen ;)

Not sure whether that is possible as I read that it was a fixed size but I will take a look at its innards and see how it works :D

Xrystal 12-22-09 04:41 PM

Well, doing my usual infopanel set up and I have successfully got the watch frame linked to the infopanel. However, it doesn't seem to want to go in the panel. And once the infopanel is set up the watch frame is no longer moveable by nUI.

I'm reparenting WatchFrame which is the main frame for the Objectives window but it just refuses to keep the anchors I give it. I can't see where but perhaps nUI is re-anchoring after I have reparented it.

So, for now at least, it isn't possible to move the watchframe into an infopanel.

spiel2001 12-22-09 05:26 PM

You probably need to call nUI_Movers:lockFrame( WatchFrame, false, OBJECTIVES_TRACKER_LABEL ); to unlock the frame so you can move and/or size it. Also have a look in the [ nUI > Integration > nUI_Minimap.lua ] file at the bottom to see the handstands you have to do to move/resize the frame.

Xrystal 12-22-09 05:28 PM

Hmm, thanks Scott.

I'm doing this at present for resizing so I guess I need to use the title instead of nil.
Code:

plugin.sizeChanged = function( scale, height, width )
        local options  = plugin.options;
        local Objectives  = plugin.Objectives;
        plugin.scale = scale;
        nUI_Movers:lockFrame( Objectives, false, nil );
        Objectives:SetWidth( width );
        Objectives:SetHeight( height );
        nUI_Movers:lockFrame( Objectives, true, nil );
end

And this is the code I have set up for enabling it.
Code:

plugin.setEnabled = function( enabled )
        if plugin.enabled ~= enabled then
                plugin.enabled = enabled;
                if not enabled then
                        local Objectives = plugin.Objectives;
                        if Objectives.saved_parent then
                                nUI_Movers:lockFrame( Objectives, false, nil );
                                Objectives:SetParent( Objectives.saved_parent );
                                Objectives:SetPoint( "TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", 0, 0 );
                                Objectives:SetBackdropBorderColor( Objectives.border_color );
                                Objectives:SetBackdropColor( Objectives.backdrop_color );
                        end
                else
                        local Objectives = WatchFrame;
                        print(Objectives);
                        plugin.Objectives = Objectives;
                        if not Objectives.saved_parent then
                                Objectives.saved_parent  = Objectives:GetParent();
                                Objectives.border_color  = Objectives:GetBackdropBorderColor();
                                Objectives.backdrop_color =Objectives:GetBackdropColor();
                        end
                        Objectives:SetParent( plugin.container );
                        Objectives:SetPoint( "TOPLEFT", plugin.container, "TOPLEFT", 10, -10 );
                        Objectives:SetPoint( "BOTTOMRIGHT", plugin.container, "BOTTOMRIGHT", 0, 0 );
                        Objectives:SetFrameStrata( plugin.container:GetFrameStrata() );
                        Objectives:SetFrameLevel( plugin.container:GetFrameLevel()+1 );
                        Objectives:SetBackdropBorderColor( 0, 0, 0, 0 );
                        Objectives:SetBackdropColor( 0, 0, 0, 0 );
                                                               
                        nUI_Movers:lockFrame( Objectives, true, nil );
                end                               
        end                       
end

It's the same code I use for my other info panels but I guess the big time resizing we need for the watchframe needs an extra set of change ?

Will try it out again tomorrow though.

spiel2001 12-23-09 05:11 AM

I think the thing that may be an issue here is that you need a "StartMoving" and a "StartSizing" call after you unlock the frame and before you start trying to change the size. Then you need a "StopMovingOrSizing" when you're done.

Also, you should probably use the label to unlock the frame, but you are correct to not use the label when you lock it back. Otherwise it will appear in the movable frame list when you use '/nui movers'

spiel2001 12-23-09 05:12 AM

One other thing... I suspect that resizing the tracking window to fit the info panel is going to cause issues with "not enough room to track more quests" etc.... not sure how that's going to play out.

Marthisdil 12-23-09 07:31 AM

Quote:

Originally Posted by spiel2001 (Post 171502)
One other thing... I suspect that resizing the tracking window to fit the info panel is going to cause issues with "not enough room to track more quests" etc.... not sure how that's going to play out.

I thought about that as well and wondered if it's possible to have it scrollable in the infopanel, but i've not done much digging to see.

spiel2001 12-23-09 08:15 AM

Yeah - you would have to make it a child of a scroll frame, but that should be doable.

Xrystal 12-23-09 08:41 AM

That will be a challenge. I've only managed to do a simple scroll list before.

spiel2001 12-23-09 09:16 AM

It's actuall fairly straight forward... you just need the scroll pane as a parent to the quest tracker frame and the vertical scroll bar. I have code I've written for nUI6 to do scroll frames for the configuration box. I'll dig it up and when I get home this evening and send it to you.

Xrystal 12-23-09 09:21 AM

1 Attachment(s)
Hmm, WatchFrame is not movable. Adjusted the mover locking code and added the ismoving etc code thats in combatlog but no dice. And setting the frame as movable just breaks it even more with the mouse not responding to anything else.

Well, with the moving code taken out and just the addition of the frame name on the movers code and a ClearAllPoints call it is now in the right place but too big. As this screenshot shows.

Ah, with the FrameName in the movers code it keeps the tracker in the movers list but in the wrong place. Using the nil reference as usual it removes the tracker from the movers list which is what we want.

spiel2001 12-23-09 10:12 AM

You should be able to change the size of the watch frame after you unlock it and after you do the "StartSizing" call on it. Again, look at the "ResetWatchFrame()" method in [ nUI > Integration > nUI_Minimap ] and see how nUI is doing it. All you should have to do is basically copy and paste that method, then change where you are moving it to, what size you're making it and to "lose" the label when you lock it back down.

Xrystal 12-23-09 10:16 AM

*blush* was looking at the wrong file rofl.

Trying again :D

Xrystal 12-23-09 10:52 AM

Scratch that, sigh, WatchFrame_Expand errors out due to WatchFrame:GetTop() and WatchFrame:GetBottom() both being nil and thus unable to be calculated on.

Although, I may be doing something wrong using it. The Minimap file isn't a great example, not being an infopanel file. Anyways. Here's what I have so far in the 3 main functions. Anything out of place in these functions ? Oh, and this is the version of nUI that fixes the no unit frames error when you login, which I can confirm works as I changed back and started getting the error again, so went back to your fixed version :D

Code:

function ResetObjectivesFrame(parent, width, height)
                       
        nUI_Options.movedWatchFrame = true;
       
        WatchFrame.moving = true;
        WatchFrame.sizing = true;
       
        WatchFrame:SetMovable( true );
        WatchFrame:SetResizable( true );
        WatchFrame:StartMoving();
        WatchFrame:StartSizing( "BOTTOMRIGHT" );
       
        WatchFrame:ClearAllPoints();
        WatchFrame:SetPoint( "BOTTOMRIGHT", parent, "BOTTOMRIGHT", 0, 0 );
        WatchFrame:SetPoint( "TOPLEFT", parent, "TOPLEFT", 0, 0 );
        WatchFrame:SetHeight( height );
        WatchFrame:SetWidth( width );

        WatchFrame.moving = nil;
        WatchFrame.sizing = nil;

        WATCHFRAME_IGNORECURSOR = "1";                       
        WATCHFRAME_LASTWIDTH    = width;
       
        WatchFrame:StopMovingOrSizing();
        WatchFrame:SetUserPlaced( true );
        print("Top:",WatchFrame:GetTop(), "Bottom:", WatchFrame:GetBottom());
        WatchFrame_Expand( WatchFrame );

end

Code:

plugin.sizeChanged = function( scale, height, width )
        local options  = plugin.options;
        local Objectives  = plugin.Objectives;
        plugin.scale = scale;
        nUI_Movers:lockFrame( Objectives, false, OBJECTIVES_TRACKER_LABEL  );
        ResetObjectivesFrame(plugin.container, width, height);
        nUI_Movers:lockFrame( Objectives, true, nil );
end

Code:

plugin.setEnabled = function( enabled )
        if plugin.enabled ~= enabled then
                plugin.enabled = enabled;
                if not enabled then
                        local Objectives = plugin.Objectives;
                        if Objectives.saved_parent then
                                nUI_Movers:lockFrame( Objectives, false, nil );
                                Objectives:SetParent( Objectives.saved_parent );
                                Objectives:SetPoint( "TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", 0, 0 );
                                Objectives:SetBackdropBorderColor( Objectives.border_color );
                                Objectives:SetBackdropColor( Objectives.backdrop_color );
                        end
                else
                        local Objectives = WatchFrame;
                        print(Objectives);
                        plugin.Objectives = Objectives;
                        if not Objectives.saved_parent then
                                Objectives.saved_parent  = Objectives:GetParent();
                                Objectives.border_color  = Objectives:GetBackdropBorderColor();
                                Objectives.backdrop_color =Objectives:GetBackdropColor();
                        end
                        nUI_Movers:lockFrame( Objectives, false, OBJECTIVES_TRACKER_LABEL  );
                        Objectives:SetParent( plugin.container );
                        Objectives:ClearAllPoints();
                        Objectives:SetPoint( "BOTTOMRIGHT", plugin.container, "BOTTOMRIGHT", 0, 0 );
                        Objectives:SetPoint( "TOPLEFT", plugin.container, "TOPLEFT", 0, 0 );
                        Objectives:Show();
                        Objectives:SetFrameStrata( plugin.container:GetFrameStrata() );
                        Objectives:SetFrameLevel( plugin.container:GetFrameLevel()+1 );
                        Objectives:SetBackdropBorderColor( 0, 0, 0, 0 );
                        Objectives:SetBackdropColor( 0, 0, 0, 0 );                                                               
                        nUI_Movers:lockFrame( Objectives, true, nil );
                end                               
        end                       
end

Errors Received:
Code:

[2009/12/23 16:50:10-231-x1]: Interface\FrameXML\WatchFrame.lua:341: attempt to perform arithmetic on a nil value:
Interface\FrameXML\WatchFrame.lua:297: in function `WatchFrame_Expand':
...UI_InfoPanel_Objectives\nUI_InfoPanel_Objectives.lua:62: in function `ResetObjectivesFrame':
...UI_InfoPanel_Objectives\nUI_InfoPanel_Objectives.lua:102: in function `sizeChanged':
nUI-5.06.06 (Lite)\Integration\nUI_InfoPanel.lua:803: in function `applyScale'
nUI-5.06.06 (Lite)\Integration\nUI_InfoPanel.lua:908: in function `applyOptions'
nUI-5.06.06 (Lite)\Integration\nUI_InfoPanel.lua:937: in function `applySkin'
nUI-5.06.06 (Lite)\Main\nUI.lua:248: in function <Interface\AddOns\nUI\Main\nUI.lua:137>


spiel2001 12-23-09 04:12 PM

1 Attachment(s)
Xrystal --

Here's the scroll frame from nUI6's viewport configuration panel.

In short, you want to create a "UIPanelScrollFrameTemplate" frame as the "parent" that you size to fit the info panel. You then would make it the parent to WatchFrame and call the SetScrollChild() method to make WatchFrame the scroll child. Size the Watch frame the way you want it -- not the size of the info panel, but the size of the watch frame "inside" the scroll frame.

If you look at the attached code, the master frame you create is the same as the "ViewportConfig" frame in my code. The WatchFrame is the same as the "ViewportConfig.scroller" frame in my code. You should be able to work out what you need from there.

.

Xrystal 12-23-09 04:18 PM

Thanks Scott, will work on that attempt next :D see if that helps :D

Xrystal 12-24-09 12:03 PM

1 Attachment(s)
Well, so thought I'd start over kinda and start with tying the WatchFrame to this new ScrollFrame thingy :D

For some reason it isn't parenting the WatchFrame properly, which could be why it didn't work with the infopanel as I expected.

Apart from some slight positioning offsets it is positioning itself correctly but the moment I move the scroll frame the WatchFrame doesn't move with it despite me setting its new parent to it.

Here's the code portion that creates the ScrollFrame and Scroller:
Code:

        -- Create Main Scroll Frame
        local f = CreateFrame( "ScrollFrame", "WatchFrameScrollFrame", UIParent, "UIPanelScrollFrameTemplate" );
        f:SetWidth(400);
        f:SetHeight(200);
        f:SetClampedToScreen(true);
        f:SetPoint("CENTER",UIParent,"CENTER",0,0);
        f:SetBackdrop(ObjectivesBackdrop);
        f:SetBackdropColor(ObjectivesBackcolor.red,ObjectivesBackcolor.green,ObjectivesBackcolor.blue, ObjectivesBackcolor.alpha);
        f:SetBackdropBorderColor(ObjectivesBordercolor.red, ObjectivesBordercolor.green,ObjectivesBordercolor.blue, ObjectivesBordercolor.alpha);
        f:RegisterForDrag(button);
        f:EnableMouse(true);
        f:SetMovable(true);
        f:SetScript("OnMouseDown",ObjectivesOnMouseDown);
        f:SetScript("OnMouseUp",ObjectivesOnMouseUp);
        f:SetScript("OnHide",ObjectivesOnHide);

        -- Create Scroll Frame Scroller Frame
        f.scroller      = CreateFrame( "Frame", "$parent_Scroller", f );       
        f.scroller:SetWidth( f:GetWidth() );
        f.scroller:SetWidth( f:GetHeight() );

        -- Tell WoW Which Frame is the Scroll child
        f:SetScrollChild( f.scroller );

        return f;

And here's the WatchFrame Resize Function :
Code:

local function ResetWatchFrame()
        nUI_Options.movedWatchFrame = true;
       
        WatchFrame.moving = true;
        WatchFrame.sizing = true;
       
        WatchFrame:SetMovable( true );
        WatchFrame:SetResizable( true );
        WatchFrame:StartMoving();
        WatchFrame:StartSizing( "BOTTOMRIGHT" );
       
        WatchFrame:ClearAllPoints();
        WatchFrame:SetParent(WatchFrameScrollFrame);
        WatchFrame:SetPoint( "BOTTOMRIGHT", WatchFrameScrollFrame, "BOTTOMRIGHT", 0, 0 );
        WatchFrame:SetPoint( "TOPLEFT", WatchFrameScrollFrame, "TOPLEFT", 0, 0 );
        WatchFrame:SetHeight( 640 ); -- WatchFrameScrollFrame:GetHeight() );
        WatchFrame:SetWidth( WatchFrameScrollFrame:GetWidth() );

        WatchFrame.moving = nil;
        WatchFrame.sizing = nil;

        WATCHFRAME_IGNORECURSOR = "1";                       
        WATCHFRAME_LASTWIDTH    = WatchFrameScrollFrame:GetWidth() ;
       
        WatchFrame:StopMovingOrSizing();
        WatchFrame:SetUserPlaced( true );
        print("Top:",WatchFrame:GetTop(), "Bottom:", WatchFrame:GetBottom());
        WatchFrame_Expand( WatchFrame );
end

And finally, the piece of code that the addon executes :
Code:

local plugin    = CreateFrame( "Frame", "Mini_ObjectiveFrame", UIParent );

local function onEvent()
        if event == "VARIABLES_LOADED" then
                WatchFrameScrollFrame = CreateScrollFrame();
                nUI_Movers:lockFrame( WatchFrame, false, nil  );
                ResetWatchFrame();
                nUI_Movers:lockFrame( WatchFrame, true, nil );
        end       
end

plugin:SetScript( "OnEvent", onEvent );
plugin:RegisterEvent( "VARIABLES_LOADED" );


Xrystal 12-24-09 12:21 PM

3 Attachment(s)
Okay, managed to get the WatchFrame to reset itself everytime the scroll frame is moved. However, despite the initial alignment being almost correct the moment the scroll frame is moved the alignment returns back to the non scrollframe way.

Edit: Woot, got it to move and stay inside the frame when it moved. Which works until the scrollframe is moved so that the height I specified to the watch frame means the watchframe has to move outside of the box to stay its height. So it looks like it is ignoring the fact it is in a scroll frame or there is something I am missing from your code Scott.

Edit2: Well, thought I would test it on a character with more than 1 quest to track :D Screenshot 3 is the result. I guess there is more involved in getting the scroll frame to scroll :D But I'm not sure which of the rest of your code is relevant.

spiel2001 12-24-09 01:34 PM

Xrystal --

If you want, zip up the code you have so far and attach it as a message here -- I'll take a look at it and see if I can sort out what's missing and then post it back to you.

Xrystal 12-24-09 01:41 PM

1 Attachment(s)
Okay, here it goes. Pretty simple but just can't fathom that scrolling stuff. My scroll windows in my other addon just used the Slider object but only used it to scroll through lists. I won't be spending much time on this stuff till probably after the new year. My fiance has got some vacation time so its mega Aion levelling time rofl.

Seer 12-25-09 03:40 AM

I think I'm in love... :p:o:D

Xrystal 12-25-09 03:10 PM

2 Attachment(s)
Well, playing with the addon while fiance is at family dinner rofl :D


Well, looks like my scrollframe code isn't totally at fault but how the watchframe is working with it.

After looking at some code on various sites an Edit Box control has frequently been used as a scroll child. My code is identical functionality wise so thought I would try the edit box out to see if it scrolls. And it does.

The downside is that it is somehow too narrow. Barring that though, it looks like I need to find out if the WatchFrame is repeatedly redrawing itself and ignoring any parent frame it is supposed to be working with.

Well, figured out the width thing .. now to figure out why the watchframe won't react the same way.

Xrystal 12-25-09 03:31 PM

3 Attachment(s)
Woot, getting there :D

What I had to do was ignore setting up a scrollchild frame and parenting that to the watch frame but tell the watchframe to be the scrollchild itself. It needs some more work though but definitely an improvement :D

Edit: Okay, maybe not working quite the way I'd hoped :D

Edit 2 : One step nearer.

Frame 1 = Standard Container Frame parented to UIParent
Frame 2 = ScrollFrame parented to Frame1
Frame 3 = WatchFrame parented to Frame2 and set to ScrollChild

Will mean that there is a gap around the watchframe to the container frame but still not properly working as moving the container frame just highlights a different part of the watchframe as if you were scrolling.

Seer 12-25-09 05:36 PM

You really like that wall in the inn don't ya ?

Have you looked how it works out when you have a quest that has an useable thingie in the inventory ?

Oh and;
[chanting]We want beta addon ! We want beta addon ! We want beta addon ! We want beta addon ! :banana::D

(Might be the best nUI plug in evah :banana:, no pressure tho:D)

Xrystal 12-25-09 05:49 PM

Rofl, once it does what it should do at minimum I'll throw it out there for you to test :D

Theory is that once I get it working as a standalone addon I can easily plug it into an infopanel :D

And nope, not got any quests on my lowbies that use items. And those dratted icon thingies on the left keep disappearing on me due to the fact they are positioned outside of the WatchFrame it seems.

But I did manage to add the max of 10 objectives without it kicking up a fuss about space :D So tons of stuff to test the scrolling and display for. Just have to figure out why it refuses to confine its 640 height inside the scroll frame rofl.

I would guess though that the item icons appear on the right hand side as for the life of me I cannot get the writing to fill out rofl. Forgot all about clickable quest item icons on there :D

Marthisdil 12-26-09 07:49 AM

Xrystal - can I have your babies? ;)

Xrystal 12-26-09 08:04 AM

rofl, that would be a bit difficult seeing as I would be the one having babies :P If I wanted to :D rofl

whereswaldo 12-26-09 10:30 AM

And her fiance would probably object

Xrystal 12-26-09 10:51 AM

That too :D

whereswaldo 01-04-10 08:05 AM

Hey, Xrystal. Did you get any farther with this infopanel?? Inquiring minds want to know...

Xrystal 01-04-10 05:00 PM

Not yet, fiance has been on vacation until today and today I had an appointment for a new course then came back and slept for almost 12 hours rofl.

I'll be trying to tackle that and anything else I stumble across over the next week or two, or three rofl.

Xrystal 01-20-10 01:57 PM

4 Attachment(s)
Well, just in case nUI was exacerbating the issue I made a virgin copy of wow and just had this mini objectives frame addon loaded up. Pretty much rewrote the code with a bit of help from the code Scott posted and one I googled and between the two I managed to get it kinda working the way I expected without nUI loaded. The first screen shot shows it working even if dragged to the bottom of the screen it still keeps the position you had scrolled it to instead of autoscrolling as it did before. The only bugbear I have spotted with this version is that it stops moving the scroll bar on the last segment but takes note of how long you scroll with the mouse and it will take that long to scroll back up to where the quests are. Despite the scrollbar not moving at all once it doesn't have anything else to scroll.

Screenshot 2 shows how nUI deals with it. After some fiddling around with where the nUI mover code needs to go and get refreshed everything seems fine until you move the frame to near the dashboard. I suspect the viewport changes in nUI are affecting the UIParent edge for the frame and its confusing things.

Also, I noticed something unrelated but what I was using for testing not working as normal wow does. Look at the micromenu buttons. Even my level 5 characters in virign wow can click on achievements but nUI doesn't let you.

I've added the 2 versions of the addon for people to play around with as they choose. Scott, when you get 5 seconds somewhere in your busy schedule if you can confirm whether my suspicions are correct above the Viewport messing with the frame movement results.

Seer 01-21-10 01:01 AM

Thanks wonderwoman, going to try it out later today :D

spiel2001 01-21-10 05:27 AM

Gee... I wonder.... does she wear that tight fitting outfit too?

Xrystal 01-21-10 05:28 AM

Rofl, if I wore that type of outfit it would be tight .. and not a good sight .. rofl. And even if I was 'fit' to wear it I wouldn't rofl. Heck, even when I had my numerous swimming lessons as youngster I never wore a bikini rofl.

Xrystal 01-21-10 05:36 AM

Oh yeah Scott. I've not figured it out yet but is there a way for me to say temporarily disable the tracker from being controlled by nUI and re-enable it.

If so, perhaps I could disable it on login and enable it on logout. Thus, I could pretty much use my basic addon without the nUI related stuff which is the working model and then if I re-enable it on logout if they later chose to remove the plugin they would be none the wiser *crosses fingers*.

Then of course I could handle it like any other non nUI addon that is placed in an infopanel.

spiel2001 01-21-10 06:23 AM

Well... not really a way to do it on login. But if you don't put your plugin in the table of info panel plugins, nUI will ignore it, or you can just set "enabled" to false which will also cause nUI to ignore it.

nUI processes that table when the VARIABLES_LOADED event fires and when it does, it puts the data into several other tables that are used to control the list of info panels, the rotation order, etc. So in nUI5 there's no way to unwind that... you can only prevent it from happening in the first place.

That said -- if your only interest is in preventing the info panel from being shown or hidden by the rotation button, you can be sneaky about that. In the plugin.initPanel() method, you can skip the call to SetParent( plugin.container ) that you use to have your addon be controlled by the container itself which would prevent the info panel button from being able to show/hide your plugin... but all of the method calls would still be made for things like plugin.setScale() etc.

Xrystal 01-21-10 07:12 AM

Ah, thats not the problem Scott.
The code at present isn't as a plugin but it doesn't work properly if nUI is active. Without nUI it is doing exactly what I want it to do. All I can think of is that the little bit of control that nUI has over the watchframe is messing it up somewhere. So I was wondering if there was a programmatic way I can tell nUI to forget it knows about the watchframe so that my addon will work but in case people change their mind about the addon nUI can recontrol the watchframe as before.

In particular in non nUI you can drag the frame anywhere on the screen and it only changes the display when right at the bottom of the screen as it realises it cannot display all of tracked item 3 due to space limitations. However in nUI that happens when the frame is dragged down only as far as the dashboard.

But then again, it is possible once I infopanel frame it, it won't have that problem. Hmm, yes, think I'll try that later on when I get back from my job searching tasks.

spiel2001 01-21-10 07:29 AM

Ah -- okay -- there are two things that are at play there -- in the [ Interface > AddOns > nUI > Integration > nUI_Minimap.lua ] file (if memory serves me correctly -- I'm at work and can't look) there's a function at the bottom of the file called ResetWatch() or something to that effect. You could stub that function out in your plugin by replacing it with an empty function in your own code.

So if my function is

nUI.ResetWatch = function()

do this;
do that;

end

you would declare the same thing in your plugin...

nUI.ResetWatch = function()
end

That would prevent nUI from modifying the object frame itself (size, location, etc.). The other thing you would have to do is to unlock the frame using the nUI_Movers function. I believe the appropriate place for that would be in the plugin's init method.

Marthisdil 01-21-10 09:44 AM

Quote:

Originally Posted by Xrystal (Post 175437)
Ah, thats not the problem Scott.
The code at present isn't as a plugin but it doesn't work properly if nUI is active. Without nUI it is doing exactly what I want it to do. All I can think of is that the little bit of control that nUI has over the watchframe is messing it up somewhere. So I was wondering if there was a programmatic way I can tell nUI to forget it knows about the watchframe so that my addon will work but in case people change their mind about the addon nUI can recontrol the watchframe as before.

In particular in non nUI you can drag the frame anywhere on the screen and it only changes the display when right at the bottom of the screen as it realises it cannot display all of tracked item 3 due to space limitations. However in nUI that happens when the frame is dragged down only as far as the dashboard.

But then again, it is possible once I infopanel frame it, it won't have that problem. Hmm, yes, think I'll try that later on when I get back from my job searching tasks.

<3 Xrystal

What sorta job you looking for and in what area? I have a few contacts across the US I can maybe give you info on.

Xrystal 01-21-10 12:00 PM

Rofl, well Im in the UK so that wouldn't work rofl. Although once my fiance gets his act together and gets filling in that immigration paperwork hopefully at some point in the *near* future I'll be looking for work there. Near seems to be lasting for the last 4 years rofl.

Chmee 01-21-10 12:23 PM

Quote:

Originally Posted by Xrystal (Post 175425)
Rofl, if I wore that type of outfit it would be tight .. and not a good sight .. rofl. And even if I was 'fit' to wear it I wouldn't rofl. Heck, even when I had my numerous swimming lessons as youngster I never wore a bikini rofl.

You had lessons? My mother just threw me in the deep end of the pool.:eek:

Xrystal 01-21-10 12:31 PM

Quote:

Originally Posted by Chmee (Post 175477)
You had lessons? My mother just threw me in the deep end of the pool.:eek:

rofl, even funnier is that I still can't swim. Think the near drowning at the seaside when I was very little has made me subconciously scared of large expanses of water. Hmm,,, thats why I like Colorado so much :D

Xrystal 01-21-10 12:40 PM

3 Attachment(s)
Well this helped somewhat. It still doesn't want to hide the watchframe completely in my window though for some reason but at least it is scrolling through the list. Although the scrolling still needs work. Rofl.

If you notice in one of the screenshots the frame has been moved to the bottom of the screen. Instead of keeping the contents as they were it has moved down the list being tracked as if the frame is just a window of the real frame that is static.

Oh well, I'm sure I'll get there eventually rofl.

Quote:

Originally Posted by spiel2001 (Post 175441)
Ah -- okay -- there are two things that are at play there -- in the [ Interface > AddOns > nUI > Integration > nUI_Minimap.lua ] file (if memory serves me correctly -- I'm at work and can't look) there's a function at the bottom of the file called ResetWatch() or something to that effect. You could stub that function out in your plugin by replacing it with an empty function in your own code.

So if my function is

nUI.ResetWatch = function()

do this;
do that;

end

you would declare the same thing in your plugin...

nUI.ResetWatch = function()
end

That would prevent nUI from modifying the object frame itself (size, location, etc.). The other thing you would have to do is to unlock the frame using the nUI_Movers function. I believe the appropriate place for that would be in the plugin's init method.


Xrystal 01-22-10 07:44 AM

2 Attachment(s)
Okay, incorporated the almost working scrollable quest watch frame into the infopanel system but unfortunately it isn't working the way I had planned.

As you can see it still is refusing to confine its display to the container frame but instead just doesn't display the text until the container frame is moved over it.

spiel2001 01-22-10 08:09 AM

The first of those two images looks basically right to me except that the top is cut off... I can't tell if that's because it's not scrolled all the way up, or if the top of the objective frame is higher than the top of the container.

If it's the latter, then how are you anchoring the quest frame to the scroll frame? It should have the top left anchored to the top left.

Xrystal 01-22-10 08:38 AM

Thats what I can't figure out.

I am anchoring the TOPLEFT to TOPLEFT and so it should show the top of the quest tracker as I haven't scrolled it at all. However, it seems to think that it is at the end which you can see is caused by the fact that despite parenting the watchframe to the scrollchild it isn't restricting the display. Moving the frame around as you can see from the 2nd screenshot will just highlight the elements of the list that would appear at that position as if the bottom of the watchframe is anchored to the bottom of the UIParent. Changing the value of the WatchFrame height affects how far down the screen it shows but it defeats the object of being able to have it as long as you like, just visibly showing what the frame has been told to show.

However, without nUI it doesn't seem to do that, although there are some other things that are not working right that aren't a problem with nUI. Go figure.

Xrystal 01-22-10 08:51 AM

4 Attachment(s)
okay, here are some more screenshots of the frame without the infopanel system. I moved the frame around without scrolling so that you can see the effect moving has. Instead of keeping the top of the list on display, which should be the case if I haven't scrolled anything, it decides to show me another part of the list.

I thought at first that resetting the WatchFrame on moving but that would defeat the object of the scrolling as it would just reset it to the top everytime.

spiel2001 01-22-10 10:00 AM

Have you unlocked the quest frame using the nUI_Movers method call *before* you try to re-anchor it?? Otherwise, it's not anchoring the way you think it is.

Xrystal 01-22-10 10:12 AM

Yep. And generally the code is identical but I have been fiddling with both so now theyre out of synch again. So I'm gonna go and re-synch them, double check the results in game then post, both lua files ( without the infopanel attachment lua ). In essence they should work identically but it seems theyre not. I'll get back to you shortly.

Xrystal 01-22-10 10:38 AM

Aha, interesting. The problem I still get without nUI loaded is that it tries to scroll past the end of the list of tracked items ( I assume to get to the bottom of the watchframe ) but the list itself doesn't move, but the scrollbox does. And then, because this isn't working right it then goes and disconnects the watchframe from the moveable scrollframe and until I scroll back to the last tracked item it acts like the nUI added version.

Edit: Another problem is when it reaches the bottom of the screen it decides to all of a sudden reset its positioning to the top of the list. But this could be due to the running out of space and the watchframe running some other code to arrange what gets displayed... hmm... wonder if there are other functions being called. Will have to look into that.

Edit2: Ah, testing with and without nUI and the problems are similar, just happens in different ways. In essence it forgets somewhere that it doesn't belong to UIParent. So, it sounds like under certain circumstances it is reparenting back until I do something to get its attention back again. Will take a look at what watchframe.lua does again in case there are some more events and functions that are triggering the reset and tell it to reset mine at the same time. May have to store current position in scrolling list if that is the case so that it is unnoticeable.

Here's the code anyway. It should work with or without nUI as I am testing for it before using the nUI commands.

Code:

local ObjectivesBackdrop = {                       
        bgFile = "Interface/Tooltips/UI-Tooltip-Background",
    edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
    tile = true,
    tileSize = 16,
    edgeSize = 16,
    insets = { left = 4, right = 4, top = 4, bottom = 4 }
};                     

local ObjectivesBackcolor = {
          red=0,green=0,blue=0,alpha=1
};

local ObjectivesBordercolor = {
          red=255,green=255,blue=0,alpha=1
};

local WatchFrameScrollFrame;
local nUI_Loaded = false;

local function ResetWatchFrame(parent)
       
        if ( nUI_Loaded ) then
                nUI_Movers:lockFrame( WatchFrame, false, nil ); -- OBJECTIVES_TRACKER_LABEL );
                nUI_Options.movedWatchFrame = true;
        end

        WatchFrame.moving = true;
        WatchFrame.sizing = true;
       
        WatchFrame:SetMovable( true );
        WatchFrame:SetResizable( true );
        WatchFrame:StartMoving();
        WatchFrame:StartSizing( "TOPLEFT" );
       
        WatchFrame:ClearAllPoints();
        WatchFrame:SetParent(parent);
        WatchFrame:SetHeight( 500 );
        WatchFrame:SetWidth( parent:GetWidth() );
        WatchFrame:SetPoint( "TOPLEFT", parent, "TOPLEFT", 30,-10 );
        WatchFrame:SetPoint( "TOPRIGHT", parent, "TOPRIGHT", -35, -10);

        WatchFrame.moving = nil;
        WatchFrame.sizing = nil;

        WATCHFRAME_IGNORECURSOR = "1";                       
        WATCHFRAME_LASTWIDTH    = WatchFrame:GetWidth() ;
       
        WatchFrame:StopMovingOrSizing();
        WatchFrame:SetUserPlaced( true );
        WatchFrame_Expand( WatchFrame );

        if ( nUI_Loaded ) then
                nUI_Movers:lockFrame( WatchFrame, true, nil );
        end
end

-- Frame is moving
local function OnMouseDown(self)
        if ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) then
        self:StartMoving();
        self.isMoving = true;
        end
end

-- Frame has stopped moving
local function OnMouseUp(self)
        if ( self.isMoving ) then
                self:StopMovingOrSizing();
                self.isMoving = false;
        end
end

-- Frame has been hidden
local function OnHide(self)
        if ( self.isMoving ) then
                self:StopMovingOrSizing();
                self.isMoving = false;
        end
end

local function CreateScrollFrame()
       
        local f = CreateFrame( "Frame", "WatchFrame_Container",UIParent);
        f:SetWidth(400);
        f:SetHeight(200);
        f:SetClampedToScreen(true);
        f:SetFrameStrata("HIGH");
        f:SetPoint("CENTER",UIParent,"CENTER",0,0);
        f:SetBackdrop(ObjectivesBackdrop);
        f:SetBackdropColor(ObjectivesBackcolor.red,ObjectivesBackcolor.green,ObjectivesBackcolor.blue, ObjectivesBackcolor.alpha);
        f:SetBackdropBorderColor(ObjectivesBordercolor.red, ObjectivesBordercolor.green,ObjectivesBordercolor.blue, ObjectivesBordercolor.alpha);
        f:RegisterForDrag("LeftButton");
        f:EnableMouse(true);
        f:SetMovable(true);
        f:SetScript("OnMouseDown",OnMouseDown);
        f:SetScript("OnMouseUp",OnMouseUp);
        f:SetScript("OnHide",OnHide);

        local s = CreateFrame( "ScrollFrame", "WatchFrame_ScrollFrame", f, "UIPanelScrollFrameTemplate" );
        s:SetPoint("TOPLEFT", 5, -5);
        s:SetPoint("BOTTOMRIGHT", -30, 5);
        f.Scroll = s;
       
        local c = CreateFrame("Frame","WatchFrame_ScrollChild",s);
        s:SetScrollChild(c);
        c:SetWidth(2);
        c:SetHeight(2);
        c:SetAllPoints(s);
        f.Child = c;
               
        return f;
end

local plugin    = CreateFrame( "Frame", "Mini_ObjectiveFrame", UIParent );

local function onEvent()
        if event == "VARIABLES_LOADED" then               
                WatchFrameScrollFrame = CreateScrollFrame();
                ResetWatchFrame(WatchFrameScrollFrame.Child);
                if ( nUI_Loaded ) then
                        nUI_ResetWatchFrame = function() end;
                end
                WatchFrame.ClearAllPoints = function() end
                WatchFrame.SetPoint = function() end
                WatchFrame.SetAllPoints = function() end               
        elseif event == "ADDON_LOADED" then
                nUI_Loaded = false;
                if ( arg1 == "nUI" ) then
                        nUI_Loaded = true;
                        plugin:UnregisterEvent( "ADDON_LOADED" );
                end
        end       
end
plugin:SetScript( "OnEvent", onEvent );
plugin:RegisterEvent( "VARIABLES_LOADED" );
plugin:RegisterEvent( "ADDON_LOADED" );


spiel2001 01-22-10 11:26 AM

The first thing that jumps out at me is you are setting the size of the scroll child frame (s) to 2x2 and then using that to parent the watch frame... which sets its width to the scroll child width... which is 2.

I would suggest that WatchFrame should *be* the scroll child, actually.

I would unlock the WatchFrame as the first thing I do in setting all of this up. Then I would *not* lock it back down again.

So, in CreateScrollFrame I would...

Unlock the watch frame
Create the container frame
Create the scroll frame
Set the watch frame as the scroll child
Reset the watch frame

done

Xrystal 01-22-10 11:31 AM

I did try that way and it worked worse than it is now but I'll try it again. The width on the scroll child gets altered later as it gets filled out to be the same size as the parent frame.

spiel2001 01-22-10 11:36 AM

If you want, you can ZIP up your plugin in whatever state it is in when you stop tonight (it's, what, 5:30 your time, right?) and e-mail it to me at [email protected] and I'll look at it either tonight or tomorrow morning and see if I can get it working.

Xrystal 01-22-10 11:43 AM

Okay, the good news is it seems to be working consistently with the following code changed regardless as to whether nUI is loaded or not. However, it still is adamant about sitting in the background as if it is still owned by UIParent.

Thanks for that Scott. I'm gonna spend some time reading through WatchFrame again and see if it is trying to do something else with it based on an event and see if I can trap it happening and stop it. The rest of the code is the same as before.

Code:

local function CreateScrollFrame()
       
        if ( nUI_Loaded ) then
                nUI_Movers:lockFrame( WatchFrame, false, nil ); -- OBJECTIVES_TRACKER_LABEL );
        end

        local f = CreateFrame( "Frame", "WatchFrame_Container",UIParent);
        f:SetWidth(400);
        f:SetHeight(200);
        f:SetClampedToScreen(true);
        f:SetFrameStrata("HIGH");
        f:SetPoint("CENTER",UIParent,"CENTER",0,0);
        f:SetBackdrop(ObjectivesBackdrop);
        f:SetBackdropColor(ObjectivesBackcolor.red,ObjectivesBackcolor.green,ObjectivesBackcolor.blue, ObjectivesBackcolor.alpha);
        f:SetBackdropBorderColor(ObjectivesBordercolor.red, ObjectivesBordercolor.green,ObjectivesBordercolor.blue, ObjectivesBordercolor.alpha);
        f:RegisterForDrag("LeftButton");
        f:EnableMouse(true);
        f:SetMovable(true);
        f:SetScript("OnMouseDown",OnMouseDown);
        f:SetScript("OnMouseUp",OnMouseUp);
        f:SetScript("OnHide",OnHide);

        local s = CreateFrame( "ScrollFrame", "WatchFrame_ScrollFrame", f, "UIPanelScrollFrameTemplate" );
        s:SetPoint("TOPLEFT", 5, -5);
        s:SetPoint("BOTTOMRIGHT", -30, 5);
        f.Scroll = s;
       
        s:SetScrollChild(WatchFrame);
        f.Child = WatchFrame;
        ResetWatchFrame(s);
       
        if ( nUI_Loaded ) then
                nUI_ResetWatchFrame = function() end;
        end
        WatchFrame.ClearAllPoints = function() end
        WatchFrame.SetPoint = function() end
        WatchFrame.SetAllPoints = function() end               

        --[[
        local c = CreateFrame("Frame","WatchFrame_ScrollChild",s);
        s:SetScrollChild(c);
        c:SetWidth(2);
        c:SetHeight(2);
        c:SetAllPoints(s);
        f.Child = c;
        --]]
               
        return f;
end

local plugin    = CreateFrame( "Frame", "Mini_ObjectiveFrame", UIParent );

local function onEvent()
        if event == "VARIABLES_LOADED" then               
                WatchFrameScrollFrame = CreateScrollFrame();
                --ResetWatchFrame(WatchFrameScrollFrame.Child);
        elseif event == "ADDON_LOADED" then
                nUI_Loaded = false;
                if ( arg1 == "nUI" ) then
                        nUI_Loaded = true;
                        plugin:UnregisterEvent( "ADDON_LOADED" );
                end
        end       
end


spiel2001 01-22-10 11:59 AM

One thing I see is this...

Code:

    if ( nUI_Loaded ) then
        nUI_ResetWatchFrame = function() end;
    end

I would recommend that you actually move that outside of all of your functions and lose the test... it won't hurt anything to do it if nUI isn't loaded. The problem is your "Create" method doesn't get called until the VARIABLES_LOADED event fires at which point nUI has already taken control of the WatchFrame.

Just put this at the top of your source file...

Code:

nUI_ResetWatchFrame = function() end;

If nUI isn't loaded, it hurts nothing. If it is loaded, and you have marked your addon as dependent on nUI, your code won't load until nUI's code has already been loaded, but *before* it is executed, in which case your function will replace nUI's function and keep it from being executed and thus keep nUI from fiddling with the watch frame.

Marthisdil 01-22-10 12:08 PM

Quote:

Originally Posted by spiel2001 (Post 175647)
One thing I see is this...

Code:

    if ( nUI_Loaded ) then
        nUI_ResetWatchFrame = function() end;
    end

I would recommend that you actually move that outside of all of your functions and lose the test... it won't hurt anything to do it if nUI isn't loaded. The problem is your "Create" method doesn't get called until the VARIABLES_LOADED event fires at which point nUI has already taken control of the WatchFrame.

Just put this at the top of your source file...

Code:

nUI_ResetWatchFrame = function() end;

If nUI isn't loaded, it hurts nothing. If it is loaded, and you have marked your addon as dependent on nUI, your code won't load until nUI's code has already been loaded, but *before* it is executed, in which case your function will replace nUI's function and keep it from being executed and thus keep nUI from fiddling with the watch frame.

If nothing else, I'm learning a lil bit about frames and lua here

I <3 you guys!

spiel2001 01-22-10 12:23 PM

FYI -- I moved this from plugin support to developer chat since it's really more code/design/testing centric than actual support for a plugin.

Xrystal 01-22-10 02:02 PM

I've already mailed you the copy of the files at its best functionality so far but I did just try this suggestion and if I place that code with or without the test above all my functions the scrolling stops working completely. Only where it is currently does the scrolling work.

Ah, nUI loads up after my addon does and so it replaces my fake function with its real one. Okay, after some debugging it looks like the earliest spot I can put it is when ADDON_LOADED for nUI is actioned. At that point the function has been defined and I negate it. Clearing it before its created gets ignored as it creates it when nUI is loaded anyway.

Ah, sudden burst of inspiration, if my addon is loaded before nUI ( the non infopanel version anyway as it seems to be alphabetical ), perhaps if I store the WatchFrame values before nUI changes them then restore them afterwards then do what I want. Although I doubt that will work as the same problem occurs without nUI installed now so will come back to this idea when I am left with nUI being loaded as a problem and see if that resolves it.

Quote:

Originally Posted by spiel2001 (Post 175647)
One thing I see is this...

Code:

    if ( nUI_Loaded ) then
        nUI_ResetWatchFrame = function() end;
    end

I would recommend that you actually move that outside of all of your functions and lose the test... it won't hurt anything to do it if nUI isn't loaded. The problem is your "Create" method doesn't get called until the VARIABLES_LOADED event fires at which point nUI has already taken control of the WatchFrame.

Just put this at the top of your source file...

Code:

nUI_ResetWatchFrame = function() end;

If nUI isn't loaded, it hurts nothing. If it is loaded, and you have marked your addon as dependent on nUI, your code won't load until nUI's code has already been loaded, but *before* it is executed, in which case your function will replace nUI's function and keep it from being executed and thus keep nUI from fiddling with the watch frame.



All times are GMT -6. The time now is 04:35 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI