Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!sgi!shinobu!odin!eukanuba.wpd.sgi.com!mikey From: mikey@eukanuba.wpd.sgi.com (Mike Yang) Newsgroups: comp.windows.x.motif Subject: Re: how do I determine the width of a XmText widget? Message-ID: <1990Aug17.174858.2135@odin.corp.sgi.com> Date: 17 Aug 90 17:48:58 GMT References: <9008161545.AA12056@hpwarf.HP.COM> Sender: news@odin.corp.sgi.com (Net News) Reply-To: mikey@sgi.com Distribution: inet Organization: Silicon Graphics, Inc. Lines: 31 In article <9008161545.AA12056@hpwarf.HP.COM>, jollyc@HPWARF.HP.COM (Jolly Chen) writes: |> |> How do I determine the current width of a XmText widget in terms of |> character spaces? For example, if my XmText widget is inside a form and |> the form is resized, I want to know how many characters are actually |> being displayed. The XmNcolumns resource is only the initial width, |> right? No, this is updated to reflect the current state. Note that XmNcolumns has CSG access. |> Also, how can I can determine what is currently displayed in the |> text widget? Note that this is different from the value inside the text |> widget because of scrolling (even in single_line_edit mode) or resizing. In Motif 1.1, check out XmTextXYToPos and XmTextPosToXY. One problem is that XmTextXYToPos doesn't seem to work correctly when there is word wrap. I found that XmTextPosToXY works okay. These routines may or may not help you, depending on why you want to know exactly what's displayed. If you just want to know if there's more to scroll to, XmTextPosToXY will do the trick since you can call it with the last position in the text and see if it succeeds. ----------------------------------------------------------------------- Mike Yang Silicon Graphics, Inc. mikey@sgi.com 415/335-1786