create new tag
, view all tags
A simple introduction to editing sketches created by the TWikiDrawPlugin.

The material in #Other_Tidbits may be confusing to a beginner, but I think it is worth perusing -- you will gain some hints about useful ways to use the TWikiDrawPlugin which you would otherwise have to learn by trial and error. You may not remember the details, but you may remember enough to come back to this page.

If you find that anything on this page can be improved, please improve it, as this is a wiki (twiki). (Note that I may move very detailed information to another (linked) page in an effort to keep this page less cluttered.)

Update: On 21 Feb 2003 I'm having trouble editing sketches that are larger than the defautl editing window -- I don't know how to scroll the picture in the edit window, have forgotten, or something is broken. This is an NCACC, maybe something to do with their computers. Problem shows up (here) on both sketches on this page. Once I remember / figure it out need to add a note to this page.

See AboutThesePages.



Editing a Sketch

To edit a sketch, click on it.

Prerequisites -- you must:

  • be registered on WikiLearn/TWiki (see http://twiki.org/cgi-bin/view/TWiki/TWikiRegistration) -- if you are not registered you might be able to start editing but before saving you will be prompted to login -- this might be a catch 22 situation and you may be unable to save your work -- register before starting to edit at TWikiRegistration
  • use a Java enabled browser
  • have downloaded the TWikiDrawPlugin -- this will occur automatically the first time you click on a sketch to edit it.

What to expect:

For the first edit you will have to wait a little while for the Java applet to be downloaded. Eventually you will get the TWikiDraw editing window, with drawing tool icons along the side, a menu across the top, and some buttons across the bottom. Subsequent edits are much faster.

Some Trickier Things

Cut and Paste

Cut and paste does not work with the mouse buttons or keyboard shortcuts. There are cut, copy, and paste selections on the TWikiDraw menu under Edit.

Cut and Paste Between Sketches

The two approaches I believe can work -- in both cases the files need to be on your local machine:

  • Use a text editor in the .draw file to copy and paste the appropriate text from one .draw file to another. (Not tested, and may be difficult to pick out the "appropriate text".)

  • Use JHotDraw on your local machine -- open a new window, copy and paste from the old window to the new window, then save the new window under a different file name. (I don't know if you can open two different files in JHotDraw, one in each of two separate windows, so you might have trouble copying from several drawings to another one.)

The "workaround" that I am using is to create a "master drawing" with all the pieces I think I will need for other drawings (see EmailOverviewSketch). After I'm satisfied that drawing has all the pieces I will need, I will make several copies (download and re-upload) and modify those as required by deleting and rearranging pieces.

Note that I am also trying to make sure that the master drawing has most of the pieces in the right places so that subsequent drawings look almost the same, but only real differences in functionality appear different on subsequent drawings. One way of facilitating this is to creat a "boneyard" at the bottom of the drawing with pieces which might be substituted for pieces in the top part of the drawing in subsequent derived sketches.


There is a menu selection under Line --> Arrows which allows you to select where the arrowheads should be (at Start, at End, or Both). See also #Other_Tidbits below, which includes more discussion about arrows, including some words on:

  • the difference between connected and unconnected arrows
  • the ability to connect to a drawing object or the text on a drawing object
  • dealing with grouped objects including facilitating connecting arrows by grouping / ungrouping and strange stretching effects by disconnecting arrows before dragging a group and reconnecting afterwards

Adding and Editing Text

There are both a Text Tool (A) and a Connected Text Tool (A with an arrow) in the vertical row of icons along the left side of the drawing applet. The connected text tool associates text with an object, so that if the object is dragged, the text moves with it. If you use connected text with a group and then drag the group, you can get some strange effects, so at this point in time, I prefer never to use connected text.

To edit existing text, click on the Text Tool first, then click on the text.

Stretching the Canvas

Increasing the size of the drawing area (stretching the canvas) is not straightforward. Note: The following syntax for the %DRAWING% directive does not seem to work:

=%DRAWING{"test" width="1200" height="1500"}% =

The workarounds generally involve putting a drawing entity on the sketch so it extends beyond the current borders of the sketch. Then save and reopen the drawing and you will have a bigger canvas.

Note that the canvas can only be stretched down and to the right -- you will not increase the size of the canvas if you extend an object beyond the canvas to the left or up.

Horizontal: Put a line of text on the drawing, use the yellow handle to stretch the text beyond the width of the drawing. If necessary, save the drawing and reopen it.

Vertical: Create a fairly large drawing object. "Grab" it at the top, and drag it down until only the top of the object is visible on the canvas. Then save and reopen the drawing. The canvas will have stretched to show the entire object.

In both cases, you must (usually?) save and quit and then reopen the drawing to see the stretched canvas.

If you delete the object that you used to stretch the canvas, the drawing will shrink the next time you save and reopen it. Put some drawing entity (a rectangle, whatever) in the lower right corner of the stretched canvas to preserve the size. When the drawing is finished this entity can be deleted if other parts of the drawing force the canvas to stay at this size, or you can convert the rectangle to be transparent (color none) and leave it there. (Not recommended -- if you later want to shrink the canvas, I suspect it will be difficult (impossible?) to find this object to move or delete it -- but wait -- maybe you can use the drag a rectangle selection trick to find it -- I need to try this.)

Developing a New Sketch based on an Existing Sketch

Method 1: Re-upload the .draw file under a new name

Copy the .draw file to your local computer, then re-upload to TWiki under a new name:

  • view the "text" of a sketch (click on the <filename>.draw in the list of attachments at the bottom of the page),
  • save the contents locally as a plain text file (see the note below),
  • upload (attach) it to the desired page with a new name,
  • in the TWiki edit window, create a new TWiki DRAWING "command" using the new name -- the syntax is %DRAWING{<filename>}%
  • save the page,
  • click on the new drawing "box",
  • wait a little longer than for a normal edit -- you eventually get the drawing edit window with a copy of the sketch.

Note: Make sure that the uploaded .draw file is plain text.

Note: You upload the .draw file, the .gif file is what is displayed on the page. The .gif file is not created until the .draw file is opened and then saved on TWiki using the TWikiDrawPlugin. (I don't expect you would get good results uploading the .gif file first or only -- you might get it to display but you might not be able to edit it.)

Discussion: I had problems with this procedure when I did something that inadvertently included some HTML tags in the .draw file. The symptom of this problem is that the TWikiDraw edit window comes up blank, with an error message on the bottom: "Error reading /p/pub/Wikilearn/EditingATWikiDrawSketch/test.draw: java.io.IOException: String expected in Line 1". (On some occasions the edit window disappeared before I could view it -- I don't recall whether this was the same problem or something different.

Method 2: Use JHotDraw

Simply take the drawing offline (starting as described in the first method), then make additional drawings offline using JHotDraw (version 5.1) (or the command line TWikiDraw tool if it exists).

See JHotDraw and note the problems mentioned there with respect to:

  • Gray background on JHotDraw vs. white background on TWikiDraw
  • Inability to force word wrap in a text line on JHotDraw
  • Limit and problems with stretchability of text size on JHotDraw
  • Possible problems with stretching the canvas based on the above.

Refinement and Testing: I intend to run a test at some point -- take a stretched canvas to JHotDraw in whatever form I can do it on TWikiDraw (i.e., with or without the stretched line of text remaining in the drawing) and see how it appears on JHotDraw.

Update: I did do this, but I was not happy with the results. IIRC, they mainly had to do with the problems of text. Based on this, I prefer the first method.

Editing a "Finished" Sketch

When editing a "finished" sketch on a "finished" TWiki page, each editing session should end with the sketch in a usable form, or, if this editing leaves the sketch in some "broken" form, I should provide a means to view the most recent previous "finished" sketch. (Elaboration: Sometimes when I edit a sketch, I have to tear it apart and then begin reconstructing it. For safeties sake, I will do regular saves during the process.)

There are (at least) three possibilities:

  1. Download and upload the sketch to a different page, make the modifications on that page, then download and upload the edited sketch to the original page.
  2. Similar to the previous, but upload the original sketch under a new name, and display both the original sketch and new sketch on the original page until the revision is complete.
  3. Provide a notice on the page specifying the last revision that was "usable" and instructions (or a pointer to instructions) on how to view such previous revisions (see the next section).

How to View a Previous Revision of a Sketch

Viewing an old version of a drawing can be done in some browsers but not in others. The following works in IE5 but not in konqueror 2.2.1 (it shows "non text" "characters" instead of the gif image).

  • In the attachment table at the bottom of this page, click on the link "action" next to the .gif file for the drawing you want to view (not the .draw file).
  • When the next page comes up, scroll down to the second table.
  • Click on the link "view" in the row for the revision you want to view.
  • When the next page comes up, it should show the sketch.

If you test this in any other browser, please record which browsers work and which don't in the following.

Browsers in which the above procedure works:

  • MS IE 5 *

Browsers in which the above procedure does not work:

  • konqueror 2.2.1 *

Other things to investigate: Can I display an old version of a drawing on a page by doing something like %DRAWING(allpieces ver="1.9"%? Not at this time. (A workaround would be to upload the old version with a different filename and display it until the new version was finished (or at least in a usable form).)

Other Tidbits

Grouping and Ungrouping, and choosing the right groups can help a lot (can't think of simple words of advice to offer -- it gets complicated -- I've learned some things, not sure I'll remember them all):

  • To select multiple items:
    • Press and hold shift while clicking on additional items
    • Click and drag a rectangular box around the items you want to select (this will not work if you are working "on top of" another drawing object (like a large box representing the Internet cloud or something similar), even if it has been "moved to back".

  • If you are going to group and then drag an object to another location, consider the following:
    • Use unattached text blocks vs. attached text blocks -- it seems that attached text blocks do some surprising things as you move (maybe only if the attached text block is not centered on the underlying object) -- but, as a general rule, I hope to remember to use unattached text blocks. (Surprising things -- they move with respect to the attached objects, like they are attached somewhere other than the center of the object they are attached to.)
    • Don't include connection arrows to other stuff -- if you do include connection arrows you get a very large grouped item, which stretches as you drag the item, and you get surprising results with text and other stuff moving strangely.

  • Connection arrows can connect to an item or the text in or on an item. The arrows stop at the objects' border if connected to the item, but may cross the border if connected to the text. Generally, I prefer to have the lines stop at the objects' border.

  • You connect arrows to an item by selecting the arrow tool, then clicking in the center of one object and dragging to the center of another object. After you first create the arrow, you can select it and you will see green squares at each end of the arrow. You can drag these squares to the center of other objects to change to which objects the arrows connect.

  • It is harder (not possible?) to connect an arrow to a grouped object. (Perhaps you can do it in the center of the grouped object -- I'd have to test that.) Generally, if you want an arrow to be attached to a single object within a group, you need to do the attaching while the object is not part of the group (either before the group is created, or temporarily uncreate the group, attach the arrow, then recreate the group).

  • The previous items lead to this -- if you are going to create a grouped object with "subobjects" connected to other objects by arrows, and then drag it to other locations:
    • You want to group the object to facilitate dragging
    • You want to attach arrows after dragging, to avoid large objects and strange stretching effects
    • You can make groups of objects, then supergroups of those groups and individual items. If you know which objects you will later connect arrows to, you will want to try to set up your groups so those items are in the last grouping, such that by undoing one grouping you have access to those individual objects for attaching the arrows. In doing this, you will get confused, especially when objects overlay each other. The "Bring to Front" and "Send to Back" commands can be your friends in this process -- experiment with using them.

  • When you overlay objects on top of each other, grouped or not, the "Bring to Front" and "Send to Back" commands can be your friends in this process -- experiment with using them.

    • When I set up the "3D effect" to show (3) users on some of the email sketches, I frequently lost objects as I moved other objects around or grouped them. (When you group objects, they all move to the same "layer" of the drawing -- the top layer.

It is not unusual to group some objects and not others, and then see the ungrouped objects disappear because the grouped objects have all moved to the top layer. You can find those missing objects by sequentially sending the top layer to the back of the drawing.

For the 3D effects, I learned to send what I wanted to appear on top of everything to the back first, then the second layer, and so on, cycling through every object. When you sent the last object to the background, the first object you sent to the background will now be on top and (hopefully) everything will appear as you desired.

It seems that the process of sending things to the background one after the other is more useful than bringing something to the front.

  • If you have trouble selecting an object (or moving the green box of an arrow to the center of it), it may not be on the uppermost layer of the drawing. (This was particularly a problem for me when I was drawing things on top of a rectangular transparent frame (color none) -- I periodically had to send the frame to the back so I could select items that I could see, but were behind the transparent frame.)

  • Learn what objects look like when they are selected, and learn the purpose of the white and yellow circles around the selection "frame" -- generally these are for resizing.

  • When an arrow is attached to an object and selected the two ends of the arrow are green boxes. I was able (usually accidentally) to detach arrows from their objects -- the square boxes then appear white. (Occasionally it can be useful to have a detached arrow to force it to go exactly where you want. I can't tell you exactly how to create one, but these were some of the anomalies I got as I dragged or grouped and ungrouped groups of drawing entities.)

Do I expect anyone to read this section? And make sense of it? Well, I may try to rewrite it to make it easier to understand, but you will benefit from reading it even if it doesn't totally make sense -- you will have some idea of some things to expect as you work in TWikiDraw.

Problems with Konqueror

In some distributions, for example Mandrake, Konqueror is shipped without Java installed. Java must be installed to edit TWikiDraw drawings.

Konqueror, at least version 2.2.1, will not edit a page which includes HTML comments (<!-- --> tags). See BrowserIssues and Konqueror221HtmlCommentTestPage. The edit window (textarea) comes up empty. (I don't know whether this has any effect on editing a drawing as I don't have Java in my installation of Konqueror.)

A Test Sketch

Feel free to edit this test sketch. Double click in the drawing to start.

Edit drawing `test9` (requires a Java 1.1 enabled browser)
Edit drawing `test` (requires a Java 1.1 enabled browser) %DRAWING{test}%

The Future

I may convert these to Visio, Dia, Kvivio, or Killustrator sometime in the future, to get more color choices, the possibility to output as SVG, the ability to use stencils, more control over drawing size, etc. (Aside: TWikiDraw does have some alignment capability that I didn't originally notice -- I haven't tried it yet.)

Note: TWiki cannot currently display SVG, IIUC.


  • RandyKramer - 02 Apr 2002
  • <If you edit this page, add your name here, move this to the next line>

Page Ratings and Attachments

Note that the .draw and .gif file pair(s) are for the drawing(s) which appear on this page.

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatdraw test.draw r10 r9 r8 r7 r6 manage 17.7 K 2002-04-13 - 15:53 RandyKramer  
GIFgif test.gif r8 r7 r6 r5 r4 manage 15.5 K 2002-04-13 - 15:53 RandyKramer  
Unknown file formatdraw test9.draw r4 r3 r2 r1 manage 15.6 K 2007-10-31 - 14:13 UnknownUser TWiki Draw draw file
GIFgif test9.gif r3 r2 r1 manage 11.0 K 2007-10-31 - 14:13 UnknownUser TWiki Draw GIF file
Edit | Attach | Watch | Print version | History: r19 < r18 < r17 < r16 < r15 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r19 - 2007-10-31 - MingTLai
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WikiLearn? WebBottomBar">Send feedback
See TWiki's New Look