Sign in to follow this  
Followers 0
dinodod

Using #Region

10 posts in this topic

Just curious, does #region do anything useful or does it simply 'group' blocks of code for easier reading? I'm using comments in my code and was wondering what method I could use that would be best for adding comments to my code about blocks of code. I see uses for #region but I grew up since the days of DOS 1.0 and always used comments in my code.

Is there another way that is preferred?

Thanks.


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites



If you have large blocks of code, you can use #region/#endregion along with SciTE's code folding to hide sections or regions of you code to make scrolling easier.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Have a look in the UDF's thay are often well commented - So you might wanna do as they do :)


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

If you have large blocks of code, you can use #region/#endregion along with SciTE's code folding to hide sections or regions of you code to make scrolling easier.

I like the code folding in SCITE. Very nice option. But for me, it doesn't keep the folds after I close the file. I also have another issue with the folds. I need to customize what it sees to fold. It like to fold all sorts of things but I want to trim the fat from the fold :) and have a select list of things to have it fold.

Any thoughts on that?


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

...I need to customize what it sees to fold...

I would not know how to do that - but, as mentioned above, UDFs are another way to make the code easier to look at :-)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I like the code folding in SCITE. Very nice option. But for me, it doesn't keep the folds after I close the file. I also have another issue with the folds. I need to customize what it sees to fold. It like to fold all sorts of things but I want to trim the fat from the fold :) and have a select list of things to have it fold.

Any thoughts on that?

SciTE doesn't remember the last folding state, only thing you can do is set the initial folding state of all folds.

Have no idea what you mean with the rest of your post .... "sees to fold" , "trim the fat from the fold " ?

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

What I meant is that if you look at the folds in SCITE, it 'sees' a lot of pieces that it wants to be able t fold. For instance, it reconizes CASE statements and makes a option to fold it. I do not want it to 'see' CASE statements as an option to fold (Hence trimming the fold :))

And yes, I have thus far alone in the beginning of my project over 350 lines of UDF's and rapidly growing :D


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

What I meant is that if you look at the folds in SCITE, it 'sees' a lot of pieces that it wants to be able t fold. For instance, it reconizes CASE statements and makes a option to fold it. I do not want it to 'see' CASE statements as an option to fold (Hence trimming the fold :))

Still don't understand the Folding issue...

Yes it does recognise each If-endif select-case-endselect etc as folding points but it is up to you to fold on it.

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Still don't understand the Folding issue...

Yes it does recognise each If-endif select-case-endselect etc as folding points but it is up to you to fold on it.

That is what I do not want it to reconize. I only want it to reconize #Region, not Select or some other commands. I don't want Select to have an option to fold. basically, I want to have it skipped. As I look at the folds, it becomes very cumberson to use since it 'see' so many things it wants to allow you to fold. I need to implify it.


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

That is what I do not want it to reconize. I only want it to reconize #Region, not Select or some other commands. I don't want Select to have an option to fold. basically, I want to have it skipped. As I look at the folds, it becomes very cumberson to use since it 'see' so many things it wants to allow you to fold. I need to implify it.

No options for that other than to write your own lexer version, but I wouldn't want it like that.

It makes it easier to read the code in my opinion . :)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0