View Single Post
  #1  
Old 07-05-2011, 08:32 AM
Twilikari Twilikari is offline
Registered User
Twilikari's Avatar
Join Date: Nov 2010
Location: America
Posts: 86
Twilikari is on a distinguished road
Calculator GUI Help

I was practicing my scriting, and I somewhat succesfully FIXED a calculator script. Too some of you, it may look veryyyy familiar. But I wanted to take it one step further. i wanted to make into a fully operational calculator GUI. I've never even attempted to make a GUI however, and I am completely lost. Any help is greatly appreciated!

I'm not looking for someone to do it for me, more of guide me. I want buttons for numbers in the GUI, and some kind of output for the answer.

PHP Code:
function onCreated() {
  
temp.a = 2;
  
temp.b = 1;
  
temp.c = 3;
  
temp.a = onAdd(temp.a, temp.b);
  
onResult(temp.a);  
  
temp.a = onSubtract(temp.a, temp.c);
  
onResult(temp.a);  
  
temp.a = onDivide(temp.b, temp.a);
  
onResult(temp.a);  
  
temp.a = onMultiply(temp.b + 1, temp.c);
  
onResult(temp.a);  
}

function 
onResult(temp.result) {
  echo(
"Result: " @ temp.result);
}

function 
onAdd(a, b) {
  
a = a+b;
  return 
a;
}

function 
onSubtract(a, b) {
  
a = a - b;
  return 
a;
}

function 
onDivide(a, b) {  
  if (
b == 0) {
    
a = "Error: Can't divide by 0!";
  } 
  if (
b != 0) {
    
a = a / b ;
  }  
  return 
a;
}

function 
onMultiply(a, b) {
  
a = a * b;
  return 
a;
} 
Thank's for the help, in advance! ^~^
Reply With Quote