Text widget that supports string coloring and font changes

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

6 posts / 0 new
Last post
Text widget that supports string coloring and font changes

Submitted by Anonymous (not verified) on

Fri, 06/15/2012 - 12:07

Hi all,
As far as I know, Motif has no widget for editable multiline text (rather than labels), that supports multiple font types and/or color within the same text.
I know that Motif 2.0 had this kind of widget, namely XmCSText, that for some reason does not exist in newer Motif version.
Does any of the newer Motif versions support different fonts/colors of strings within the same text? If so, which one, how can I get it and what widget I need to use?
If not, Where can I get Motif 2.0 library or sources? (Is it open-source?)
Thanks
‹ XmStringDrawImage problems Build openMotif 2.2.2 fails: _XGetpwnam requires 3 arguments ›

 

Submitted by yahubat on

Submitted by yahubat on

Tue, 07/17/2012 - 10:27

 

Wed, 11/16/2005 - 16:26#1

Dvorak

Re: Text widget that supports string coloring and font chang

liran wrote:

Hi all,

As far as I know, Motif has no widget for editable multiline text (rather than labels), that supports multiple font types and/or color within the same text.

I know that Motif 2.0 had this kind of widget, namely XmCSText, that for some reason does not exist in newer Motif version.

Does any of the newer Motif versions support different fonts/colors of strings within the same text? If so, which one, how can I get it and what widget I need to use?
If not, Where can I get Motif 2.0 library or sources? (Is it open-source?)

Thanks

Hello liran,
I'm also dealing with the same problem. Probably you saw my posts here or on google comp.windows.x.motif group. No one answered me, probably because nobody had such a problem (???). Anyway, I solved somehow this problem, maybe in not such a nice way, but hey, it works. I wanted that my string displayed in a widget can have different colors, underlined words, striked words and highlight words. After a week of struggle with motif/X and some other stuff, I started to see that I can't do this through traditional way: set a string in such a manner and throw it to a widget that suports text or compound strings.
My solution was to use label widget. I put XmNlabelType as XmPIXMAP, and started to draw on it. So for this I used a rendition (in which I set font, if it's underlined or striked), a GC(in which I set the foreground and background colors), a XmString for text and the XmStringDrawImage function. Be aware that XmStringDraw function does not take in consideration the background color.
So, for every string, I'm setting all these params (colors, fonts, etc) and use the XmStringDrawImage function to put it on the label. For computing where the next string will be put, I'm using XmStringWidth and XmStringHeight on the XmString that I've just put on the label.
Hope for you to succeed

 

 

 

Submitted by yahubat on

Tue, 07/17/2012 - 10:27

 

Thu, 11/17/2005 - 10:27#2

liran

Text widget that supports string coloring and font changes

Ok thanks,
I'm keeping myself the right to contact you if I'll finally decide to write the widget myself :wink: . (By the way, What version of Motif are you using?)

In a more technical manner, does anybody know how can I get Motif 2.0, or any code sources that implement that kind of widget?

 

Thu, 11/17/2005 - 10:50#3

Thu, 11/17/2005 - 10:50#3

Submitted by yahubat on

Tue, 07/17/2012 - 10:28

Thu, 11/17/2005 - 10:50#3

Dvorak

Text widget that supports string coloring and font changes

liran wrote:

Ok thanks,
I'm keeping myself the right to contact you if I'll finally decide to write the widget myself :wink: . (By the way, What version of Motif are you using?)

In a more technical manner, does anybody know how can I get Motif 2.0, or any code sources that implement that kind of widget?

I'm using motif 2.2 version. Well, I forgot about this aspect. If you want to use motif 2.0, there is a widget CSText, which suports XmString that may have different colors and/or fonts. Note however, that this widget was dropped from motif 2.1, due to the fact that it was pretty buggy and slow. So, in your place I don't think that I want to use this one :)
I'll really apreciate if you'll tell me about your decision.

 

Submitted by yahubat on

Submitted by yahubat on

Tue, 07/17/2012 - 10:28

 

Thu, 11/17/2005 - 15:32#4

liran

Text widget that supports string coloring and font changes

Buggy? In what manner?

I understood it had performance problems (in terms of efficiency), do you know any other problems that it had?

I also understand from your answer that Motif 2.2 doesn't have any widget that answers our demands :roll: .

Anyway, I promise you'll be the first to know, as soon as I'll decide what to do.

Hey, is there a chance that you are sharing your sources for the mixed label-text-XmString widget? that will help me a lot.

Thanks a lot for your support!

 

Thu, 11/17/2005 - 19:36#5

Thu, 11/17/2005 - 19:36#5

Submitted by yahubat on

Tue, 07/17/2012 - 10:28

Thu, 11/17/2005 - 19:36#5

Dvorak

Text widget that supports string coloring and font changes

Quote:

Buggy? In what manner?

I understood it had performance problems (in terms of efficiency), do you know any other problems that it had?

I've never used CSText, all that I'm saying is from what I saw on the net. Just search on google for CSText and go to groups.

Quote:

I also understand from your answer that Motif 2.2 doesn't have any widget that answers our demands.

Yep, that's right. At least from my knowledge.

Quote:

Hey, is there a chance that you are sharing your sources for the mixed label-text-XmString widget? that will help me a lot.

So sorry, but my company prohibits this. :cry: I would love to, but I really don't want that some of my project colleagues can see the code on the net. I'll get some troubles. But trust me, it's not that hard. As I told you, you'll have to use a label widget and draw the strings on it. Just see the XmStringDrawImage function and you'll start to see the things.

Quote:

Anyway, I promise you'll be the first to know, as soon as I'll decide what to do.

Thank you, I really want to know
regards!