[comp.windows.x.motif] Text widget

jaccard@dssmv2.mpr.ca (Philippe Jaccard) (10/03/90)

I am trying to use a MOTIF text widget as a password entry field.
This field must display a '*' or any other character for each user
input.
I was thinking of using the XmNmodifyVerify callback to maintain a copy
of the text string.
After having duplicate the insertion/deletion in my backup field, I was
thinking of simply replacing callbackArg->text->ptr with '*'.
It seems that the text provided in the callback datas is only a copy.
The text widget don't use these datas to perform text modifications !

Does anybody knows more on this text widget behaviour ?
I'll appreciate any suggestions.

Philippe 

jcf@LINUS.MITRE.ORG (10/04/90)

XmNmodifyVerifyCallback
Philippe Jaccard write:

I am trying to use a MOTIF text widget as a password entry field.
This field must display a '*' or any other character for each user
input.
I was thinking of using the XmNmodifyVerify callback to maintain a copy
of the text string.
After having duplicate the insertion/deletion in my backup field, I was
thinking of simply replacing callbackArg->text->ptr with '*'.
It seems that the text provided in the callback datas is only a copy.
The text widget don't use these datas to perform text modifications !

Does anybody knows more on this text widget behaviour ?
I'll appreciate any suggestions.

---

Maybe I'm taking you too literally but you definitely don't want to
replace (as in assignment) callbackArg->text->ptr with '*'.  Instead,
try *callbackArg->text->ptr = '*'.  This works with Motif 1.0.3.
However, it may be an oversight because they go to the trouble of
copying everything into the XmTextVerifyCallbackStruct and then modify
XmText using all the original values except for the new string.  A
quick look at the 1.1.0 source indicates that this solution is upward
compatible.  In 1.1 you can change the other members of the
XmTextVerifyCallbackStruct and have them take effect.  In fact, in 1.1
it looks like you _can_ replace callbackArg->text->ptr (with a *char).

Now if only I could find where in the OSF documentation that all this
is intentional and will continue to be supported.

--
Jim Fohlin                                         (617) 271-7505
The MITRE Corporation, M/S A155                     jcf@mitre.org
Burlington Rd, Bedford, MA  01730                   ...!linus!jcf

whitty@hpcvlx.cv.hp.com (Joe Whitty) (10/17/90)

> / hpcvlx:comp.windows.x.motif / jaccard@dssmv2.mpr.ca (Philippe Jaccard) /  8:58 am  Oct  3, 1990 /
> I am trying to use a MOTIF text widget as a password entry field.
> This field must display a '*' or any other character for each user
> input.
> I was thinking of using the XmNmodifyVerify callback to maintain a copy
> of the text string.
> After having duplicate the insertion/deletion in my backup field, I was
> thinking of simply replacing callbackArg->text->ptr with '*'.
> It seems that the text provided in the callback datas is only a copy.
> The text widget don't use these datas to perform text modifications !
> 
> Does anybody knows more on this text widget behaviour ?
> I'll appreciate any suggestions.

It is true that in Motif 1.0, the text widget ignored the settings in
in the callback struct that was returned by the application.  This was
an oversight, and was resolved in Motif 1.1.  The original design was
meant to provide information for the user to make a decision whether
the action should be taken (i.e. doit = True) or not taken (doit = False).
Allowing the user to only modify one field of the callback record but
not any other field was the oversight.

Until you get Motif 1.1, what you can do is set the doit flag to 'false'
so the text is not displayed.  In Motif 1.0 this will cause the bell to sound.
Motif 1.1 has a resource to control the bell.  Then set a static boolean
to True prevent re-entrance.  Next call XmTextReplace() to display your '*'.
then reset your re-entrance flag to False.  XmTextReplace() will call
the XmNmodifyVerify callback.  To prevent getting into an infinite loop,
you need the re-entrance flag.  This scheme has been implemented and it works
fine.

> Philippe 

Joe Whitty
----------