Writing a continuous line inside a text model

All graphical and user interfaces problems

Writing a continuous line inside a text model

Postby manumart1 » Mon Jun 15, 2015 2:25 pm

To draw a continuous line I tried to use the char "─" (push the Alt key and then type the number 2500 or 196). This is the unicode character U+2500. See http://www.fileformat.info/info/unicode/char/2500/index.htm.
This char is encoded in UTF-8 using 3 bytes "E2 94 80". When I type this char several times, the cursor of the editor is incorrectly positioned. See attached image.
Anyway I post it here just for curiosity.

To draw an horizontal line inside a text model I am doing:
Code: Select all
VAR md: TextModels.Model; fm: TextMappers.Formatter;
  hLine: CtlsFigures.Figure;
...
md := TextModels.dir.New(); fm.ConnectTo(md);
...
hLine := CtlsFigures.NewLine(Ports.black, SHORT(ENTIER(0.5 * Ports.mm)));
fm.WriteView(hLine);
hLine.context.SetSize(190 * Ports.mm, 1 * Ports.mm); (* Width DIN A4 = 210 mm. *)
fm.WriteLn;

It uses the Ctls subsystem from http://www.zinnamturm.eu/downloadsAC.htm#Ctls.
It took me some time to arrive at it, in particular how to specify the size of the line via hLine.context.SetSize(); I am not very fluent using views.

Regards
Attachments
cursor_misleading.png
cursor_misleading.png (1.15 KiB) Viewed 2903 times
manumart1
 
Posts: 67
Joined: Tue Sep 17, 2013 6:25 am

Re: Writing a continuous line inside a text model

Postby manumart1 » Tue Jun 16, 2015 7:22 am

I have discovered that instead of
Code: Select all
fm.WriteView(v);
v.context.SetSize(w, h)

I can use
Code: Select all
fm.rider.WriteView(v, w, h)
manumart1
 
Posts: 67
Joined: Tue Sep 17, 2013 6:25 am


Return to GUI problems

Who is online

Users browsing this forum: No registered users and 1 guest