+ Reply to Thread
Results 1 to 7 of 7

Thread: BUG/Problem with UIParrent:Getbound

  1. #1
    Shadowlander
    Join Date
    Feb 2011
    Posts
    40

    Default BUG/Problem with UIParrent:Getbound

    I have set global ui scale to 80 and using windowed mode
    Putting this to addon:

    local leftc, topc, rightc, bottomc = UIParent:GetBounds()
    -- print out the bounds --
    print("Left: " .. tostring(leftc))
    print("Top: " .. tostring(topc))
    print("Right: " .. tostring(rightc))
    print("Bottom: " .. tostring(bottomc))

    [Test] Left: 0
    [Test] Top: 0
    [Test] Right: 1925.5216064453
    [Test] Bottom: 1024

    After entering world and and after using reloadui getting the correct values:

    [Test] Left: 0
    [Test] Top: 0
    [Test] Right: 2397.5002441406
    [Test] Bottom: 1275.0001220703


    I think the problem is first addons get loaded without the uiscale,the getbound get fired here
    then when entering world happen is getting the ui scale affected(as seeing the resize happen here)

    This is in a library which making window element restricted to move out from the ui, but because this happen to restriction get to the lover size on the load.

  2. #2
    General of Telara
    Join Date
    Mar 2014
    Posts
    967

    Default

    If you execute that in the loading process of your addon, that's not too suprising, a lot of things are not available yet at that point.

    No idea if it works, but did you try attaching an event handler for Event.UI.Layout.Size to UIParent?

    If that doesn't fire, I'd try other loading related events, like Event.Addon.Load.End (might still be too early) or the first Event.Unit.Availability.Full for "player" (happens after every loading screen from waht I can tell).

  3. #3
    Shadowlander
    Join Date
    Feb 2011
    Posts
    40

    Default

    nothing works at this time, it get limited to bad ui size, because resize happen after addon laoded, and window position corrected to less metrics

  4. #4
    General of Telara
    Join Date
    Mar 2014
    Posts
    967

    Default

    Quote Originally Posted by Gorduin View Post
    nothing works at this time, it get limited to bad ui size, because resize happen after addon laoded, and window position corrected to less metrics
    Maybe I wasn't clear enough, I meant to get the UI size *after* the loading process. The purpose of a loading phase is to make things available, so you can't expect everything to be available until it has finished.
    That's why various events exist, to get informed when new information becomes available (or changes).

    It's only a bug when "/script dump(UIParent:GetBounds())" gives the wrong values unless you do "/reloadui", or if events don't trigger. In windowed mode, the window may be resized anyway, so you can't just get the size once and be done.

    Hence my suggestion to try something like:
    Code:
    function myCallback()
        -- do whatever you need with UIParent:GetBounds())
    end
    
    UIParent:EventAttach(Event.UI.Layout.Size, myCallback, "My UI Size Handler")

  5. #5
    Shadowlander
    Join Date
    Feb 2011
    Posts
    40

    Default

    nope i not found a way


    addon stores windows position in saved variables

    trough when wariables loading is checking is out of screen of not
    because getting bad data back its changing x and y coordinate to be inside in ui parent

    now happen the resize the window already in bad postion, you have the new coordinates alrady even you fire the event at next resize

    and you dont have imnformation resize happened, because ui scale getting set later or user changed the size

    The problem is ui scale get seeting after addons loaded not before as i posted

    you can watch thi easy
    set the global ui scale 80%
    At the start global ui scale 100% loading all addons up
    Then you see trough entering world- it get resized loading scrren picture get the correct ui scale now.

    you can check it , download nkcartographer addon use it
    set the global ui scale
    set the map full bottom
    log out and log in, and map get moved up

    ps:window management in enkai library

  6. #6
    General of Telara
    Join Date
    Mar 2014
    Posts
    967

    Default

    Quote Originally Posted by Gorduin View Post
    addon stores windows position in saved variables

    trough when wariables loading is checking is out of screen of not
    because getting bad data back its changing x and y coordinate to be inside in ui parent
    Well this a conceptual problem then, you just cannot validate against data only once that is subject to change.

    Quote Originally Posted by Gorduin View Post
    The problem is ui scale get seeting after addons loaded not before as i posted

    you can watch thi easy
    set the global ui scale 80%
    At the start global ui scale 100% loading all addons up
    Then you see trough entering world- it get resized loading scrren picture get the correct ui scale now.
    Yes I just tried it, as this is a per-character setting (didn't know that), it gets loaded as one of the last things, even after the "player" unit is reported as fully available. It does trigger resize events, although it adjusts X and Y in separate events for whatever reason. Anyway, I assume there's good reasons why things are loaded in the order they are, so again, the concept of the addon(-library) just doesn't fit well.

    It'd probably be better to not just overwrite the saved data when the window position is offscreen at any point in time, but keep the saved position and just position the window within bounds and re-check the limits on every resize event.
    That way you can adjust your UI settings as much as you want without messing up your saved setting until they are saved again (at logout or /reloadui).

  7. #7
    Shadowlander
    Join Date
    Feb 2011
    Posts
    40

    Default

    you not knonw in library its from saved data etc -if window got manage to not get out from uiparent then you find this problem

    atm i can only disable the check really , why i posted it
    hoping trion make something sometime with i -- sample when they addad separate resize to bags
    Sample for me still problem the chatwindows is part of globalui resize and maxfontsize is limited to 20
    chatwindows the only what you cant resize in event layout separately
    Last edited by Gorduin; 08-07-2015 at 12:41 AM.

+ Reply to Thread

Bookmarks

Posting Permissions

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