You are on page 1of 7

function varargout = kalkulatorsederhana(varargin)

% KALKULATORSEDERHANA MATLAB code for kalkulatorsederhana.fig


% KALKULATORSEDERHANA, by itself, creates a new KALKULATORSEDERHANA or
raises the existing
% singleton*.
%
% H = KALKULATORSEDERHANA returns the handle to a new
KALKULATORSEDERHANA or the handle to
% the existing singleton*.
%
% KALKULATORSEDERHANA('CALLBACK',hObject,eventData,handles,...) calls
the local
% function named CALLBACK in KALKULATORSEDERHANA.M with the given
input arguments.
%
% KALKULATORSEDERHANA('Property','Value',...) creates a new
KALKULATORSEDERHANA or raises the
% existing singleton*. Starting from the left, property value pairs
are
% applied to the GUI before kalkulatorsederhana_OpeningFcn gets
called. An
% unrecognized property name or invalid value makes property
application
% stop. All inputs are passed to kalkulatorsederhana_OpeningFcn via
varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help kalkulatorsederhana

% Last Modified by GUIDE v2.5 04-Dec-2017 14:49:17

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @kalkulatorsederhana_OpeningFcn, ...
'gui_OutputFcn', @kalkulatorsederhana_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before kalkulatorsederhana is made visible.


function kalkulatorsederhana_OpeningFcn(hObject, eventdata, handles,
varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to kalkulatorsederhana (see VARARGIN)

% Choose default command line output for kalkulatorsederhana


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes kalkulatorsederhana wait for user response (see UIRESUME)


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = kalkulatorsederhana_OutputFcn(hObject, eventdata,
handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure


varargout{1} = handles.output;
function tbhasil_Callback(hObject, eventdata, handles)
% hObject handle to tbhasil (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of tbhasil as text


% str2double(get(hObject,'String')) returns contents of tbhasil as a
double

% --- Executes during object creation, after setting all properties.


function tbhasil_CreateFcn(hObject, eventdata, handles)
% hObject handle to tbhasil (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in tb0.


function tb0_Callback(hObject, eventdata, handles)
global jj
textString = get(handles.tbhasil,'String');
if(strcmp(textString,'0.')==1)&&(jj==0)
set(handles.tbhasil,'String','0') ;
else
textString =strcat(textString,'0');
set(handles.tbhasil,'String',textString);
end
jj=0;
% hObject handle to tb0 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in tb1.


function tb1_Callback(hObject, eventdata, handles)
global jj
textString = get(handles.tbhasil,'String');
if(strcmp(textString,'0.')==1)&&(jj==0)
set(handles.tbhasil,'String','1') ;
else
textString =strcat(textString,'1');
set(handles.tbhasil,'String',textString);
end
jj=0;
% hObject handle to tb1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in tb2.


function tb2_Callback(hObject, eventdata, handles)
global jj
textString = get(handles.tbhasil,'String');
if(strcmp(textString,'0.')==1)&&(jj==0)
set(handles.tbhasil,'String','2') ;
else
textString =strcat(textString,'2');
set(handles.tbhasil,'String',textString);
end
jj=0;
% hObject handle to tb2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in tb3.


function tb3_Callback(hObject, eventdata, handles)
global jj
textString = get(handles.tbhasil,'String');
if(strcmp(textString,'0.')==1)&&(jj==0)
set(handles.tbhasil,'String','3') ;
else
textString =strcat(textString,'3');
set(handles.tbhasil,'String',textString);
end
jj=0;
% hObject handle to tb3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in tb4.


function tb4_Callback(hObject, eventdata, handles)
global jj
textString = get(handles.tbhasil,'String');
if(strcmp(textString,'0.')==1)&&(jj==0)
set(handles.tbhasil,'String','4') ;
else
textString =strcat(textString,'4');
set(handles.tbhasil,'String',textString);
end
jj=0;
% hObject handle to tb4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in tb5.


function tb5_Callback(hObject, eventdata, handles)
global jj
textString = get(handles.tbhasil,'String');
if(strcmp(textString,'0.')==1)&&(jj==0)
set(handles.tbhasil,'String','5') ;
else
textString =strcat(textString,'5');
set(handles.tbhasil,'String',textString);
end
jj=0;
% hObject handle to tb5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in tb6.
function tb6_Callback(hObject, eventdata, handles)
global jj
textString = get(handles.tbhasil,'String');
if(strcmp(textString,'0.')==1)&&(jj==0)
set(handles.tbhasil,'String','6') ;
else
textString =strcat(textString,'6');
set(handles.tbhasil,'String',textString);
end
jj=0;
% hObject handle to tb6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in tb7.


function tb7_Callback(hObject, eventdata, handles)
global jj
textString = get(handles.tbhasil,'String');
if(strcmp(textString,'0.')==1)&&(jj==0)
set(handles.tbhasil,'String','7') ;
else
textString =strcat(textString,'7');
set(handles.tbhasil,'String',textString);
end
jj=0;
% hObject handle to tb7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in tb8.


function tb8_Callback(hObject, eventdata, handles)
global jj
textString = get(handles.tbhasil,'String');
if(strcmp(textString,'0.')==1)&&(jj==0)
set(handles.tbhasil,'String','8') ;
else
textString =strcat(textString,'8');
set(handles.tbhasil,'String',textString);
end
jj=0;
% hObject handle to tb8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in tb9.


function tb9_Callback(hObject, eventdata, handles)
global jj
textString = get(handles.tbhasil,'String');
if(strcmp(textString,'0.')==1)&&(jj==0)
set(handles.tbhasil,'String','9') ;
else
textString =strcat(textString,'9');
set(handles.tbhasil,'String',textString);
end
jj=0;
% hObject handle to tb9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

function edit2_Callback(hObject, eventdata, handles)


% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit2 as text


% str2double(get(hObject,'String')) returns contents of edit2 as a
double

% --- Executes during object creation, after setting all properties.


function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit3_Callback(hObject, eventdata, handles)


% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit3 as text


% str2double(get(hObject,'String')) returns contents of edit3 as a
double

% --- Executes during object creation, after setting all properties.


function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in tbplus.


function tbplus_Callback(hObject, eventdata, handles)
textString = get(handles.tbhasil,'String');
textString =strcat(textString,'+');
set(handles.tbhasil,'String',textString)
% hObject handle to tbplus (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in tbmin.


function tbmin_Callback(hObject, eventdata, handles)
textString = get(handles.tbhasil,'String');
textString =strcat(textString,'-');
set(handles.tbhasil,'String',textString)
% hObject handle to tbmin (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in tbkali.


function tbkali_Callback(hObject, eventdata, handles)
textString = get(handles.tbhasil,'String');
textString =strcat(textString,'*');
set(handles.tbhasil,'String',textString)
% hObject handle to tbkali (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in tbbagi.


function tbbagi_Callback(hObject, eventdata, handles)
textString = get(handles.tbhasil,'String');
textString =strcat(textString,'/');
set(handles.tbhasil,'String',textString)
% hObject handle to tbbagi (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in tbclear.


function tbclear_Callback(hObject, eventdata, handles)
set(handles.tbhasil,'String','') ;
% hObject handle to tbclear (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in tbenter.


function tbenter_Callback(hObject, eventdata, handles)
textString = get(handles.tbhasil,'String');
ans =eval(textString);
set(handles.tbhasil,'String',ans)
% hObject handle to tbenter (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

You might also like