WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   How to lock EditBox so it doesn't accept input? (https://www.wowinterface.com/forums/showthread.php?t=27224)

MigGat 09-10-09 08:17 AM

How to lock EditBox so it doesn't accept input?
 
Hi all,

Basically it's most on the thread's title. I've a checkbox on my addon config frame that should lock the editboxes on that frame so that user can't edit them accidentally (what happen to me a lot during test :P)

Thanks

Layrajha 09-10-09 09:02 AM

I would think that using this method could do what you want:
Quote:

Frame:EnableMouse(enableFlag) - Set whether this frame will get mouse input
(http://www.wowwiki.com/Widget_API)

Edit:
I cannot remember (or test right now) if clicking a checkbox removes focus from a currently focused editbox. If not, you would have to add some code for that too, I guess.

MigGat 09-10-09 09:12 AM

Thanks that worked!

Here's the code in case someone might need it:

Code:

function chlAYLock_OnClick()
        if chlAYLock:GetChecked() == nil then
                -- Unlock text fields
                edbAYAutomessage:EnableKeyboard(true);
                edbAYInstance:EnableKeyboard(true);
                edbAYKeywords:EnableKeyboard(true);
                edbAYAnwer:EnableKeyboard(true);
        else
                -- lock text fields
                edbAYAutomessage:EnableKeyboard(false);
                edbAYInstance:EnableKeyboard(false);
                edbAYKeywords:EnableKeyboard(false);
                edbAYAnwer:EnableKeyboard(false);
        end
end



All times are GMT -6. The time now is 06:24 PM.

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