I am new to NVGT and i do not learn by reading, i am fully self taut and struggling. any help would be great. I am wanting to learn how to make menus, how to read the include files and how to implement them, and any other beginner advice i can get my hands on
Hi there,
welcome to the forum! ![]()
An include script
Technically, an include just is another script file that can be created, contains code and no entry point such as void main(). For example, an include could look something like this.:
// main.nvgt
#include"includes/*.nvgt" // Inludes every .nvgt file at the root of the includes folder. Does not append to sub folders.
void main() {
error("Uh oh, seems the application crashed!"); // Accesses function void error(const string&in message) declared in our include file.
}
// includes/error.nvgt
void error(const string&in message) /* A simple example that handles errors and then terminates the program. */ {
alert("Error", message); // Creates an alert(const string&in title, const string&in message) that uses SDL3 to open a simple dialogue on the screen. This call, specifically, produces an alert with a title that is "error". The message is the message specified in the function signature.
exit(); // Terminates the application. Challenge yourself and try to add things like a boolean in the function signature that can specify wether it is a critical error or not, and wether the application should terminate. Then show a non critical error followed by a critical one to see how it works.
}
It's simple as that. You just created an include script with a function and call the function inside void main()! Now, let's check out how you can navigate properly in code!
Navigating through code
This all assumes you have installed NVDA and use it as your main screen reader. You additionally need IndentNav which you can get from the NVDA store or the embedded link, I recommend version 2.2.7 which is the latest at the moment of posting this.
Optional: You can enable "Line indentation reporting" and set it to either "speech", "tones" or both. That way, you'll be given the information of the current indentation as soon as you are in a document of code.
You can configure and enable IndentNav within the NVDA settings.
Now, let's first take a look at navigating on the same level on indentation and skipping any code that has a different indentation. I decided for the SQL high level wrapper since it seems suited well for our first test. So let's navigate to C:/nvgt/include and open up db_props.nvgt! I do so with Notepad++, so I press the context key and then n, which should bring us to the "Edit with Notepad++" option on which I just need to press enter now. However, steps may vary depending on your code editor or ide.
Now let's scroll past that license, and - as I just figured out - it is indented too! So a perfect condition to test IndentNav. Note that the shortcuts may vary. I can't remember anymore wether I am still at the default ones. If you are at the line that says "db_props.nvgt - sqlite3 high level object oriented wrapper", just press alt plus num block two. Note that num lock needs to be off. You'll know that you performed the action successfully if you heard a bunch of beeps (unless you turned them off). And let's do it again. You now should hear "database_object@ __DBO_CONSTRUCTING__;"
That being said, let's go down another time. We are not at the database_object class. However, what now if we want to know if there are any more classes before reading the first class? Ok, let's figure that out.
This time the beep should take a bit longer, and you are now at the database_property class. There also are the database_string, database_list, database_int, database_double and database_bool classes, which all use the property class as their parent. Let's instead scroll up though. We do this by pressing alt again, but this time plus num block 8. Now you should be at database_object again, which is perfect for our next test!
If you press arrow down you'll likely be at the SQLite object this class of the wrapper creates. But now, you should be within the class and can navigate with the IndentNav shortcuts again. Let's scroll a few times down until we find the constructor.
database_object(sqlite3@ db, const string& in table, const string& in primary_column = "rowid")
Perfect! Now you arrived at the functions (normally, includes are designed so the properties (all the strings and ints and instances) are before all the functions for code consistency). You now could scroll down and check out the function signatures. If interested, you also can peek into the code of the function and continue the IndentNav pattern there too. For example, you also could skip huge if statements and while loops that way.
Eventually you'll figure out that there is an end. You'll hear a different sound and can't navigate further - at least with IndentNav. This is because you reached the end of the current indentation. To avoid that you accidentally check out the functions of the other classes - or statements in other functions -, IndentNav prevents you from navigating out of your current indentation level. Navigate down two times with your arrow key to verify, you're now at the database_property class!
Unfortunately, I can't go on and on as much as I'd wish to, and I have other things to do in real life. However, now I think you can experiment with that more on your own, and also explore the function signatures of the menu class. I appologize if the end was rather rough, but I think that was pretty much all you need to know for navigating your code, really.
Please keep in mind a very important thing: To use this AddOn, you need to use code that is indented. If you have code this looks like this, you will be unable to use it (ctry it!):
class test
{
int test_id;
test(int test_id = 5)
{
this.test_id = test_id;
}
}
WOW! I came to an end at the perfect time. I'm being called for an IRL-matter.
I hope this post helped!