1
00:00:00,510 --> 00:00:05,830
Hello, everyone, in the last video, I have shown you how you can create a new window, which means

2
00:00:05,830 --> 00:00:10,480
a second window, adding, adding it to the main window.

3
00:00:10,890 --> 00:00:17,520
No, I will show you how you can park something on this new window, for example, a label or button,

4
00:00:17,600 --> 00:00:23,970
etc. in you do show you how you can use or how you can you add a label.

5
00:00:24,180 --> 00:00:26,730
But it is the same thing for the other items.

6
00:00:26,730 --> 00:00:31,250
You can use the same thing for to use a button or excel.

7
00:00:31,650 --> 00:00:37,980
So to use to add the button a label, sorry, the first thing that you have to do is to create it as

8
00:00:37,980 --> 00:00:38,400
always.

9
00:00:38,410 --> 00:00:47,400
So we will create label, label, equal label here so that the function and here before, before that

10
00:00:47,400 --> 00:00:53,990
we had we will not hear the name of the launch window because we had just one window.

11
00:00:54,000 --> 00:00:56,060
But in this case we have two windows.

12
00:00:56,070 --> 00:01:03,960
But our project was that we like this label or we put this label in the second window, which is the

13
00:01:03,960 --> 00:01:04,580
new window.

14
00:01:04,740 --> 00:01:11,520
So he will write the name of this new window, which means which is new, because if we write this,

15
00:01:11,520 --> 00:01:18,060
as I told you before, if we write here the name of the window, for example, new means that this label

16
00:01:18,060 --> 00:01:20,540
is special to this new window.

17
00:01:21,000 --> 00:01:25,600
So so here we have the name of the window, which is new.

18
00:01:25,920 --> 00:01:28,590
Now, the other parameters, the same thing.

19
00:01:28,590 --> 00:01:31,240
For example, here we have we will make the text, for example.

20
00:01:31,260 --> 00:01:33,890
Hi, how are you.

21
00:01:34,860 --> 00:01:37,830
And we will do nothing for anything for the full text.

22
00:01:37,830 --> 00:01:41,630
So I will like this one because it doesn't matter for the moment.

23
00:01:42,660 --> 00:01:44,300
No, we will back it.

24
00:01:44,310 --> 00:01:56,100
So we just right here love point back in this case, we will back this label in the new in the new window.

25
00:01:56,700 --> 00:01:59,240
So we will have the same thing here.

26
00:01:59,250 --> 00:02:02,490
We have this button that this window and the button.

27
00:02:02,490 --> 00:02:07,510
If we pressed the button, we will have this new window with this label, which is, hi, how are you?

28
00:02:07,830 --> 00:02:11,580
But if we press the button another time, we will have new in another window.

29
00:02:11,580 --> 00:02:13,980
And if we press another thing, we have new window.

30
00:02:14,340 --> 00:02:20,730
But it's not professional because the project say that if you press here, we will have a new window.

31
00:02:21,510 --> 00:02:27,570
But if you press another time and this window is always, always open, we can't.

32
00:02:27,570 --> 00:02:30,450
We won't we don't want to have another window.

33
00:02:30,630 --> 00:02:37,100
So if we have these two cases, if we have no window and we press the button, we will have we will

34
00:02:37,140 --> 00:02:37,860
create one.

35
00:02:38,460 --> 00:02:43,710
But if the window is always open, if we press here, we don't want to have another one.

36
00:02:43,950 --> 00:02:47,120
So to fix this, we make some changes in our program.

37
00:02:47,610 --> 00:02:52,800
The first thing that we have to do is to declare a variable, a temporary variable that will take the

38
00:02:52,800 --> 00:02:55,460
rule of the opening window or closed.

39
00:02:55,830 --> 00:03:01,610
So we will call it, for example, of Ola or I will be, for example.

40
00:03:02,310 --> 00:03:04,230
So I will make it global.

41
00:03:04,680 --> 00:03:09,360
So global value will be and I will put it outside the function.

42
00:03:09,360 --> 00:03:13,980
I will give it to value zero, initialize it to the value zero.

43
00:03:14,610 --> 00:03:16,680
Then this with new window.

44
00:03:16,680 --> 00:03:22,980
I will put it global two because we need it for the conditions that will come next.

45
00:03:23,310 --> 00:03:26,040
So we will continue the same thing here.

46
00:03:26,040 --> 00:03:29,010
We will give it, we will give it a place in the memory.

47
00:03:29,040 --> 00:03:32,260
So we will give it the you or not which means empty.

48
00:03:32,850 --> 00:03:41,700
So here we have these two variables is B is a temporary one, but it will take the load of the closed

49
00:03:41,700 --> 00:03:42,690
window or opened.

50
00:03:43,170 --> 00:03:49,920
Then we have here this global variable, which is new that will have the value of this window, the

51
00:03:49,920 --> 00:03:50,460
new window.

