1. #1

    problems with draggable frames

    Just asking for some input.

    Atm in live my ui is built around a default layout for healer/dps which is toggled with a boolean. In addions, the frames are made draggable through methods which activate/deactivate the functionality with slash commands. And everything is fine.

    In beta i'm having this issue: the boolean still works, and also the draggable frames. What's bugging me is the fact that when you first load the UI, the frames set up as draggable will "remember" their position on screen, so changing the boolean won't update the position of the frames.

    I tried to make some more advanced methotds to "reset" the frame positions, but the only thing working is to delete the WTF (and thus the player variabes) or to make these frames not draggable.

    Any help is appreciated - the UI still works and is good and usable as-is, but making draggable farmes "work" again would be really cool.
    Non ti fidar di me se il cuor ti manca.

  2. #2
    Deleted
    Where does the position get saved? SavedVariables or layout-local.txt? Layout-local.txt is taken when frame movement is done by IsUserPlaced().

    If you are using SavedVariables make sure to load the SetPoint data on PLAYER_LOGIN event. VARIABLES_LOADED etc is not reliable.

  3. #3
    Lol zork coming in help not only on WoWI :P

    anyway, i'm using frame:SetMovable(true) / frame:SetUserPlaced(true), so i think they're going into layout-local.txt

    Probably i will need to set up an anchor system parenting the frames instead of using the frames directly.
    Non ti fidar di me se il cuor ti manca.

  4. #4
    Deleted
    Quote Originally Posted by zorker View Post
    If you are using SavedVariables make sure to load the SetPoint data on PLAYER_LOGIN event. VARIABLES_LOADED etc is not reliable.
    Why don't you simply use ADDON_LOADED with arg1 equal to your folder name? That indicates all your addon's files (this includes the SV lua files) have been executed.

    OT: You probably want to switch to SavedVariables as long as you don't fancy having two separate sets of frames (one for DPS, one for healers, with different names, and only one set being shown).

  5. #5
    That's exactly what i was thinking. I think the "mess" is done by the SetUserPlaced() since it's this function that actually stores the frame positions in the .txt file and overrides all the code. It will take some work

    Need some input: is it a bad approach to refer all the frames via a (X;Y) system in which the origin is "CENTER", UIParent, "CENTER"? I think i can store the coordinates in the already built db (i use it for other options). Anyway i think i'll need to do also a couple of methods for "switching" layout - by this i mean a sort of /heal that clears the positions db and sets the new coordinates to the standard ones. I need some tips if there are already built-in methods for getting coordinates of a frame.

    EDIT: atm, i use the same frame and through a boolean i switch some options on the frames and their SetPoint(). I always had the idea in my mind that what i was doing now wasnì't completely correct - and this issue explains my initial doubts.
    Last edited by Coldkil; 2012-07-30 at 05:26 PM.
    Non ti fidar di me se il cuor ti manca.

  6. #6
    Deleted
    If you use :StartMoving() on OnMouseDown and :StopMovingOrSizing() on OnMouseUp, this sets a single point for the frame depending on which part of the screen it is in. You can :GetPoint() this point, then save it in your DB (after :StopMovingOrSizing() in the OnMouseUp) and :SetPoint() it on your frame (from the DB) on ADDON_LOADED with arg1 equal your addon's folder name.

    That way, when switching layout, you only need to :ClearAllPoints(), then :SetPoint() with the point from the other layout's DB.

  7. #7
    Sounds good - i'm going to give it a try as soon as i fix my PC problems

    thanks Treeston.
    Non ti fidar di me se il cuor ti manca.

  8. #8
    Deleted
    When using layout-local.txt rewriting the the SetPoint on any given event will rewrite the SetPoint saved in the layout-local.txt.

    So...to reset the values saved in the layout-local.txt just load new values from the SavedVariables (or whereever) in the PLAYER_LOGIN event.
    If you do not want to reset the layout-local.txt values use the SetPoint directly. (Make sure the frame that uses it is created right away and not after any event)

    More...http://www.wowinterface.com/forums/s...ad.php?t=38484
    Last edited by mmoc48efa32b91; 2012-07-31 at 10:17 PM.

  9. #9
    Deleted
    I'm still not sure whether using layout-local (SetUserPlaced) at all is a good idea. It works fine for small things where people can't be bothered to write full SV framework around it. But the way I see it, it's just annoying once you do anything apart from a single panel showing stuff - just use SVs.

    Calling :SetUserPlaced(false) should remove the frame from the layout-local.txt completely - emphasis on should, I'm not sure on the exact behavior. But as long as you overwrite the layout-local point on ADDON_LOADED, it shouldn't matter either way.

  10. #10
    The code i'm using for applying drag functions to the frames is a little different, but i think both ways are doable. I'm linking 2 pastebin of the code i made for dragging frames - judge it, break it, whatever but say what you think it would be the best way to implement the functionality again. If you need more code, just ask.

    lib.dragalize(frame) to apply the style/function and to get tracked of the frame in the saved variables http://pastebin.com/38qq3U7J

    dragframes.lua the real code that manages the frames with slash commands http://pastebin.com/YtBQ1Lbb
    Non ti fidar di me se il cuor ti manca.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •