xsharp.eu • Textblock
Page 1 of 1

Textblock

Posted: Sat Mar 16, 2024 8:22 am
by Horst
Hello

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

I am missing it :-)

Horst

Re: Textblock

Posted: Sat Mar 16, 2024 9:07 am
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

Re: Textblock

Posted: Sat Mar 16, 2024 9:36 am
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

Re: Textblock

Posted: Sat Mar 16, 2024 10:23 am
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 /* ... */

Re: Textblock

Posted: Sat Mar 16, 2024 12:05 pm
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

Re: Textblock

Posted: Sun Mar 17, 2024 5:35 pm
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.

Re: Textblock

Posted: Mon Mar 18, 2024 7:31 am
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

Re: Textblock

Posted: Mon Mar 18, 2024 9:08 am
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

Re: Textblock

Posted: Mon Mar 18, 2024 3:34 pm
by ArneOrtlinghaus
Hi Chris,

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

Thanks
Arne

Re: Textblock

Posted: Mon Mar 18, 2024 3:51 pm
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