MMOMinion
UI fields not updating with new values. - Printable Version

+- MMOMinion (https://www.mmominion.com)
+-- Forum: FFXIVMinion (https://www.mmominion.com/forumdisplay.php?fid=87)
+--- Forum: [DOWNLOADS] Addons, Lua Modules, Navigation Meshes.. (https://www.mmominion.com/forumdisplay.php?fid=90)
+---- Forum: I Need Help with LUA coding! (https://www.mmominion.com/forumdisplay.php?fid=104)
+---- Thread: UI fields not updating with new values. (/showthread.php?tid=8042)



UI fields not updating with new values. - 5minqq - 06-19-2014

Trying to learn how to write scripts for mmominion, and I am having trouble interacting with the ui

Code:
fiveminqq={ }

-- module settings
fiveminqq.mainwindow = { name="5minqq", x=550, y=100, w=200, h=280 }
fiveminqq.tickRate = 2000

-- init & ui
function fiveminqq.ModuleInit()
    GUI_NewWindow(fiveminqq.mainwindow.name,fiveminqq.mainwindow.x,fiveminqq.mainwindow.y,fiveminqq.mainwindow.w,fiveminqq.mainwindow.h)

    GUI_NewField(fiveminqq.mainwindow.name,"Target:","fiTargetName")    
end

-- main loop
fiveminqq.lastTick = 0
fiveminqq.lastKnownTarget = ""

function fiveminqq.OnUpdateHandler( Event, ticks )

    if (ticks - fiveminqq.lastTick > fiveminqq.tickRate) then
        fiveminqq.lasttick = ticks

        -- monitior target
        local mytarget = Player:GetTarget()
        if(mytarget) then
            if(mytarget.name ~= fiveminqq.lastKnownTarget) then
                d("[Last known target: " .. fiveminqq.lastKnownTarget .. "] [New target: " .. mytarget.name .. "]")
                fiveminqq.lastKnownTarget = mytarget.name;
                fiTargetName = mytarget.name; -- why does this not update the gui field???
            end
        end

    end
end

-- subscriptions
RegisterEventHandler("Module.Initalize",fiveminqq.ModuleInit)
RegisterEventHandler("Gameloop.Update",fiveminqq.OnUpdateHandler)

the values and behaviour is correct when i am looking at the console, but the ui never updates, what am I doing wrong?


RE: UI fields not updating with new values. - devek - 06-19-2014

It's a known bug, you need to put it in a group and the wiki needs to be updated. I feel ya, I banged my head against this for awhile too lol.

http://mmominion.com/Thread-GUI-NewField-BUG


RE: UI fields not updating with new values. - 5minqq - 06-19-2014

Gahhhhhh........... I want my brain power back Devil

thanks for speeding up the debug process devek,
much appreciated.