1 00:00:05,990 --> 00:00:06,620 Hey everyone. 2 00:00:07,140 --> 00:00:10,070 So in this video we are going to go two more important vigils. 3 00:00:10,130 --> 00:00:12,730 That is menu button and menu bar here. 4 00:00:12,740 --> 00:00:15,180 These things if you see these things. 5 00:00:15,290 --> 00:00:16,270 This is a menu bar. 6 00:00:17,180 --> 00:00:20,570 And these particular options here are known as menu buttons. 7 00:00:20,570 --> 00:00:26,620 So here in this video we are going to London how we can create this one because without these your program 8 00:00:26,630 --> 00:00:34,620 the light did not have much features so here we have the item and we begin with creating a menu button. 9 00:00:34,810 --> 00:00:38,560 So creating the menu button menu bar is a little atypical. 10 00:00:38,680 --> 00:00:41,770 You need to remember few lines and just delays. 11 00:00:41,770 --> 00:00:44,020 Do you really require design activity. 12 00:00:44,230 --> 00:00:50,140 So by practicing 2 4 times you will learn that honestly so let me begin with creating a valuable and 13 00:00:50,140 --> 00:00:59,020 be new voting menu button then add David you name menu button fences be your new Dedmon so in window 14 00:00:59,680 --> 00:01:09,450 after that one detects to open that one say five after that one enough for this one just M.B.. 15 00:01:09,670 --> 00:01:10,670 Great. 16 00:01:10,840 --> 00:01:19,300 Now at this point our button is created that is menu button but if you want this one here no going out. 17 00:01:20,030 --> 00:01:20,650 We have this. 18 00:01:21,330 --> 00:01:25,270 So here you have this one but nothing will happen on clicking this one. 19 00:01:25,320 --> 00:01:33,300 So in this case this one is a simple button so to add some features you need to add here some more lines. 20 00:01:33,340 --> 00:01:39,370 First you need to create this one in a basic menu like a menu with only one button. 21 00:01:39,430 --> 00:01:41,740 Here we have four options right now. 22 00:01:41,740 --> 00:01:43,680 In that case we have only one. 23 00:01:44,170 --> 00:01:53,530 So for creating this one into a menu remember these two lines always M.B. dot menu here and these my 24 00:01:53,720 --> 00:02:00,460 variable dot menus a method which create this one as a menu so that you will have different options 25 00:02:00,460 --> 00:02:01,480 in that one. 26 00:02:01,510 --> 00:02:08,720 And here you need to add another widget using Uruguay to create this widget into a menu. 27 00:02:09,490 --> 00:02:17,160 So here we have menu because at this point our menu button is created here. 28 00:02:17,160 --> 00:02:18,360 This is a menu button. 29 00:02:18,570 --> 00:02:24,860 But without any function so to function it you're required to create this name to a menu. 30 00:02:24,870 --> 00:02:30,040 So here we have this one menu pasta variable you need to convert. 31 00:02:30,090 --> 00:02:32,020 Here we have this one no. 32 00:02:32,250 --> 00:02:42,800 After that one you need to add this line that is M.B. square back its menu equal to M.B. not many. 33 00:02:43,740 --> 00:02:47,130 Always add this line while you're creating menus. 34 00:02:47,130 --> 00:02:51,730 I will tell you what this one in a way when we are done with this one. 35 00:02:51,810 --> 00:03:00,120 So after this one we need to add some features in this net what will be represented here like when clicking 36 00:03:00,120 --> 00:03:00,640 this one. 37 00:03:00,750 --> 00:03:08,940 These three options are popping up here so to add these requests and variables again see X1 and X2 or 38 00:03:08,940 --> 00:03:15,130 if you want to add more than two you can add more or more also Hill y variables. 39 00:03:15,200 --> 00:03:19,430 Because again these things are just taken at 0 and 1. 40 00:03:19,580 --> 00:03:25,310 Like when I did not have clicked any of these all these are on zero when I click any one of these the 41 00:03:25,310 --> 00:03:28,610 variable will win on state and that value will be won. 42 00:03:29,180 --> 00:03:40,050 So for these we will have Incredibles because they are just 0 and 1 so in red again. 43 00:03:40,050 --> 00:03:43,590 Now we have the variable and we will create the menu buttons. 44 00:03:43,600 --> 00:03:51,060 Now so for that one we have m b menu that is of M.B. here. 45 00:03:51,090 --> 00:03:58,100 This is also the menu FNB now we will add here a check button. 46 00:03:58,200 --> 00:04:03,970 Just simply add underscore check button. 47 00:04:04,090 --> 00:04:15,700 Now you can add any value here beginning with a label say open and variable is x 1. 48 00:04:15,760 --> 00:04:22,990 Now we have using this menu that we have created by using the menu widget or you can just imagine this 49 00:04:22,990 --> 00:04:24,640 one as an another variable. 50 00:04:24,730 --> 00:04:31,860 We have created the December menu by creating the end bean to a menu after this event. 51 00:04:31,870 --> 00:04:46,460 If you want to add second one this one is set close and this one x 2 than we did the after they didn't 52 00:04:46,460 --> 00:04:51,640 last just at M.B. back tobacco is ready. 53 00:04:53,180 --> 00:04:58,570 Now if you run this one they've had this one and 54 00:05:01,430 --> 00:05:08,420 when you click this one you will get these options popup here that is open and close so I hope you got 55 00:05:08,420 --> 00:05:08,880 this one. 56 00:05:08,890 --> 00:05:11,980 That's how you have created the menu button. 57 00:05:12,500 --> 00:05:18,740 And then how you have created that menu button into a menu bar so that we can have different options 58 00:05:18,740 --> 00:05:21,460 in that one that I open and close. 59 00:05:21,590 --> 00:05:28,040 Now after this one let me create a perfect menu so that we can have different options like these and 60 00:05:28,130 --> 00:05:34,100 all all which contain different options and then so let. 61 00:05:34,180 --> 00:05:40,180 Just to remove this one first and now begin with that. 62 00:05:40,480 --> 00:05:44,770 First of all we need to have a clear view that what we need to define him. 63 00:05:44,800 --> 00:05:50,930 So this one seems to be very difficult but once you understand this one this is very easy. 64 00:05:51,010 --> 00:05:52,140 So let create debt. 65 00:05:52,150 --> 00:05:59,660 But first of all we required to create a menu like this one so if you properly notice on these files 66 00:06:00,020 --> 00:06:06,560 then here we have different bunch of menu buttons and they themselves are menus when you click any of 67 00:06:06,560 --> 00:06:08,520 these you will get different options in them. 68 00:06:08,660 --> 00:06:11,990 And if you have some menus also. 69 00:06:12,030 --> 00:06:17,430 So what we are required to do here is first we need to define a menu that is this about one in that 70 00:06:17,430 --> 00:06:17,920 one. 71 00:06:18,120 --> 00:06:25,440 We again need to define these sub menus in which we have different options. 72 00:06:25,650 --> 00:06:28,440 So let's begin with Dedmon first of all. 73 00:06:28,440 --> 00:06:34,890 Before doing this one more thing that these options here menu click any of these they perform some action. 74 00:06:35,100 --> 00:06:37,220 But we are not working on actions right now. 75 00:06:37,560 --> 00:06:38,800 So what we are going to do here. 76 00:06:38,820 --> 00:06:45,270 We will send the command for each button to I don't think Come on in which a simple popup window shows 77 00:06:45,390 --> 00:06:47,180 do nothing. 78 00:06:47,390 --> 00:06:50,120 I think you understand what I'm saying here. 79 00:06:50,520 --> 00:07:00,960 Now before doing anything let me first define a function saying nothing dismount but really do whenever 80 00:07:01,050 --> 00:07:08,850 any button is clicked on our menu then it will make a top level window with a button saying do nothing. 81 00:07:08,850 --> 00:07:14,670 So you can make anything if you want or you can even loop empty but to check the buttons we are doing 82 00:07:14,670 --> 00:07:15,900 that one. 83 00:07:15,960 --> 00:07:24,710 So here we are taking an example Fi and that will be top level in window. 84 00:07:25,160 --> 00:07:30,380 So we are making a sub window and that will contain a button. 85 00:07:30,380 --> 00:07:42,770 So here we have a button in that they know that is over fight and the text on that one is do not take 86 00:07:44,450 --> 00:07:45,810 symbolized it. 87 00:07:46,350 --> 00:07:52,940 And the just button or back when something is clicked. 88 00:07:53,010 --> 00:07:55,650 So this is a function I think you understand this. 89 00:07:55,710 --> 00:08:00,050 And when I show you this one you will understand it much more better. 90 00:08:00,070 --> 00:08:02,030 Now let me create a menu. 91 00:08:02,380 --> 00:08:04,850 So creating a menu is very easy. 92 00:08:05,020 --> 00:08:08,100 You just need to create that we have a menu bar. 93 00:08:08,110 --> 00:08:15,400 This one is about is known as a menu bar and you can just clear this one simply menu and very require 94 00:08:15,430 --> 00:08:17,290 that one win. 95 00:08:17,290 --> 00:08:22,070 So at this point this one is created no now to unpack this one. 96 00:08:22,190 --> 00:08:24,080 This is the on from the last one. 97 00:08:24,310 --> 00:08:33,010 You need to do window dot configure that is for configuration of this menu bar and in that one provide 98 00:08:33,100 --> 00:08:37,510 menu name that is of a menu bar. 99 00:08:37,530 --> 00:08:39,540 So this is how you can create a menu bar. 100 00:08:40,200 --> 00:08:43,570 But right now this menu bar contains no element. 101 00:08:43,680 --> 00:08:50,100 And if you tried to run this one and three did not keep the eye you will get an empty menu bar. 102 00:08:50,250 --> 00:08:53,040 If you notice here on the above we have nothing. 103 00:08:53,100 --> 00:09:00,930 Just despite the so that's why because we don't have anything here. 104 00:09:00,930 --> 00:09:06,250 No next we add some files here just like this file added and see ahead. 105 00:09:06,600 --> 00:09:08,400 So we will add these three. 106 00:09:08,400 --> 00:09:12,910 You can add any number of menu buttons here you want to. 107 00:09:13,580 --> 00:09:16,910 So let's begin with that one here. 108 00:09:16,910 --> 00:09:20,450 I define a variable file menu here. 109 00:09:20,450 --> 00:09:21,940 This one is just a variable. 110 00:09:22,370 --> 00:09:30,670 And it contains all the files that are in this one so in short I'm just creating this one this file. 111 00:09:31,190 --> 00:09:35,700 But the back end of this file ought to see a function. 112 00:09:35,750 --> 00:09:39,970 So this one will be again a menu inside a menu. 113 00:09:39,980 --> 00:09:45,050 So understand it clearly that what I'm doing here is this one. 114 00:09:45,050 --> 00:09:52,190 This is also a menu and where it is inside this menu just like we have the top level windows like the 115 00:09:52,190 --> 00:10:00,950 one the the message box when I click this one on popup message appears so similar to that one we have 116 00:10:00,950 --> 00:10:02,240 menus inside menu. 117 00:10:02,600 --> 00:10:08,720 So first I'm creating the inside menu and then I will call it once to make this happen. 118 00:10:08,960 --> 00:10:18,310 So first of all this will be equal to menu inside our window so know no double window inside this menu 119 00:10:18,310 --> 00:10:24,290 bar because that one is inside this one. 120 00:10:24,320 --> 00:10:27,060 After that here we are done with this one. 121 00:10:27,410 --> 00:10:31,230 We have not created a file menu that is inside the menu bar. 122 00:10:31,280 --> 00:10:38,020 Now if you want to add some things like this one then we'll how to do that. 123 00:10:38,620 --> 00:10:45,540 So for creating this one just move to your notes and check the creating menu. 124 00:10:45,560 --> 00:10:46,670 Now what do you require. 125 00:10:47,320 --> 00:10:49,320 You need to add some values here. 126 00:10:49,330 --> 00:10:53,700 So if you go to the methods and look out that how can I do that. 127 00:10:53,800 --> 00:10:56,980 You will find this one add comment. 128 00:10:56,980 --> 00:11:01,190 Come on this will add some menu item to the menu. 129 00:11:01,360 --> 00:11:03,780 So you generally add these items to the menu. 130 00:11:04,450 --> 00:11:07,720 So we require these kind of fight maybe. 131 00:11:07,780 --> 00:11:13,360 So it didn't matter no let me check that do we can do something with Deadpool. 132 00:11:13,660 --> 00:11:16,070 So here how to use that matter. 133 00:11:16,270 --> 00:11:23,100 Just do a filing menu valuable to add these files dot Ed underscore. 134 00:11:23,110 --> 00:11:25,810 Come on. 135 00:11:25,920 --> 00:11:33,120 This one is not likes calling the function it generally adds the items to inside of that one just pass 136 00:11:33,120 --> 00:11:38,400 the label say like if they want this one then first of all we have new window. 137 00:11:38,730 --> 00:11:51,230 So here I have new and then Vindaloo after that one pass command that will happen on clicking that one 138 00:11:51,770 --> 00:11:53,650 and call dysfunction. 139 00:11:53,690 --> 00:11:57,170 So that's why we have defined that function. 140 00:11:57,170 --> 00:12:04,460 Now if you want to define more there just copy this one and paste it as many times as you have the number 141 00:12:04,460 --> 00:12:13,180 of commands like here we have new file open so just add few more. 142 00:12:13,400 --> 00:12:17,620 That is new file then open. 143 00:12:19,850 --> 00:12:23,510 After that when we have a close 144 00:12:26,680 --> 00:12:27,400 save 145 00:12:30,090 --> 00:12:34,660 save as or anything not necessary. 146 00:12:34,660 --> 00:12:40,240 These things say add here bugger a best friend. 147 00:12:40,930 --> 00:12:44,230 And after that one see what you like. 148 00:12:44,440 --> 00:12:49,690 Now we have look as close dead. 149 00:12:49,880 --> 00:12:52,170 So here we have closed. 150 00:12:52,820 --> 00:12:59,400 So there is no foundation you can even go from this point to up to this point adding hundreds of commands. 151 00:13:01,410 --> 00:13:04,610 Now at this point no we are done with adding the commands. 152 00:13:04,610 --> 00:13:08,710 What we need to do now is we need to make this file right now. 153 00:13:08,720 --> 00:13:09,230 One more thing. 154 00:13:09,230 --> 00:13:15,440 If you notice in this one here we have separations like the opening the file and something like that. 155 00:13:15,530 --> 00:13:17,750 We have about then we have a line separation. 156 00:13:17,750 --> 00:13:20,180 Saving these then a separation. 157 00:13:20,180 --> 00:13:21,160 Closing taps. 158 00:13:21,200 --> 00:13:25,340 So if you need these kinds of separation then we have a separate matter. 159 00:13:25,400 --> 00:13:28,050 You can also check that one here at separator. 160 00:13:28,070 --> 00:13:35,330 This one adds a separate line so to add that phone just whatever you want to add that one go to that 161 00:13:35,330 --> 00:13:41,570 point like if I have these for opening and closing files I'm adding this one here just simply file menu 162 00:13:42,250 --> 00:13:50,060 at Invesco separator as CPA order to your loss and copy this one 163 00:13:55,450 --> 00:13:58,870 and I'm adding Len after these save functions here. 164 00:13:59,260 --> 00:14:05,500 And one in the last one more thing of a menu something like not doing anything at all. 165 00:14:05,710 --> 00:14:07,000 All the functions are nothing. 166 00:14:07,240 --> 00:14:11,770 So I'm adding a command here so that it will do something right. 167 00:14:11,890 --> 00:14:23,460 It will be completely useless and that come on is say exiting to exit of a application so for that fun 168 00:14:23,640 --> 00:14:28,380 here just you in command You need to change this function that is doing nothing. 169 00:14:28,470 --> 00:14:35,130 And I have take an example of exit because that is very simple Come on just window of a window that 170 00:14:35,130 --> 00:14:38,490 is open there and quit. 171 00:14:38,510 --> 00:14:39,310 There we go. 172 00:14:39,540 --> 00:14:41,200 No panties and nothing at all. 173 00:14:42,330 --> 00:14:51,910 No at this point all this belongs to this inside function or we can see the inside menu bar. 174 00:14:52,010 --> 00:14:57,880 Now we have created this one but at this point this is not in the menu bar. 175 00:14:58,010 --> 00:15:05,540 Like if you run this one there is terminal it is due on the last one. 176 00:15:05,590 --> 00:15:11,540 Now if you run this one you will not get anything there but you have created all this. 177 00:15:11,640 --> 00:15:19,740 The reason for that one is you need to attach this file menu to this menu but this is already in the 178 00:15:19,740 --> 00:15:20,400 menu bar. 179 00:15:20,730 --> 00:15:26,240 But again it requires attachment and to attach any menu to the other. 180 00:15:26,250 --> 00:15:29,640 Here we have a function that is known as Ed cascade. 181 00:15:29,820 --> 00:15:36,390 It will create a new had called menu by associating a given menu to the pad and menu means it's creating 182 00:15:36,390 --> 00:15:37,900 a menu inside the pattern. 183 00:15:38,610 --> 00:15:41,160 So for that one you need to remember. 184 00:15:41,160 --> 00:15:48,710 Come on and need to always use this one that is of a menu bar underscored. 185 00:15:48,840 --> 00:15:54,570 So we don't underscore and underscore guest good. 186 00:15:55,590 --> 00:16:00,120 So you need to use this method here at underscore tested. 187 00:16:00,250 --> 00:16:05,030 And in that one provide what you are adding them with a label. 188 00:16:05,040 --> 00:16:08,580 So like I need to add this label fight. 189 00:16:08,700 --> 00:16:09,860 Same to same. 190 00:16:09,870 --> 00:16:20,070 So hey I have five and I'm adding here my menu that is file menu Libya this one. 191 00:16:20,220 --> 00:16:28,420 Now if you'll save this one and run it again here you get this file as you can notice here in this one 192 00:16:28,420 --> 00:16:32,620 you are not getting something because this means Mac in Mac we have a bunch of options here. 193 00:16:32,950 --> 00:16:38,440 But if you are using Windows then you are maybe you are getting here all the options so don't worry 194 00:16:38,440 --> 00:16:41,710 about that one will you are getting just you are getting that is perfect. 195 00:16:42,850 --> 00:16:47,860 So if you click that one you will have all these options here that we have written him new window new 196 00:16:47,860 --> 00:16:55,990 file open that is open in a spelling mistake then closed saves savers and these lines well we can say 197 00:16:55,990 --> 00:16:59,990 these separators then debugger closed tab and exit. 198 00:17:00,130 --> 00:17:06,710 And if you click on any of these our do nothing function look here are top level window popup which 199 00:17:06,710 --> 00:17:08,970 is showing donating button. 200 00:17:09,040 --> 00:17:18,480 So this one is a button not a label because we have added a button in that date is now of only [REMOVED] 201 00:17:18,990 --> 00:17:23,190 element here that is except when you click this one the application closed. 202 00:17:23,190 --> 00:17:25,500 So in that case you do not reply to that one. 203 00:17:26,730 --> 00:17:30,240 Now we are done with this one just open. 204 00:17:30,840 --> 00:17:35,040 Now if you want to add more like we are going for EDIT also. 205 00:17:35,350 --> 00:17:39,760 Then this same operation like this one still photo. 206 00:17:39,770 --> 00:17:51,650 We have see added menu and that will be menu in Pence's bus menu but day we have this one after that 207 00:17:51,650 --> 00:17:58,580 one provide options like these in added We have unloaded all cut copy paste. 208 00:17:58,880 --> 00:18:01,010 So let me try some of these. 209 00:18:01,160 --> 00:18:03,560 So for that copy this one. 210 00:18:03,560 --> 00:18:08,310 So it is not required to do again and again Come on see and come on. 211 00:18:08,310 --> 00:18:13,420 V here just JS this file menu to add it. 212 00:18:14,120 --> 00:18:23,730 And let me do something as you instead of changing in every one just copy that one Oh dear we have. 213 00:18:23,760 --> 00:18:27,300 I think these are enough close to one. 214 00:18:27,570 --> 00:18:35,110 I know then we have real after dead got 215 00:18:37,800 --> 00:18:51,390 Kobe and after dead we have this one say based what has them select olds and say this one Dexter lines 216 00:18:53,060 --> 00:18:54,290 so select all 217 00:18:57,370 --> 00:18:58,520 or just add in last. 218 00:18:58,520 --> 00:19:01,680 The execution date need to be a next it everywhere. 219 00:19:04,290 --> 00:19:07,740 We have an exit and the lines appear to copy from there. 220 00:19:08,700 --> 00:19:12,460 One after these undo and redo one after this. 221 00:19:12,750 --> 00:19:13,720 We have this. 222 00:19:13,980 --> 00:19:15,790 Now a menu what is also. 223 00:19:15,900 --> 00:19:18,460 So the edit board is also created. 224 00:19:18,570 --> 00:19:23,340 So if you see him first one is very difficult to create. 225 00:19:23,360 --> 00:19:28,890 It required a lot of functions there but once you get that one then destroyed. 226 00:19:29,040 --> 00:19:38,260 This begins very easy so just make a little practice of this one so that you will get comfortable with 227 00:19:38,260 --> 00:19:41,350 this one and then you will never forget anything about this. 228 00:19:41,350 --> 00:19:42,800 Now here we have done with this one. 229 00:19:44,320 --> 00:19:52,720 Now the second step you need to cascade this one so the cascade land copied the base that will hit and 230 00:19:52,790 --> 00:19:59,640 instead of that one here we have no added Min save this one and this one also edit 231 00:20:03,360 --> 00:20:05,330 now say this come on us. 232 00:20:05,870 --> 00:20:10,690 And if you run this one now we will get to menu here. 233 00:20:10,860 --> 00:20:12,390 That is just one file. 234 00:20:12,450 --> 00:20:13,340 Second one. 235 00:20:13,420 --> 00:20:18,700 Edit And don't cut paste all these exit and we have two more. 236 00:20:19,050 --> 00:20:25,150 Maybe because of added them in file of an openness also changed. 237 00:20:25,150 --> 00:20:29,790 And again if you click exit we are doing nothing. 238 00:20:29,790 --> 00:20:30,180 Why. 239 00:20:31,580 --> 00:20:34,130 Because we have not added the command of exit here. 240 00:20:34,130 --> 00:20:35,780 We have just nothing there. 241 00:20:36,710 --> 00:20:40,710 So only when don't quit. 242 00:20:41,000 --> 00:20:45,310 You know defenses save this one and try this one now. 243 00:20:47,750 --> 00:20:53,560 So there we go with that exit and the application is closed now. 244 00:20:53,570 --> 00:20:55,650 I hope you got that one right now. 245 00:20:55,730 --> 00:21:01,350 So there is no need to add another help option here I believe because the video is already too long. 246 00:21:01,410 --> 00:21:02,670 Will get bored with that. 247 00:21:03,110 --> 00:21:04,990 So I am skipping the last one. 248 00:21:05,150 --> 00:21:10,190 I believe you will do that one and this is enough for understanding the menu. 249 00:21:10,310 --> 00:21:13,100 So thanks for watching and see you later.