1
00:00:00,510 --> 00:00:01,580
Hello and welcome.

2
00:00:01,620 --> 00:00:13,740
In this lecture we are going to create the method for the operator click event just like we did with

3
00:00:13,740 --> 00:00:15,440
the button click.

4
00:00:15,540 --> 00:00:26,550
We are going to create a single method for the operator click event so I click on the one of the operators

5
00:00:26,580 --> 00:00:32,160
which is the addition of the plus and I click here to access the events.

6
00:00:32,160 --> 00:00:36,750
So under here I'm going to tie pin operator

7
00:00:42,600 --> 00:00:45,260
on this call click.

8
00:00:46,440 --> 00:00:52,100
So operator on this call click OK.

9
00:00:52,130 --> 00:01:01,570
So the to access the code behind that is just double click inside here and that will open up the event.

10
00:01:01,630 --> 00:01:11,380
So I'll just go back to the designer and what I'm going to do is copy this operator click and then use

11
00:01:11,380 --> 00:01:15,990
that for whole the rest of the operator so I click on the minus.

12
00:01:16,420 --> 00:01:22,090
I've come here a paste multiplication come here.

13
00:01:22,090 --> 00:01:25,600
Paste the vision come here.

14
00:01:25,600 --> 00:01:33,070
Paste doing it this way makes all the operators access a single method.

15
00:01:33,070 --> 00:01:34,570
It's you know it's easier.

16
00:01:34,570 --> 00:01:38,020
You write less code.

17
00:01:38,500 --> 00:01:48,400
The first thing we want to do is create some variables that will store the operator value so any when

18
00:01:48,400 --> 00:01:52,590
the appraisal values are clicked the value you want to store inside variables.

19
00:01:52,870 --> 00:02:01,090
So gonna give defined that variables right at the top here gonna define it inside the class.

20
00:02:01,210 --> 00:02:03,320
So let's create the first parable.

21
00:02:03,370 --> 00:02:10,710
We're gonna make it a double data type and give it a name.

22
00:02:10,710 --> 00:02:17,500
Can I give you the name of results.

23
00:02:18,150 --> 00:02:19,510
I'll call it result value.

24
00:02:22,780 --> 00:02:23,450
Okay.

25
00:02:23,470 --> 00:02:31,300
And I'll set the initial value to 0.

26
00:02:31,960 --> 00:02:35,230
Next variable I want to create is a string data type

27
00:02:37,870 --> 00:02:40,390
and I'll call a swan

28
00:02:43,360 --> 00:02:44,790
operator

29
00:02:51,700 --> 00:02:55,210
operator clicked

30
00:02:58,260 --> 00:03:08,870
call the operator clicked and I'll set the value to a blank value for now.

31
00:03:09,120 --> 00:03:10,880
All right.

32
00:03:11,730 --> 00:03:12,430
So let's go.

33
00:03:12,430 --> 00:03:20,890
Not that we define the variables let's call back to the actual method here.

34
00:03:21,400 --> 00:03:24,660
So we're going to define a piece of code here.

35
00:03:24,760 --> 00:03:28,730
I'm gonna do I'm gonna just copy this line here.

36
00:03:28,780 --> 00:03:37,940
We're going to reference that now pays that there next.

37
00:03:38,140 --> 00:03:48,630
I need to reference the variable I created which is the operator click variable.

38
00:03:49,090 --> 00:04:00,060
This variable here I referenced that and I am going to set that to equals to button

39
00:04:02,590 --> 00:04:03,750
dot Tex

40
00:04:09,480 --> 00:04:22,200
next some want to do is to pass the value from this result box in to the into the string.

41
00:04:22,200 --> 00:04:29,850
This operation operator clicked someone to the past value into that so to do that and it specified some

42
00:04:29,850 --> 00:04:31,840
code here.

43
00:04:32,100 --> 00:04:37,190
So I'm going to reference the resultant value here which is is variable here.

44
00:04:37,200 --> 00:04:38,500
It said double.

45
00:04:38,630 --> 00:04:41,030
Someone would come here and reference it.

46
00:04:41,190 --> 00:04:42,860
So I type in results

47
00:04:47,470 --> 00:04:49,540
result in value.

48
00:04:51,070 --> 00:05:00,510
And I'm going to set it because the result value here it's a double data type.

49
00:05:00,660 --> 00:05:10,390
Need to do some conversion so that it can recognize that so I'm going to use a method called double

50
00:05:10,390 --> 00:05:13,830
the pass to do the conversion.

51
00:05:13,840 --> 00:05:21,180
So it will pass the message from the text box and convert it.

52
00:05:21,580 --> 00:05:29,440
So it will convert whatever message is in this result box and convert it into the relevant value.

53
00:05:31,330 --> 00:05:37,080
So inside this parenthesis here I need to specify the result.

54
00:05:37,090 --> 00:05:45,720
The net result I need to call this value not text.

55
00:05:46,320 --> 00:05:52,380
So that's where the conversion will take place so it will convert whatever is passed into that result

56
00:05:52,380 --> 00:05:54,870
box.

57
00:05:54,870 --> 00:05:56,700
So one more thing I like to do.

58
00:05:56,700 --> 00:06:01,060
Before we wrap up this idea I want to implement some code for this clear button here.

59
00:06:01,120 --> 00:06:06,870
I'm just going to double click on it and implement some code.

60
00:06:06,870 --> 00:06:15,330
So we've now implemented the method or the code for the operator or click event.

61
00:06:15,390 --> 00:06:25,390
We've also created some code for the club button so that you can clear the content of the result box.

62
00:06:25,410 --> 00:06:33,180
Let's quickly run the program a click start and then we can test the the operators this operators will

63
00:06:33,180 --> 00:06:37,220
not work at the moment because we have not written the code for the equals 2.

64
00:06:37,230 --> 00:06:43,410
So we're gonna implement some code for these equals to before these won't will work but we can test

65
00:06:43,410 --> 00:06:44,480
that declared button.

66
00:06:44,490 --> 00:06:49,380
Now if I type in seven eight nine I click on Claire.

67
00:06:49,470 --> 00:06:51,490
She returned to zero.

68
00:06:51,510 --> 00:06:51,860
All right.

69
00:06:51,890 --> 00:06:58,380
So the Claire button works for the OP for these operators to be activated.

70
00:06:58,380 --> 00:07:07,620
We need to implement the code for the equals 2 and that will then work in tandem with these operators.

71
00:07:07,620 --> 00:07:11,590
For now we are going to I'm going to end this lecture here.

72
00:07:11,610 --> 00:07:13,170
Thank you so much for your time.

73
00:07:13,170 --> 00:07:14,120
Take care.

74
00:07:14,400 --> 00:07:15,600
Bye for now.

75
00:07:15,600 --> 00:07:20,690
In the next lecture we will try and implement the code for this equals to sign.

76
00:07:21,600 --> 00:07:22,190
Bye for now.
