minigui compatible with \n

54 views
Skip to first unread message

Ivanil Marcelino

unread,
Feb 24, 2020, 3:24:56 PM2/24/20
to Harbour Minigui
Hello Grigory,

What do you think of the idea of making the minigui compatible with \ n as a line break. I say this on account of favoring the code at design time since the value of chr (10) could not be set which would damage the file. This would facilitate not only the use of multiline tooltip but also other functionalities and without escaping the language as in C it is so.
Sylvain Larche himself made a little rule with; to adjust tbrowse and if we had something internal like \ n it would dry the code well.

Thankful.
Ivanil

Sylvain Larche

unread,
Feb 24, 2020, 10:31:42 PM2/24/20
to Harbour Minigui
I did not invent the use of the ; to separate multi-Line string, It was used in Clipper 5 but I don't remember
where it was used, that is why I selected the ; to replace the Ugly Chr(13) in the heading. also it's much faster to write it.

as for \n i am no fan of the C language and find that it has no place in the Harbour language itself.


Sylvain Larche
Consultant

Grigory Filatov

unread,
Feb 25, 2020, 3:08:28 AM2/25/20
to Harbour Minigui
Hello Ivanil,

> minigui compatible with \n

Yes, it is. Because Harbour compiler supports the function  hb_StrFormat() for a text formatting.
Please take a look for a sample in your folder \samples\Basic\MAINDEMO_(SYNTAX_I) - function MemoryTest().

But I'm agree with Sylvain that ; separator is more native for Clipper and Harbour.

HTH,
Grigory

понедельник, 24 февраля 2020 г., 22:24:56 UTC+2 пользователь Ivanil Marcelino написал:

Pete

unread,
Feb 25, 2020, 6:25:06 AM2/25/20
to Harbour Minigui
Hello!

/*
   hbrun cr.prg
*/

REQUEST hb_codepage_utf8ex

PROCEDURE
Main( cArg )
   LOCAL cResponse

   hb_cdpSelect
( "UTF8EX" )

   hb_default
( @cArg, e"Hello!\n" )

   cResponse
:= cArg +;
   e
"\nHarbour already supports extended string litterals"+;
   E
"\nthat can consist of C-style backslash sequences like:\n"+;
   e
"\\n \\r \\t et.c.\n\n"+;
   e
"To exploit this feature, add an `e` or`E` just before your string!\n"+;
   
"Harbour knows how to handle those extended sequences."+;
   e
"\nin fact, Harbour is one of the most C-friendly hi-level languages"+;
   e
"\n(and so is Minigui, as well.)"+;
   E
"\n\n\t\tHave a nive day!"

   
? cResponse
   
   
return




P.S.: usage of the semicolon char `;` as a line-break inside a string,
        although is a matter of coding-style, is rather ugly;
        it is just a compatibility 'burden' which, IMO, should not appear
        in new code.
P.S.2. the function hb_StrFormat() is a more powerful implementation
          given that except escaped sequences, it also supports C-style
         format specifiers like `%s`, `%d`, `%.3ll` et.c.

      
regards,
Pete


Ivanil Marcelino

unread,
Feb 25, 2020, 8:27:26 AM2/25/20
to Harbour Minigui
Good Morning,

Good, I'm going to take a deeper look at this, I really didn't know.
As for using common tabs on the keyboard it is never a good idea when it comes to something generic.
Let's imagine in the case of the tooltip, in the designer the user enters the data in an editbox and enters each location that wants to break the line, when saving in the fmg file I would change the chr (10) to ";" or something similar, but these values ​​could be used by the user in the text itself, so when returning the values ​​for maintenance or in the compilation itself we would have something totally distorted, that is, we would have to deal with this possibility.
I have already had the process aborted after several million records processed because the text file received contains "|" as a delimiter, on account of a user typing this in an address, which broke all logic, where a simple <TAB> between fields would solve without any problem. Simple to solve when the file is what you do, but not when you receive it.
So my idea is to use the pattern C in the breaks and I was happy to know that it is already supported, I will check it out and thank you for your comments. {Tradutor gooogle}

at; Ivanil

Ivanil Marcelino

unread,
Feb 25, 2020, 8:29:59 AM2/25/20
to Harbour Minigui
thank you for your comments.

a;
Ivanil
Reply all
Reply to author
Forward
0 new messages