Re: XForms: Delete key

Emmet Caulfield (emmet@indigo.ie)
Sun, 27 Jul 1997 15:06:11 +0100

To subscribers of the xforms list from Emmet Caulfield <emmet@indigo.ie> :

Martin Bartlett <martin@nitram.demon.co.uk> wrote :
>
> OK, the standard Linux users question: How do I get the pc Delete key to
> delete the next character in input fields, not the previous. I have this
> in Xterm, Netscape, Applix etc - but not Xforms!!
>
I have to admit, I had the same problem, your question inspired me to find
the solution and share :) Here's a demonstration hacked together from the
HTML version of the documentation and the goodies demo.

Hopefully, I can stop lurking in shame at the silliness of my last question
to the list now ;-)

Emmet

--- snip ----

#include <stdlib.h>
#include <string.h>
#include "forms.h"

int
main(int argc, char *argv[])
{
int choice;
char str1[100],str2[100];
const char *s;
FL_EditKeymap ekm;

fl_initialize(&argc, argv, "Backspace", 0, 0);

/* Before: DEL works like BKSPC */
strcpy(str1,(s=fl_show_input("Give a string:","")) ? s:"");
fl_show_message("You typed:","",str1);

/* This is the business part */
memset(&ekm, 0 , sizeof(ekm)); /* zero struct */
ekm.del_prev_char = 8; /* control-H */
ekm.del_next_char = 127; /* delete */

fl_set_input_editkeymap(&ekm);

/* After DEL works like DEL */
strcpy(str2,(s=fl_show_input("Give another string:",str1)) ? s:"<Cancel>");
fl_show_message("You typed:","",str2);
fl_show_messages("Good Bye");
return 0;
}

--- SNIP ---

-- 
.------------------------ Emmet Caulfield ------------------------.
|emmet@indigo.ie, caulfielde@eeng.dcu.ie, http://indigo.ie/~emmet/|
|        ** Quidquid latine dictum sit, altum viditur **          |
|          [Whatever is said in Latin sounds profound]       ;-)  |
`-----------------------------------------------------------------'

_________________________________________________ To unsubscribe, send the message "unsubscribe" to xforms-request@bob.usuf2.usuhs.mil or see http://bob.usuf2.usuhs.mil/mailserv/xforms.html Xforms Home Page: http://bragg.phys.uwm.edu/xforms List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/