Thread Tools Display Modes
09-10-09, 08:17 AM   #1
MigGat
A Fallenroot Satyr
Join Date: Sep 2009
Posts: 27
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

Last edited by MigGat : 09-10-09 at 08:34 AM.
  Reply With Quote
09-10-09, 09:02 AM   #2
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
I would think that using this method could do what you want:
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.
  Reply With Quote
09-10-09, 09:12 AM   #3
MigGat
A Fallenroot Satyr
Join Date: Sep 2009
Posts: 27
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
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » How to lock EditBox so it doesn't accept input?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off