Re: How to redefine the painting of a widget - Motif

This is a discussion on Re: How to redefine the painting of a widget - Motif ; Ken Lee wrote in message news: ... > In theory, you can subclass the widget and override the draw method. In > practice, however, this is a very complex widget and you'll need to study the > source code very ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Re: How to redefine the painting of a widget

  1. Re: How to redefine the painting of a widget

    Ken Lee wrote in message news:...
    > In theory, you can subclass the widget and override the draw method. In
    > practice, however, this is a very complex widget and you'll need to study the
    > source code very carefully to get it right. If you're a novice programmer,
    > you might have an easier time subclassing XmPrimitive and writing your text
    > editing code from scratch.
    >
    > Ken Lee, http://www.rahul.net/kenton/


    Thank you, i am just a beginner in Motif programming, i know that it
    is very difficile to redefine the drawing method of the widget XmText,
    but that is too necessary with me. Can you give me an address for
    documents on widget subclassing? And where can I get the source code
    of Motif?

    I've tried to look for some issue, but i don't know which can be used:

    1. In the widget XmText, i have read the man-page of the widget
    XmText, there is a notion of text highlighting (with
    XmTextSetHighlight). I tried to highlight 2 text segments, but when i
    typed a character between these 2 segments, they are merged and became
    one segment continu, that's what i don't expect. In fact, in my text
    editor, i just want a manier to distinguish some lines with others,
    not necessarily an other color.

    2. I sea the notion of render-table, what does it serve to? Is it
    useful with me?

  2. Re: How to redefine the painting of a widget

    Dao Trung Kien wrote:

    > Ken Lee wrote in message news:...
    >
    >>In theory, you can subclass the widget and override the draw method. In
    >>practice, however, this is a very complex widget and you'll need to study the
    >>source code very carefully to get it right. If you're a novice programmer,
    >>you might have an easier time subclassing XmPrimitive and writing your text
    >>editing code from scratch.
    >>
    >>Ken Lee, http://www.rahul.net/kenton/

    >
    >
    > Thank you, i am just a beginner in Motif programming, i know that it
    > is very difficile to redefine the drawing method of the widget XmText,
    > but that is too necessary with me. Can you give me an address for
    > documents on widget subclassing?


    As Ken wrote, XmText is probably too complex for proper subclassing. In
    such complex widgets, one method often assumes another method soes
    certain things in a specific way, specific beyond the generic
    specification for the method. Direct modification to the source of
    XmText might be an easier way.

    Anyway the principal obstacle I see is that the text in XmText is a
    String, not an XmString, thus does *not* embed rendering directives (at
    least in OM2.1). So you will have to implement a *major* extension to
    XmText.


    > And where can I get the source code
    > of Motif?


    www.motifzone.net

    >
    > I've tried to look for some issue, but i don't know which can be used:
    >
    > 1. In the widget XmText, i have read the man-page of the widget
    > XmText, there is a notion of text highlighting (with
    > XmTextSetHighlight). I tried to highlight 2 text segments, but when i
    > typed a character between these 2 segments, they are merged and became
    > one segment continu, that's what i don't expect. In fact, in my text
    > editor, i just want a manier to distinguish some lines with others,
    > not necessarily an other color.
    >
    > 2. I sea the notion of render-table, what does it serve to? Is it
    > useful with me?


    An XmString is a sequence of text segments interleaved with rendering
    directives, which are references to entries in a render table, which
    (a.o.) indicate font and color. XmString is used for the text of XmList,
    and XmLabel and its subclasses. But not for XmText (unfortunately!)

    --
    Michel Bardiaux
    Peaktime Belgium S.A. Bd. du Souverain, 191 B-1160 Bruxelles
    Tel : +32 2 790.29.41


+ Reply to Thread