Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Copying XmStrings

17 views
Skip to first unread message

Fred

unread,
Oct 1, 2009, 1:48:41 PM10/1/09
to
I want to make a copy of an XmString, replacing all separators
(newlines) with a string
(such as " | " ) so that the new XmString has only one line. I want to
preserve all
of the font element tags, layouts, charsets, locales, renditions, etc.
associated with
each of the text segments.

Is there an easy way to do this?
--
Fred K

Bill

unread,
Oct 2, 2009, 7:25:59 AM10/2/09
to
Not sure it's simple, but would XmParseMapping do the trick?
There's an example under XmParseMappingCreate in the Motif manual.

Fred

unread,
Oct 2, 2009, 11:57:25 AM10/2/09
to
On Oct 2, 4:25 am, Bill <schottsta...@gmail.com> wrote:
> Not sure it's simple, but would XmParseMapping do the trick?
> There's an example under XmParseMappingCreate in the Motif manual.

I've tried using the ParseMapping, without success. The reason is that
the input to XmStringParseText is a char*, not an XmString. So I still
have to convert the original XmString to a char*, thus losing all of
the
tags associated with each component.
--
Fred K

Fred

unread,
Oct 2, 2009, 1:44:43 PM10/2/09
to

However, I did come up with a solution.

In a loop, I call XmStringGetNextSegment, which returns the text, the
tag, and whether this is a separator. I create a new XmString with
that
text and tag (if it is a separator, I use my substitute string), and
concatenate
the new strings together.

The manual says XmStringGetNextSegment is obsolete, replaced by
XmStringGetNextTriple, which is much, much more difficult to work
with
to get the above results.
--
Fred K

0 new messages