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.


All times are GMT -6. The time now is 01:40 PM.

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