 So I just posted that I'm going to be making little applications using Godot And I've already got a few questions one of which was making dialogue boxes and also Combo boxes as they said or drop-down menus. So let's go ahead and see what options we have in Godot And how easy they are to use in this video. We're gonna again. Just go over the basics. I'm not gonna make it look real pretty I'm just gonna go over the functionality and Go from there. So let's check it out. Okay, we're starting with a new project here We're going for more of an application So we're probably gonna use the user interface because we're making a user interface go ahead and click on that and We're going to add a few things to this We're going to add in as we're looking for a dialogue window also known as a pop-up in this case We're gonna say add child node to our control node here And I am going to say pop up and we have different options here You have your pop-up and then you have sub options from that as few as down here You have accepting confirmation dialogues file dialogue dialogues if you want the user to be able to select files from your file system We're gonna go with a blank window. So just a dialogue window. I'm gonna say create So that created it but by default it's going to be invisible I'm gonna click this to make it visible, but it'll still be invisible when we start up our application Unless we tell it to appear which we're going to do with a button. So real quick I'm going to enlarge this a little bit and With it selected. I'm going to say in the layout here. I'm just gonna say center So now it should be centered and I'm gonna hit control s to save my project I'll just call it the scene control and if I hit f5 it's gonna ask why I want to be the default scene And we'll select this scene we just created and as you can see I have a blank window because it's hidden by default That's what this little icon here is probably telling us warning. It'll be you have to call pop-up I guess you can call pop-up I usually use visibility. I think it does the same thing So with the select though we can give it a title. This is going to be a menu where you select someone's name Okay, so I'm gonna say pick a name Now to make this dialogue visible. We're gonna want a button. So to our control node. I am going to add a child node I'm gonna type in button and I'm gonna add a button. I'm gonna choose my layout here I'm gonna say center on bottom-wide so bottom-wide. I'm gonna make it a little bit thicker here And this is gonna be very big, but we're gonna say choose name So now we have that and we'll link that to a function in a moment But let's add a few more things here again to our control node. I'm going to add a label So what we're gonna do is when our pop-up window appears We're gonna have a drop-down menu to pick names from and then when we click an okay button in our dialogue box It's gonna change this label. I'm gonna tell the label to be top-wide and That's good for now on that Now I am going to go to our dialogue here. I'm gonna say add a child to that. I am going to add in a Option button. So the option button is basically what we're talking about in this tutorial. I'm going to center that Horizontal-wide like so and What it's going to do is it's going to give us a drop-down of list of names that we can pick from then We want a button that we can click okay that will change the label to say what name you picked So I'm going to add another button but into our dialogue box make sure it's in your dialogue box and I'm going to say Bottom-wide for that. So bottom-wide gonna make it a little bit bigger and I'm just gonna label that Okay So we have all our elements now. Let's work on the code. I'm going to say here I'm going to attach a script. I'll just control call it control GD. It's gonna be a Godot script I always forget there's an option to not have all these comments in here and I should click that but I always forget Okay, I'm gonna just copy and paste to save some time So our buttons here are our items here can be renamed So for example, I can rename our option button because you might have more than one to something such as Name box is what I'm going to go with for my example. I'm gonna go back to my code here and I am going to copy and paste some code to save some time basically all these were saying on rate because we're gonna be grabbing these objects these elements here and They have to be up here before That you can grab them. So that's we're saying on ready Then we're gonna create a variable and give each one a name We're gonna say get the node by that name. So for our name box, we're looking at the one that's inside our window dialogue We're gonna get the name box for our pop-up window. That's gonna be our window dialogue and again You can rename them over here, but to make things clearer, but just for time's sake We're gonna leave them all at the default names besides name box that we renamed and then we have a choose button We have an okay button and we have our label now What we can do at this point is we can again if we start this up We're not gonna see what we'll see your button down here. Our label has nothing and our button does nothing Let's make our button make our pop-up visible. So I'm gonna choose my button here Make sure you're choosing the correct button again. That's why rename them over here might be a good idea If you have a larger project you can to button down button up button press I'm gonna do button up. That's what I normally do and I'm gonna go ahead and say on Choose button up. What are we gonna do? We're gonna do that. Here's the function So what are we gonna do? We're going to take our pop-up that we created up here and I believe there's a pop-up option. I just do visible truths now if I Run this and I click this button the dialogue pops up now There's nothing inside our menu here and our okay button does nothing. So let me go ahead and just close out of that what I'm gonna do is I Am going to instead of adding one by one items because you might have a lot of items I'm gonna create a variable so on ready. I'm gonna say names. I'm gonna give it three names here And then we're gonna loop through the names So I'm gonna create a for loop So again what this is doing is we're creating an array of names right now with three names We're gonna say okay for each name. So we're gonna go through names. We're gonna go for each name We're gonna find our name box, which is our option button, which we've renamed name box up here We're gonna add an item and we're gonna add the name So now if I run this when that's visible you can see there's three names Okay, and our okay button still does nothing. Let's make our okay button do something. We're going to say Our button here. We're gonna say on button up We're going to let's rename this to so we know what button it is to Okay connect So as this function gonna do well if we have our dialogue up already, it's visible. We're gonna make it Invisible so we're gonna say False so if I run this now we can click choose name We can choose a name and then we click okay, and that dialogue goes away but now we want to do something with the name that is selected and Although there's probably a few different ways to do this. What I'm going to do is just say Okay, find our label which is defined up here as the label that we have on our main window We're gonna say it's text equals and we're gonna say you have selected and then we're gonna add to that from the name box We're gonna get the item text, but which item we're gonna get the item that is selected from the name box I'm gonna click at five to run that I'm gonna click choose name I'm gonna choose a name when I click. Okay, it now has said you have Selected John if I go back in here I can select a different name and click okay and has changed to you have selected Chris and of course we can also pick Jake Don't want to leave him out perfect That's pretty much the end of this tutorial. Obviously we can create an exit button of some sort on this The only other thing I might do is come in here and like with our label. I might tell it to Center the label so now when we run this and we choose a name It's going to center it there We can center it on the window if you want we can add other fonts to it in the size We've done all that in previous videos. The only other thing is like you might not like the look of this default theme, right? It's kind of standard most application programming interfaces that give you Buttons and drop-down menus have a very basic standard looking Options that usually are meant to be standard, but not very pretty. I am not much of a designer That's why I say I'm a programmer not an application designer because to me application designer is someone who has more of an artistic view We're not going to go over in this video But for all our buttons and dialogues and windows you can add themes So we can say new theme in here and you can add this and then once you create a theme You can save it as as a resource and use it anywhere in this project or other projects We're not going to go over that in this tutorial, but I just wanted to point out that that was an option So again check out the links in the description. Hopefully I'll remember to put this example code into a Project online that you can check and download, but that's the basic concept and again We did option box, but if we go back into here, we go Add a child you can see that there's checkboxes check buttons color picker picture at color picker buttons menu buttons we just an option button there's tool buttons link buttons and A whole bunch of stuff and again you can make them look however you want if you have that artistic Feel which we might go over themes in a future video, but I do thank you for watching I do thank the viewer who asked this question for the idea to do the video on it And I hope that you have a great day. So that's it I know I said we have a great day, but I thank you for watching this video Sorry if there's a little bit noise in the background. My kids were doing something. I have to go check on that So I apologize if there was any no background noise in this video that you heard my kids yelling But other than that, I hope that you enjoyed the video. I thank you for watching Please visit films by Chris comm and again. Have a great day