Author Topic: Tabs in MLTextEdit (GUI's)  (Read 1594 times)

Im trying to make it so that tabs will show up in a ML text edit box in a gui im making. how would i do that?

Do you mean type them in? Or just show them in general? I'm assuming you want to type them in as it's an edit control.
I'm not sure if there is a clean way to do that, but one thing you could do is bind something like control + tab to GlobalActionMap and have it call a function where you just manually insert the tab. That's just what I thought of, there might be other ways.

Allright, well i have 2 questions then.
1. how would i use globalactionmap?
2. can i have it so it only uses the keybind in the gui, and elsewhere the bind be useable for other things?

I think a global action map is the same thing as a keybind.

okay, so i can make the keybind go to a function that adds a tab to the text box. so what, the function would have blah.setText(blah.getValue() TAB); ?

I'm not sure if you can end with a special separator. To be safe try blah.setText(blah.getValue() @ "\t");

I'm not sure if you can end with a special separator.
Nope, it's a syntax error.

okay, im substituting this with four spaces. looks just like tabs, works just as well.
but im having a problem, when i do the function to add them, it doesent add it where the cursor (you know what i mean, the line that shows where your typing.) is. is there ANY way, ANY at all that i can do this?

okay, im substituting this with four spaces. looks just like tabs, works just as well.
but im having a problem, when i do the function to add them, it doesent add it where the cursor (you know what i mean, the line that shows where your typing.) is. is there ANY way, ANY at all that i can do this?
Do control.getCursorPos(); to find the location of the cursor. Then add the stuff in that location.

I'm not sure if you can end with a special separator. To be safe try blah.setText(blah.getValue() @ "\t");
Also, do this instead of the 4 spaces.

Do control.getCursorPos(); to find the location of the cursor. Then add the stuff in that location.
show me what you mean.

and btw, what does that function return?