TextEdit right alignment...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

TextEdit right alignment...

Christopher J. Demers
I have a TextEdit view that displays a long path name.  I essentially want
it to be right justified, so it shows the most meaningful information
without requiring a scroll.

I experimented with setting the alignment to #right in the view composer.
This works if I start typing into the text box, or if I have a default text
setting.  However if I set the value via model: or value: it will not be
right aligned any more.  What I have done before is to force the caret to
the right after I set the value.  I just wonder if I should have to do that
manually if I set the alignment to #right?

Chris


Reply | Threaded
Open this post in threaded view
|

Re: TextEdit right alignment...

Andy Bower
Christopher,

> I have a TextEdit view that displays a long path name.  I essentially want
> it to be right justified, so it shows the most meaningful information
> without requiring a scroll.
>
> I experimented with setting the alignment to #right in the view composer.
> This works if I start typing into the text box, or if I have a default
text
> setting.  However if I set the value via model: or value: it will not be
> right aligned any more.  What I have done before is to force the caret to
> the right after I set the value.  I just wonder if I should have to do
that
> manually if I set the alignment to #right?

This seems to work in the pre-release Dolphin 5. I think there may be a
problem in Dolphin 4 with some styles that are set and require the control
to be rebuilt. Depending on where in the view opening process these styles
occur, I think the resultant view may end up being disconnected from the
model. For example, try this:

tp := TextPresenter show.
tp view alignment: #right.
tp value: 'Hellooooooo'.

In D5 this comes up right aligned, and remains this way as the value is
changed. I suspect that under D4 (I don't have one available to test right
now) that the value is not displayed at all !!

Best Regards,

Andy Bower
Dolphin Support
http://www.object-arts.com
---
Are you trying too hard?
http://www.object-arts.com/Relax.htm
---


Reply | Threaded
Open this post in threaded view
|

Re: TextEdit right alignment...

Ian Bartholomew-5
Andy/Chris,

> In D5 this comes up right aligned, and remains this way as the value is
> changed. I suspect that under D4 (I don't have one available to test right
> now) that the value is not displayed at all !!

I think there may be two things here.

The problem that Andy mentions does occur under D4, the String is not
displayed at all.

However I think there is another point which is that the #alignment aspect
may not be doing what you think it should. The idea is that it pads the
string in the appropriate place to make the specified side align. If the
string is too large for the edit field then there is no way that Windows can
add padding to make it align so it does nothing, leaving the start of the
text visible.  It makes more sense if you think about a multiple text edit
where all the lines are padded to make them right align. If one line is too
long for the edit view then, rather than the right hand ends of all the
lines being visible, the start of the longest line is always shown and a
scroll bar added or the lines wrapped.  You can't add a scroll bar/wrap for
a single line edit so for those the effect is that the character focus is
left to the left. FWIW, the early versions of the Windows control (up to and
including Win95 IIRC) didn't support alignment in single line controls at
all.

I think you'll have to keep moving the caret.

Regards
    Ian


Reply | Threaded
Open this post in threaded view
|

Re: TextEdit right alignment...

Christopher J. Demers
Ian Bartholomew <[hidden email]> wrote in message
news:9u59fv$6a8ne$[hidden email]...
> I think there may be two things here.
>
> The problem that Andy mentions does occur under D4, the String is not
> displayed at all.
>
> However I think there is another point which is that the #alignment aspect
> may not be doing what you think it should. The idea is that it pads the
> string in the appropriate place to make the specified side align. If the
> string is too large for the edit field then there is no way that Windows
can
> add padding to make it align so it does nothing, leaving the start of the
> text visible.  It makes more sense if you think about a multiple text edit
...
> I think you'll have to keep moving the caret.

Gentlemen, thank you for the comments.  I suppose one could argue (with
Microsoft) for the text control to automatically scoot the caret over to the
right when right alignment is turned on (but does anyone ever get very far
arguing with Microsoft? ;) ).  Yes, I think I shall have to keep scooting
the caret myself.  The alignment attribute just looked so tempting. Oh
well...  Thanks for the explanation.

Chris