Putting letters where I want in the text field.BlitzMax Forums/BlitzMax GUI Programming/Putting letters where I want in the text field.
| I'm considering making an editor for Ansi & Ascii art. I know that most people use a simple notpad like program so I should be able to easily to this in bmax. currently there are two problems facing me.|
1. Using the cursor keys to move sentence character. I would like the cursor to always move left if I hit the left arrow. Think of the text field as a bunch of monospaced characters. It would be something like navagating a spreadsheet.
2. For ansi characters there is always a foreground color and a background color. Does the text field support individual colors for both foreground and background on a per character basis? I assume this will be very slow setting the colors thousands of times.
3. Is there a way to force the font of the textarea gadget even after the user copies and pastes from a document with a different font. I tried and it seemed to freeze the field.
I know that I could use a canvas for this but I would like to stay with the textbox approach since it handles many keyboard features already.
| I can actually paste text with highlighting and colors into a text field but I cannot seem to find a command to set the highlighting. This is an option in some text editor commands.|
So I have shown that highlighting IS possible but now how do I control it from my program? I just pasted the formatted text in from MS Office.
| Unfortunately, I think you may be fighting a loosing battle with this one. I understand the type of control you would like (with what I think is known as virtual whitespace), but quite simply this isn't what MaxGUI's TextArea is designed for...|
As for the highlighting behind text, a remember Brucey posting some FormatTextAreaBackground() tweaks a few years back, but FLTK doesn't support so it's not likely to be supported in the cross-platform MaxGUI command-set any time soon...
As for Copy n' Pasting formatting in, it does work as Microsoft's RichEdit control is capable of doing such text effects - but MaxGUI should really be stripping the clipboard contents of any formatting it cannot support before pasting it into the control. This inconsistency is a bug in MaxGUI.Win32MaxGUIEx - sorry...
I think it may be better to use a graphics canvas in this situation, despite its non-native look and feel.
| Ah well thanks for the response. I worry about maintaining speed for such large documents while using a canvas. I doubt that after 10000 or so characters it will able to refresh to match the user typing speed. Keep in mind that this was going to be used for ascii pictures which could in theroy be quite large. |