52
00:03:50,850 --> 00:03:54,210
So I we got all this for the moment.

53
00:03:54,720 --> 00:03:55,170
No.

54
00:03:55,650 --> 00:04:03,850
So we have to cut all this with the label because the the creation of the label is included with the

55
00:04:03,870 --> 00:04:04,850
creation of the window.

56
00:04:04,860 --> 00:04:06,360
So we will cut all this.

57
00:04:06,930 --> 00:04:15,450
No, as we said, we want that if this temporary variable, for example, if this V equals zero, means

58
00:04:15,450 --> 00:04:23,790
that we we haven't created any if if the be equal zero, that means that we haven't created any windows

59
00:04:23,790 --> 00:04:24,060
yet.

60
00:04:24,450 --> 00:04:26,760
So here we will create a new one.

61
00:04:27,240 --> 00:04:34,950
So we will put this line of code which will create the window and give it name and icon zero and the

62
00:04:34,950 --> 00:04:42,450
label to then if this B doesn't equal zero means that we have created a window.

63
00:04:42,780 --> 00:04:45,000
But if we created a window, that is true.

64
00:04:45,000 --> 00:04:51,270
In other cases, there is the first case, which is we created a window, then we closed it and there

65
00:04:51,270 --> 00:04:57,060
is another case which is we created a window but is all always open open.

66
00:04:57,270 --> 00:04:59,790
So in this case, we will create we will make another.

67
00:05:00,390 --> 00:05:04,420
For example, here we have El Al means that this doesn't equal zero.

68
00:05:04,840 --> 00:05:06,420
No, we will do this.

69
00:05:06,420 --> 00:05:14,640
We do a condition to verify these two cases, which is we have created a window then we it or we have

70
00:05:14,640 --> 00:05:15,630
created a window.

71
00:05:15,810 --> 00:05:18,990
But it is always created in this case.

72
00:05:18,990 --> 00:05:20,530
I forgot something here.

73
00:05:20,820 --> 00:05:26,540
If we create a window, so in this case we have created a window, so we will both be equal.

74
00:05:26,700 --> 00:05:31,190
One means that if be equal one, that means that we have created a window.

75
00:05:31,980 --> 00:05:38,880
Now here we will make a condition that is a function called Infl Windows eight for exists.

76
00:05:39,570 --> 00:05:46,380
This function we will return to if the window is open, so we will use it here.

77
00:05:46,380 --> 00:05:47,640
If new.

78
00:05:47,910 --> 00:05:54,190
That info exists means if the window exists, it is not closed.

79
00:05:54,210 --> 00:05:55,570
It is always open.

80
00:05:55,890 --> 00:06:00,330
In this case, we will both be equal one sorry, equal one.

81
00:06:01,110 --> 00:06:07,950
But if it is not it it doesn't exist means that we have created a window.

82
00:06:07,950 --> 00:06:09,470
But we closed it after this.

83
00:06:09,960 --> 00:06:15,900
In this case we will create a new window, which is we will put these lines of code so we see if it

84
00:06:15,900 --> 00:06:16,380
works.

85
00:06:16,380 --> 00:06:18,150
Here we have the main window.

86
00:06:18,480 --> 00:06:20,600
If we press the button, we have this new window.

87
00:06:20,610 --> 00:06:21,870
If we press another time.

88
00:06:26,880 --> 00:06:35,120
So if we're on our program here, we see that this is the first window, so there is a problem here.

89
00:06:37,720 --> 00:06:38,680
We will see the program.

90
00:06:42,460 --> 00:06:46,490
All right, and so we run our program.

91
00:06:49,150 --> 00:06:51,700
He had our window set up,

92
00:06:56,260 --> 00:07:02,710
so if we were on our program, you can see this is our main window, if we press the button, we have

93
00:07:02,710 --> 00:07:03,570
this new window.

94
00:07:03,910 --> 00:07:07,360
If you press another time, I'm sorry, there is new window.

95
00:07:07,360 --> 00:07:09,520
There is a problem in the code.

96
00:07:10,100 --> 00:07:12,090
We see it here.

97
00:07:13,330 --> 00:07:14,170
This is the problem.

98
00:07:14,180 --> 00:07:15,540
The two equals here.

99
00:07:16,000 --> 00:07:18,320
So we will run it another time.

100
00:07:18,970 --> 00:07:20,050
This is the window.

101
00:07:20,200 --> 00:07:23,180
If we press another time, there is no other window.

102
00:07:23,200 --> 00:07:25,650
This is just where there is just one window.

103
00:07:26,020 --> 00:07:29,430
If you close it and we press another time, we have this new one.

104
00:07:30,550 --> 00:07:41,220
So that was the code of today, how to make a label in a new window and how to fix that problem too.

105
00:07:41,500 --> 00:07:45,480
Don't open a lot of windows when we press the button.

106
00:07:46,360 --> 00:07:49,930
So I see you in the next video and stay safe by.
