Newbie needs help on simple app

bietbox

Registered
hi, can anyone help me on a small app?

It's a cocoa application. I have created 1 NSTextField and 2 NSButton , all linked to a new instance called "subbox".

Its a "subtract 50$ / Add 50$ to dept"application (everytime u click on the button ur "stash" will rise/fall) At the beginning the variable "dept" (shown on the NSTextField) will be 1000$

Can u help me with that? Here are the subbox.h & subbox.m

SUBBOX.m:
"#import "subbox.h"

@implementation subbox

// #1 set "dept" to "1000"
- (IBAction)add:(id)sender // it shall add 50$ to the "dept" (= textbox)

{
}

- (IBAction)subtract:(id)sender // it shall subtract 50$ from the "dept" (=textbox) if "dept ? 0" (its not possible to get below 0)
{
}

@end"

---------------------------------------------------------------------------------
SUBBOX.h
"/* subbox */

#import <Cocoa/Cocoa.h>

@interface subbox : NSObject
{
IBOutlet id dept;
}
- (IBAction)add:(id)sender;
- (IBAction)subtract:(id)sender;
@end
"

HELP ME PLEASE
 
You may want to post that code within the [ code] tag. It's probably getting messed up the way it's displayed right now (for example, all those :()
 
SUBBOX.m:
Code:
#import "subbox.h"

@implementation subbox

- (IBAction)add:(id)sender // it shall add 50$ to the "dept" (= textbox)
{
}
- (IBAction)subtract:(id)sender // it shall subtract 50$ from the "dept" (=textbox) if "dept ? 0" (its not possibleto get below 0)
{
}

@end

SUBBOX.h:
Code:
/* subbox */

#import <Cocoa/Cocoa.h>

@interface subbox : NSObject
{
    IBOutlet id dept;
}
- (IBAction)add:(id)sender;
- (IBAction)subtract:(id)sender;
@end
 
No, there is an option in the Advanced Reply page that will let you do something like this:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" ?>
<html lang="en">
	<head>
		<title>Calendar detail</title>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" href="../css/globalstyle.css" type="text/css" />
		<link rel="stylesheet" href="../css/calendar.css" type="text/css" />
	</head>
	<body>

		<div class="detail">
			<table class="detailTable" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<?php	while ($row = mysql_fetch_assoc($result)) { ?>
					<td class="headers">
						<label><?php print "$row[shortevent]"; ?></label>	
					</td>
				</tr>
				<tr>
					<td class="content">
						<p><?php print "$row[longevent]"; ?></p>
					</td>
					<?php } ?>
				</tr>
			</table>
		</div>
		
	</body>
</html>
 
Code:
- (IBAction)add:(id)sender // it shall add 50$ to the "dept" (= textbox)
{

     [dept setIntValue:[dept intValue] + 50];

}
- (IBAction)subtract:(id)sender // it shall subtract 50$ from the "dept" (=textbox) if "dept ? 0" (its not possibleto get below 0)
{
     int curValue = [dept intValue];

     if ( curValue >= 50 )
       [dept setIntValue:curValue - 50];
     else
       [dept setIntValue:0];
}
 
Back
Top