Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
Drawing a Box like MC
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Does anyone know why this...
by
TYDQ
[
Today
at 06:39:17 am]
TBGRABitmap.TextSize retu...
by
hedgehog
[
Today
at 06:07:46 am]
AI, NLP and CAI: Text Gen...
by
schuler
[
Today
at 04:26:36 am]
The weird Rewrite bug
by
ojz0r
[
Today
at 03:50:28 am]
Demoscene Square dot flag...
by
KodeZwerg
[
Today
at 03:47:30 am]
How does Castle Game Eng...
by
michalis
[
Today
at 02:51:40 am]
Lazarus for Windows on aa...
by
dsiders
[
Today
at 01:22:37 am]
Have anyone develop UEFI ...
by
440bx
[April 16, 2024, 09:39:52 pm]
For-in loop over constant...
by
VisualLab
[April 16, 2024, 09:15:53 pm]
BUG REPORT: Unable to gen...
by
PascalDragon
[April 16, 2024, 09:02:49 pm]
Lazarus project made on M...
by
Odacir
[April 16, 2024, 08:56:58 pm]
Is it possible to support...
by
PascalDragon
[April 16, 2024, 08:51:36 pm]
CORBA interface and Varia...
by
PascalDragon
[April 16, 2024, 08:35:43 pm]
Macros confuse error mess...
by
PascalDragon
[April 16, 2024, 08:13:25 pm]
Form scaling
by
fxeconomist
[April 16, 2024, 08:09:39 pm]
InstallAware Using Lazaru...
by
Thaddy
[April 16, 2024, 07:21:31 pm]
Post your internal error ...
by
Eugene Loza
[April 16, 2024, 07:12:35 pm]
C-evo: New Horizons 1.3.0...
by
Chronos
[April 16, 2024, 06:32:41 pm]
How can i make this windo...
by
Handoko
[April 16, 2024, 06:23:43 pm]
CocoaInt.CocoaIconUse no ...
by
dsiders
[April 16, 2024, 06:22:10 pm]
pre-processor symbol when...
by
paule32
[April 16, 2024, 05:11:35 pm]
How are cookies share Web...
by
Thaddy
[April 16, 2024, 04:59:59 pm]
Azure sql database will n...
by
wpflum
[April 16, 2024, 04:04:56 pm]
Values of a custom compon...
by
CM630
[April 16, 2024, 01:42:08 pm]
Arabic text, problem on L...
by
marius.maximus
[April 16, 2024, 12:59:47 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Drawing a Box like MC (Read 535 times)
BSaidus
Hero Member
Posts: 545
lazarus 1.8.4 Win8.1 / cross FreeBSD
Drawing a Box like MC
«
on:
February 03, 2023, 11:42:49 pm »
Hello.
I'm trying to draw a box like MC(midnight commander) do but, It wont work in windows or FreeBSD.
the box look like.
Code: Pascal
[Select]
[+]
[-]
WriteLn
(
' ┌──────────────────────────────────────────────────────────────────────┐ '
)
;
WriteLn
(
' │ │'
)
;
WriteLn
(
' ├──────────────────────────────────────────────────────────────────────┤'
)
;
WriteLn
(
' │ │'
)
;
WriteLn
(
' │ │'
)
;
WriteLn
(
' │ │'
)
;
WriteLn
(
' │ │'
)
;
WriteLn
(
' │ │'
)
;
WriteLn
(
' │ │'
)
;
WriteLn
(
' ├──────────────────────────────────────────────────────────────────────┤'
)
;
WriteLn
(
' │ │'
)
;
WriteLn
(
' │ │'
)
;
WriteLn
(
' │ │'
)
;
WriteLn
(
' │ │'
)
;
WriteLn
(
' │ │'
)
;
WriteLn
(
' │ │'
)
;
WriteLn
(
' ├──────────────────────────────────────────────────────────────────────┤'
)
;
WriteLn
(
' │ │'
)
;
WriteLn
(
' └──────────────────────────────────────────────────────────────────────┘'
)
;
Caracters are printed using
Code:
[Select]
ALT + CODE // CODE = 185, ....
but the result is some charaters other then wanted.
Any idea about this ??
Thank you
Logged
lazarus 1.8.4 Win8.1 / cross FreeBSD
dhukmucmur vernadh!
Blaazen
Hero Member
Posts: 3237
POKE 54296,15
Re: Drawing a Box like MC
«
Reply #1 on:
February 04, 2023, 12:00:59 am »
If you use Lazarus, try this: menu Edit -> Insert from character map ... and select tab Unicode and item "Box drawing" from the combo below.
It looks fine here, i.e. I got the same characters in writeln('╔═════╗'); and in output.
«
Last Edit: February 04, 2023, 12:03:32 am by Blaazen
»
Logged
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21
Try Eye-Candy Controls:
https://sourceforge.net/projects/eccontrols/files/
Bogen85
Hero Member
Posts: 595
Re: Drawing a Box like MC
«
Reply #2 on:
February 04, 2023, 04:20:44 am »
I asked openAI to write a program for this.
I tweaked the output slightly.
Code: Pascal
[Select]
[+]
[-]
program
TestDrawBookshelf
;
{$mode objfpc}{$H+}
uses
SysUtils
;
const
HORIZONTAL_LINE
:
AnsiString
=
#
$E2
#
$94
#
$80
;
VERTICAL_LINE
:
AnsiString
=
#
$E2
#
$94
#
$82
;
UPPER_LEFT_CORNER
:
AnsiString
=
#
$E2
#
$94
#
$8C
;
LOWER_LEFT_CORNER
:
AnsiString
=
#
$E2
#
$94
#
$94
;
UPPER_RIGHT_CORNER
:
AnsiString
=
#
$E2
#
$94
#
$90
;
LOWER_RIGHT_CORNER
:
AnsiString
=
#
$E2
#
$94
#
$98
;
LEFT_SHELF_INTERSECTION
:
AnsiString
=
#
$E2
#
$94
#
$9C
;
RIGHT_SHELF_INTERSECTION
:
AnsiString
=
#
$E2
#
$94
#
$A4
;
procedure
DrawBookshelf
(
width
:
Integer
;
shelfHeights
:
array
of
Integer
)
;
var
i
,
j
,
k
,
shelfHeight
:
Integer
;
begin
// Draw the top of the bookshelf
Write
(
UPPER_LEFT_CORNER
)
;
for
i
:
=
1
to
width
do
Write
(
HORIZONTAL_LINE
)
;
WriteLn
(
UPPER_RIGHT_CORNER
)
;
// Draw the shelves
for
i
:
=
0
to
High
(
shelfHeights
)
do
begin
shelfHeight
:
=
shelfHeights
[
i
]
;
Write
(
LEFT_SHELF_INTERSECTION
)
;
for
j
:
=
1
to
width
do
Write
(
HORIZONTAL_LINE
)
;
WriteLn
(
RIGHT_SHELF_INTERSECTION
)
;
// Draw the shelf contents
for
j
:
=
1
to
shelfHeight
do
begin
Write
(
VERTICAL_LINE
)
;
for
k
:
=
1
to
width
do
Write
(
' '
)
;
WriteLn
(
VERTICAL_LINE
)
;
end
;
end
;
// Draw the bottom of the bookshelf
Write
(
LOWER_LEFT_CORNER
)
;
for
i
:
=
1
to
width
do
Write
(
HORIZONTAL_LINE
)
;
WriteLn
(
LOWER_RIGHT_CORNER
)
;
end
;
var
width
:
Integer
;
shelfHeights
:
array
of
Integer
;
i
:
Integer
;
begin
// Get the width of the bookshelf
width
:
=
StrToInt
(
ParamStr
(
1
)
)
;
// Get the shelf heights
SetLength
(
shelfHeights
,
ParamCount
-
1
)
;
for
i
:
=
2
to
ParamCount
do
shelfHeights
[
i
-
2
]
:
=
StrToInt
(
ParamStr
(
i
)
)
;
// Draw the bookshelf
DrawBookshelf
(
width
,
shelfHeights
)
;
end
.
The above with
./testdrawbookshelf 40 5 5 0
produces:
Code: Pascal
[Select]
[+]
[-]
┌────────────────────────────────────────┐
├────────────────────────────────────────┤
│ │
│ │
│ │
│ │
│ │
├────────────────────────────────────────┤
│ │
│ │
│ │
│ │
│ │
├────────────────────────────────────────┤
└────────────────────────────────────────┘
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
Drawing a Box like MC
TinyPortal
© 2005-2018