Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Adding a vertical line in text control
Adding a vertical line in text control [message #448042] Tue, 28 December 2004 15:31 Go to next message
Mark Phippard is currently offline Mark PhippardFriend
Messages: 129
Registered: July 2009
Senior Member
I am working on the Subversion plugin for Eclipse. We have a commit
dialog with a Text control on it to enter a commit message. I would
like to draw a vertical line within the control at column 80 as an
assist to the user to enter line breaks in their commit message. The
Java editor in JDT has a feature similar to this. I was wondering
whether there is some relatively "easy" way to do this?

Thanks
Re: Adding a vertical line in text control [message #448060 is a reply to message #448042] Thu, 30 December 2004 00:03 Go to previous message
Daniel Spiewak is currently offline Daniel SpiewakFriend
Messages: 263
Registered: July 2009
Senior Member
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="serif">The JDT editor uses the StyledText widget.&nbsp; This is
not a native widget, but a subclass of Canvas which uses certain
methods and objects to access information like fonts, colors, carets,
and line width.&nbsp; It's not a terribly complex widget, but a very good
example of SWT widget emulation.&nbsp; The JDT editor vertical line (and all
the other features such as line highlighting and error underlining) are
all implemented through subclassing.&nbsp; Yes, I know, you're not supposed
to subclass widgets.&nbsp; However, StyledText is an emulated widget and as
such is safe for subclassing.&nbsp; It sounds like you're going to have to
use a StyledText widget instead of a simple Text widget and subclass it
to draw the line.&nbsp; Alternatively, you can use a straight StyledText
widget and add a PaintListener to it which computes the column width
and paints the line accordingly.&nbsp; Either way, it's a hack, but it works.<br>
<br>
Daniel<br>
</font><br>
Mark Phippard wrote:
<blockquote cite="midcqru86$br2$1@www.eclipse.org" type="cite">
<pre wrap="">I am working on the Subversion plugin for Eclipse. We have a commit
dialog with a Text control on it to enter a commit message. I would
like to draw a vertical line within the control at column 80 as an
assist to the user to enter line breaks in their commit message. The
Java editor in JDT has a feature similar to this. I was wondering
whether there is some relatively "easy" way to do this?

Thanks
</pre>
</blockquote>
</body>
</html>
Previous Topic:Toolbar item size
Next Topic:show advance options
Goto Forum:
  


Current Time: Fri Oct 30 02:47:11 GMT 2020

Powered by FUDForum. Page generated in 0.01404 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top