 Have you ever wondered if you can make a program with Godot? Well, actually you can. It's very very easy Everything you see here on the editor is actually built with nodes that you can actually use for creating a program with Godot So let's just start and I have here an empty project we're gonna Create a user interface node for the start everything that it's green It's basically user interface elements such as the snapbar the tabs the everything that is not a game or a 3d thing so let's start with a Control node and we have our basic scene here What we're gonna do on this first video is a very simple text editor that you can open and save files Just to edit some text is gonna have covered the basics for it. So what we first want to add is Text edit node this node is basically like a code editor like dialogue You will see it here. It's gonna place it. I don't know like let's cover half of the screen With it Let's just try this. It's gonna ask us to save main. It's the main scene And as you can see here, we have a simple text editor So this is working like as you expect it to work It doesn't have anything fancy, but you can you know cut based or basic commands Okay, so let's try to make this open External files to do that. We're gonna need a button So we can start with that process. Let's see here on the control nodes Let's search for base button. Just a regular button. Yeah, nothing weird We're gonna place it here and the properties of that button here the text. Let's say open file Okay, so our open file Let's add and I'm gonna clone this one with control D you duplicate the node and Let's prepare for the save file Let's capitalize F. Okay So you have the buttons here, but of course they will not do anything. So we have to code that logic For the open file with We want to get is a file dialogue so we can select the file from our computer to do that You have to create first Popup which is Window dialogue Confirm that here. It's very hidden. It's in the depths of this pop-up menu and The file dialogue one is the one that you want for selecting as it describes it here So one thing that you will notice at first is that you don't see them by default and all the pop-ups are Invisible even if you make them visible here like they're not gonna be visible on On the game itself when you launch it on the program and you get a warning here Because you have to use the pop-up function to display it. Okay, so this is irrelevant to it Okay, that's gonna make this bigger. So yeah here in the center This is the title modes here you have like the different modes for this we want to open file with this and and access File system because you want it to be able to select anything other than the anything on the system And as you can see I'm already like here's my files and things like that and This should be Good for now. We can change the title to open file Okay, it's gonna save it take this in and Yeah, you can we can try it if you want but still we can see the buttons They do anything but you don't see that pop up. So let's start with the code now. Okay, sorry Let's start with the code with this button. That's gonna rename it to open file and save file We can either place the logic of the entire program in the root or you can do it in Small chunks here prefer to do it here in the root because it's a fairly simple program and I don't want it to be Very complicated. So just Create the script. We're gonna call it main dot gd or better. Maybe app This is gonna be our application and now we can start extending and Creating the program Let's remove everything. We don't really need this I'm gonna keep Pass function, okay so You can make it Everything with code, but I'm gonna go over the editor stuff first for instance here Let's use this no six Signal pressed so when the button is pressed. I want to call a function and Here we have it on the control node Which is on open file pressed and we do something What do we want to do? Well, we want to make the file dialogue Pop up Which is the function that you want to call when you want to show it if I said if I try this Project now like if I press here, I can open a file and I already can Select files and open them thing is there's nothing When I use this because we still haven't get the signals from the file and The same can be done with the save file dialogue here. We have this file dialogue. Let's gonna We're gonna duplicate this one And it's gonna be save file dialogue It's gonna swap the things that we want here instead of open file. We want to use the save file and the title It's gonna be save a file. Okay, so we have it here as well And let's go do the same with this button Button press we connect the signal to the main one and And we call The pop-up function for that window dialogue thing Okay Now what we want to do is that when we open the file we want to get all that text string here on this Text edit node So how you do that? Well, if you go to the file dialogue and the nodes you have the File selected file selected or till direct directory like selection We want the file one because we are getting only text files and we're gonna connect it to control so Here this will trigger when you select that To confirm it you can for instance print the path and you will see that Once we select a file to open like for instance this app that GD we get here the full path of the File that we open so we're gonna need to search for the file Class and get more information on this this Class is for doing everything related to file opening Saving reading whatever you need to do so as you can see here, there's a function which is open and This open function which let's go to it Open it means two arguments one is the path of the file that you want to open and Another one is the flags when they say here flags you have to search on the documentation of The same class what do those flags do in this case? These are the mode flags which are read one write two read write three and write read seven Okay, so let's create a New class. Let's call it F for the file You can create a class like so and now we're gonna open the file that we want to Start doing things with which will be file open And now we use the path that we already have and we just want to read it So we will go ahead and use the number one for the flag Then When we have everything open we want to get the text from that dialogue From that file to the text edit node so for the text edit node The variable text We're gonna say it to and now you can use an inbuilt function, which is F that Get as text this will read the file that we already opened and It's gonna read it as a test string and we're gonna set the value of the text edit to That string. Let's try it out. Let's see if it works We open a file and we select for instance the same script that we are editing right now and we have it here You should be the same Same as we are opening we if we want to open another thing like the product that got out You know, you can already see how this is working. So now let's go ahead and do the same file function We're gonna you be using it as save us Just for safety reasons, but yeah, let's go for it Let's rename it to save us The difference between save and save us is basically that if you use this save us You will set the name every time you save it But if you do save we can overwrite the file and that can be a problem for this test, but you can do it as you wish It's gonna be the same here on the same file dialogue when we get the file selected Let's connect this signal and now here we have to Code the logic for saving that information into a file, which is gonna be pretty similar so we get a new file and We're gonna open it with the same path and instead of doing the reading Flag we use the writing flag. This will give us permission to write things into that file This is for security reasons most of the time if sometimes you want to just read something You know, it's better to use the proper flags Otherwise, you can use the read and write flag which will allow you to do both, but it can be tricky sometimes Now it's basically instead of Getting the text and To onto the text edit node getting the text from the node to the file so how you do you do that basically you get the Inbuilt function, which is called a store You see here a lot of different ways of storing, but we want to use a store string Which will be basically be saving that information and we get the information that we want to save Which is the text from the text edit Okay, this should be enough. So let's make the test Now if I write hello This is a super nice Text editor Okay, we have here our super nice text editor. We're gonna save it as Hello world that Super awesome Text editor This is our file extension Okay You can write whatever you like here doesn't matter for now Okay, and it should be Saved, let's see You're gonna close everything started all over again. Let's try to open it Here, it's our file the file that we created before and Yeah, we can save it. Okay Let's see that we want to modify something we delete everything we do the numbers It's gonna save it you can select here. Everything works as you intended to even like the file exists Do you want to override? Yes Okay, so Yeah, we ended up with a very basic text editor They can open files You can save them modify things now that you can even like create your own code here If you want to let's see that's gonna overwrite this code. Let's see. Yeah, you see the changes are working here So you have everything? You need for that basic purpose and you only needed a few signals a few nodes For the next episodes, we're gonna cover other stuff that are really relevant But if there's something that you want to see Please remember to leave a comment You know, you can reach me anywhere on Twitter on Reddit here on YouTube and Yeah, thank you for watching and until the next one