Thread Tools Display Modes
05-20-10, 10:29 AM   #1
Lilithurian
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 10
Enable tabbing between editboxes?

I'm developing an add-on that has several editboxes to gather input. They work fine, the only thing I can't do is tab from one editbox to the next editbox. I've been checking the reference for editboxes but can't seem to find anything useful.

Here's how the add-on looks:
http://www.loretorfs.be/thesis/addon...e-addon-v0-02/

Does it have anything to do with layering or positioning, or is it just a value that I forgot to add?

Thanks,
  Reply With Quote
05-20-10, 01:00 PM   #2
lilsparky
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 117
Originally Posted by Lilithurian View Post
I'm developing an add-on that has several editboxes to gather input. They work fine, the only thing I can't do is tab from one editbox to the next editbox. I've been checking the reference for editboxes but can't seem to find anything useful.

Here's how the add-on looks:
http://www.loretorfs.be/thesis/addon...e-addon-v0-02/

Does it have anything to do with layering or positioning, or is it just a value that I forgot to add?

Thanks,
i don't think that's built-in to edit boxes. there is a "tab entered" event that edit boxes get, but beyond that i think you must handle the focus change yourself.

just have each editbox point to the next edit box in the tab list (editBox1.next = editBox2) and then when you get a tab event, just set focus for the editBox.next field.
  Reply With Quote
05-20-10, 01:21 PM   #3
Fodaro
A Cyclonian
 
Fodaro's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 42
How Blizzard does it...

In the Blizzard EditingUI addon, they have their edit boxes handle the OnTabPressed event like this:
Code:
<OnTabPressed>
	EditBox_HandleTabbing(self, EditingFrameAnchorBar.TabList);
</OnTabPressed>
Then in the lua file, EditingFrameAnchorBar.TabList is an array like this:
Code:
EditingFrameAnchorBar.TabList = {
	"EditingEditBox",	-- FODARO: Actually in title bar.
	"EditingEditAnchorPoint",
	"EditingEditRelativeTo",
	"EditingEditRelativePoint",
	"EditingEditX",
	"EditingEditY",
	"EditingEditWidth",
	"EditingEditHeight"
};
I've changed that code a bit when I was making the addOn work, so it should be up to date.
__________________
Fodaro
(Main: Fodaro-Bronzebeard (EU))
Author of CharNote and Consolid8
  Reply With Quote
05-21-10, 02:28 AM   #4
Lilithurian
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 10
Thanks for your swift response.

Could you please explain what the values in the array are for? Are they supposed to be standard like that or should I change anything?

When I use your provided code like that it says "attempt to index global 'EditingFrameAnchorBar' (a nil value)".

Code:
EditingFrameAnchorBar.TabList = {
	"EditingEditBox",	-- FODARO: Actually in title bar.
	"EditingEditAnchorPoint",
	"EditingEditRelativeTo",
	"EditingEditRelativePoint",
	"EditingEditX",
	"EditingEditY",
	"EditingEditWidth",
	"EditingEditHeight"
};
  Reply With Quote
05-21-10, 07:30 AM   #5
Fodaro
A Cyclonian
 
Fodaro's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 42
Originally Posted by Lilithurian View Post
When I use your provided code like that it says "attempt to index global 'EditingFrameAnchorBar' (a nil value)".
You need to create a custom array to use instead of EditingFrameAnchorBar.TabList. The strings are simply the names of the text boxes, in the sequence you want to tab through them in. For example, in the window in your screenshot, you might have a tab list like this:

Code:
{
	"ProfileName",
	"ProfileCharacters",
	"ProfileStatus",
	"ProfileAge",
	"ProfileGender",
	-- Etcetera
}
Then, when the cursor is in the characters box and tab is pressed, the cursor will move to the status box, and then to the status box, and so on. In my first bit of code, I stored the array in the frame, but you can do that how you like.
__________________
Fodaro
(Main: Fodaro-Bronzebeard (EU))
Author of CharNote and Consolid8
  Reply With Quote
05-27-10, 02:46 AM   #6
Lilithurian
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 10
Thank you very much for your help.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Enable tabbing between editboxes?


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