[comp.windows.x.motif] insert/replace resource for XmText

dbrooks@osf.org (02/27/91)

On motif-talk, Nico wrote:
> People in our tutorials ask me so often why there is
> no resource for XmText widgets to switch between
> insert and replace mode.
> It would really make a lot of sense to introduce it.
> 
> Are there any planings to have it in the future ?
> 
> Are there any workarounds to have it now ?
> (XmText patches and/or workarounds for application side)

Oh, you want a *workaround*.  Well, this is a basis of a workaround for one-line
text widgets.  You'll probably have to add sophistication to taste; I could
imagine using the userData to control a mode switch.

  XtAddCallback(text, XmNmodifyVerifyCallback, tcb, NULL);
.....
/*ARGSUSED*/
void tcb(w, d1, mvcb)
     Widget w;
     caddr_t d1;
     XmTextVerifyCallbackStruct *mvcb;
{
  if (mvcb->text->length == 1) {
    XtCallActionProc(w, "delete-next-character", mvcb->event, "", 0);
  }
}



David Brooks
Systems Engineering
Open Software Foundation