I am using an FXText control as my main terminal window. I have a couple of
problems:
-
How do I get it to auto-scroll? Seems like it should be easy, but so far
I haven’t figured it out.
-
I want the window to act like a terminal window where input is only
appended to the existing window. Can I stop the user from repositioning the
cursor with the mouse. I have already taken care of the arrow keys by
capturing SEL_KEYPRESS. Do I just do something similar when capturing mouse
events?
-
What is the best way to simulate a backspace or delete? Since I capture
SEL_KEYPRESS, I know when it happens, but what do I do to the FXText control
to make it update correctly?
Dale Martenson wrote:
I am using an FXText control as my main terminal window. I have a couple
of problems:
Sorry for the delayed response; I’ve been spending time with Judy
- How do I get it to auto-scroll? Seems like it should be easy, but so
far I haven’t figured it out.
I just posted an answer to this on the FOX Community FAQ list:
http://www.fifthplanet.net/cgi-bin/wiki.pl?FAQ
Look near the bottom of the list.
- I want the window to act like a terminal window where input is only
appended to the existing window. Can I stop the user from repositioning
the cursor with the mouse. I have already taken care of the arrow keys
by capturing SEL_KEYPRESS. Do I just do something similar when capturing
mouse events?
Yes, I think you’ll need to intercept the SEL_LEFTBUTTONPRESS (and
possibly SEL_LEFTBUTTONRELEASE) messages for that window so that
“clicking” at a certain position doesn’t move the text caret.
- What is the best way to simulate a backspace or delete? Since I
capture SEL_KEYPRESS, I know when it happens, but what do I do to the
FXText control to make it update correctly?
You should probably just mimic what FXText normally does when the user
presses those keys. The final word is to actually look at the C++ source
code for the FXText widget’s onKeyPress() member function; but for
starters, you can send the FXText::ID_DELETE message to an FXText widget
to tell it to delete the character at the current cursor position, i.e.
text.handle(self, MKUINT(FXText::ID_DELETE, SEL_COMMAND), nil)
or to do a “backspace” at the current cursor position, send ID_BACKSPACE:
text.handle(self, MKUINT(FXText::ID_BACKSPACE, SEL_COMMAND), nil)
Hope this helps,
Lyle