XMTEXTFIELDREPLACE(3)

πŸ“¦
version 2.5.2 Β· 2 versions
, in alpine 3.24, arch rolling, centos-stream 9, epel 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

πŸ’– XmTextFieldReplace πŸ’–

okay bestie, so you know how we're living in the XmTextFieldReplace era of the library call manual? yeah. this is that page. TextField girlies, this one's for you 🫢


✨ NAME ✨

XmTextFieldReplace β€” a TextField function that replaces part of a text string. literally its whole job. iconic behavior honestly πŸ’…


🌸 SYNOPSIS 🌸

#include <Xm/TextF.h>
void XmTextFieldReplace(
Widget widget,
XmTextPosition from_pos,
XmTextPosition to_pos,
char * value);

no cap, that's the whole thing. four little args and a dream ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so XmTextFieldReplace replaces part of the text string in the TextField widget. that's it, that's the vibe. πŸ’–

okay but the important part β€” the character positions? they begin at 0 (zero!!) and they're numbered sequentially from the beginning of the text. zero-indexed girlies rise πŸ‘‘

an example text replacement would be to replace the second and third characters in the text string. to accomplish this, the parameter from_pos must be 1 and to_pos must be 3. and to insert a string after the fourth character, both parameters, from_pos and to_pos, must be 4. yes, both. same number. it's giving "collapse the range and it becomes an insert" and we love that for us 🌈

ngl this routine is social β€” it calls the widget's XmNvalueChangedCallback and verification callbacks, either XmNmodifyVerifyCallback or XmNmodifyVerifyCallbackWcs, or both. and if both verification callback lists are registered? the procedures of the XmNmodifyVerifyCallback list are executed first, and the resulting data is passed to the XmNmodifyVerifyCallbackWcs callbacks. order matters bestie, don't come for me 😭

also!! XmNmotionVerifyCallback is generated if to_pos is less than or equal to the cursor position and the length of value is not the same as the length of the text being replaced, or if the cursor position is between from_pos and to_pos, and the distance from the cursor position to from_pos is greater than the length of value. yes that's a whole mouthful, read it twice, it's important πŸ’€

now the args, one by one, no skips, we don't skip here:

  • widget β€” specifies the TextField widget ID
  • from_pos β€” specifies the start position of the text to be replaced
  • to_pos β€” specifies the end position of the text to be replaced
  • value β€” specifies the character string value to be added to the text widget

and if you want a complete definition of TextField and its associated resources? go read XmTextField(3). it's required reading, sorry not sorry πŸ“š



and that's the whole page bestie, you ate it up, no crumbs πŸ“

signing off from the footer of XmTextFieldReplace(library call) β€” that's the source and the version, babes, and I'm passing the aux cord to the date too 🎧✨

mwah πŸ’œ stay iconic, stay zero-indexed πŸ‘‘