Thread Rating:
  • 7 Vote(s) - 2.71 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SafeComboBox override
#1
How do I change the value of a variable is they are set to a SafeComboBox?

For example.

I wish to set gAssistMode setting via my own GUI , my GUI reflect the settings as selected in the Assist Window, but I can not set the value via my GUI.
Inside ffxiv_task_assist.lua I can see the value is saved via a SafeComboBox function call.

How can I override this ? Without having to modify the task file itself...

Code:
gAssistMode = ffxivminion.SafeComboBox(Settings.FFXIVMINION.gAssistMode,gAssistMode_listitems,GetString("none"))


Code:
function ffxivminion.SafeComboBox(var,varlist,default)
    local outputVar = var
    local found = false
    for k in StringSplit(varlist,",") do
        if k == var then
            found = true
        end
        if (found) then
            break
        end
    end
    
    if (not found) then
        outputVar = default
    end
    
    return outputVar
end


Here is my function attempting to set the value, I was trying different methods to try and force it.
Code:
GUI:AlignFirstTextHeightToWidgets()
                GUI:TextColored(1,1,1,200,string.pad(gAssistMode,5));

                --===============================================================
                -- START ASSIST MODE SELECTION POP UP
                --===============================================================

                if (GUI:IsItemHovered()) then
                    GUI:SetTooltip("Assist Modes")
                end
            
                if ( GUI:IsItemHovered() and GUI:IsMouseDoubleClicked(0) ) then
                    GUI:OpenPopup("AssistMode")
                end                    
           
                if (GUI:BeginPopup("AssistMode")) then
                                                            
                    for i,e in pairs(mygui.assistmodes) do
                        if (GUI:Selectable(mygui.assistmodes[i],false)) then
                            AssistMode = tostring(mygui.assistmodes[i])
                            --Settings.FFXIVMINION.gAssistMode = GetString(AssistMode)
                            --gAssistMode = ffxivminion.SafeComboBox(Settings.FFXIVMINION.gAssistMode,gAssistMode_listitems,GetString(AssistMode))
                            gAssistMode = AssistMode
                        end
                    end
                    GUI:EndPopup()
                end
Reply
#2
The SafeComboBox just pulls the initial value.

I don't really understand the context of what you're doing well enough to offer a fix.
Setting gAssistMode to whatever AssistMode is, should change the value, but if you are attempting to change it to a value that is not in our normal list, then you will have some issues with that.
Reply
 


Forum Jump:


Users browsing this thread: 1 Guest(s)

We help you win the game.

FFXIV Bot and More.

 

Products