Textblock

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
Horst
Posts: 327
Joined: Tue Oct 13, 2015 3:27 pm

Textblock

Post by Horst »

Hello

In VO i can turn off a Method or Function with the simple word Textblock.

I am missing it :-)

Horst
User avatar
wriedmann
Posts: 3655
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Re: Textblock

Post by wriedmann »

Hi Horst,
in X# you can use

Code: Select all

/* method xyz() 
return */
I have seens several issues caused by textblocks during the migration to X#.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Horst
Posts: 327
Joined: Tue Oct 13, 2015 3:27 pm

Re: Textblock

Post by Horst »

Hello Wolfgang

I know that. But when i have a big Function and inside also comments with /*many lines*/ then your solution doesnt work.

Maybe they can put something inside like Textblock and EndTextblock

Horst
User avatar
Chris
Posts: 4583
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Textblock

Post by Chris »

Guys,

I was also thinking about this, maybe we can introduce another pair of block comment markers like (* ... *) that could nest with the existing markers /* ... */
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
robert
Posts: 4258
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Textblock

Post by robert »

Chris,
Chris wrote: Sat Mar 16, 2024 10:23 am Guys,

I was also thinking about this, maybe we can introduce another pair of block comment markers like (* ... *) that could nest with the existing markers /* ... */
That should not be too difficult to implement.
But TextBlock .. End Textblock should work too.
If we do this, what do you expect to see in the editor:
- should the new comment or textblock contents have the comment color?
- should it have the normal color

And what should happen with tooltips etc.?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Chris
Posts: 4583
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Textblock

Post by Chris »

Robert,

I think it should be like normal comments, so also no tooltips etc.

But, Horst, another idea to disable a method, is to surround it with #ifdef...#endif directives, like

#ifdef Exclude (or donotcompile, or anything like that)

METHOD Test()
....

#endif

This way, it will be excluded from compilation.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
ArneOrtlinghaus
Posts: 384
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

Re: Textblock

Post by ArneOrtlinghaus »

In older times before VO 2.8 I used textblocks in the program quite a lot to store SQL code/macro code in textblocks. I had overwritten the previously functions QOut and made a function GetTextblock() to return the textblock as a string to the program. It was a possibility to store texts with syntax other than VO nearby the text. When the QOut-Functions vanished with a newer VO version I started to store these textblocks in script filesoutside the program.
Now the textblock command as a type of "named" textblocks has returned in our macro scripts to store complex SQL code in macros scripts. The macros can retrieve these textblocks as GetTextblock ("xxx"), change some variables or add some code and then execute them.

So I haven't any direct need in X#, but it can be useful. It brought me useful ideas.

Arne
User avatar
Chris
Posts: 4583
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Textblock

Post by Chris »

Hi Arne,

It's not exactly what you are doing, but in case you are not aware of it, X# has a feature to create such texts with the TEXT TO command which might be helpful:

Code: Select all

LOCAL cText AS STRING

TEXT TO cText
some test text here
text in another line
ENDTEXT

? cText
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
ArneOrtlinghaus
Posts: 384
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

Re: Textblock

Post by ArneOrtlinghaus »

Hi Chris,

that's a nice feature. May be it can serve.

Thanks
Arne
HansjoergP
Posts: 104
Joined: Mon Jul 25, 2016 3:58 pm
Location: Italy

Re: Textblock

Post by HansjoergP »

In Visual Studio it is easy to comment out a function or method.
First collapse the method -> Select the whole line -> Ctrl + K + C

In this case the whole block is commented out.

Ctrl + K + U uncomments the method

Hansjörg
Post Reply