#import "WhatButtonObject.h"

@implementation WhatButtonObject

- (void)AddARadioButton:(id)sender
{
	// This method adds a new radio button to the ButtonBox matrixs
        [ButtonBox insertRow:5]; // Adds a new row to the radio button matrix
        [ButtonBox sizeToCells]; // resizes the matrix frame to contain all the cells
        [ButtonBox display]; // display the ButtonBox matrix
}

- (void)ButtonA:(id)sender
{
	// This method simply displays which button was pressed in the ActionDisplay
    	[ActionDisplay setStringValue:@"Button A Selected"];
}

- (void)ButtonB:(id)sender
{
    	// This method simply displays which button was pressed in the ActionDisplay
    	[ActionDisplay setStringValue:@"Button B Selected"];
}

- (void)ButtonC:(id)sender
{
    	// This method simply displays which button was pressed in the ActionDisplay
    	[ActionDisplay setStringValue:@"Button C Selected"];
}

- (void)FindButton:(id)sender
{
    // This method checks what is the number of the
    // tag of the current selected radio button.
    
    int WhichOne;
    WhichOne = [ButtonBox selectedTag]; // assigns the value of the currently selected button
                                        // using tag as a reference.

    [NSelectedButton setIntValue:WhichOne]; // display the value of the tag in the form
    
    
}

- (void)RemoveARadioButton:(id)sender
{
    	// This method will remove a radio button from the ButtonBox matrix
 	[ButtonBox removeRow:5]; // Remove a row from matrix and frees the cell
       	[ButtonBox display]; // display the ButtonBox matrix
}

- (void)selectButton0:(id)sender
{
    	// This simply selects the proper radio button using the tag.	
    
        [ButtonBox selectCellWithTag:0]; // This will select radio button number 0
}

- (void)selectButton1:(id)sender
{
	// This simply selects the proper radio button using the tag.
    	[ButtonBox selectCellWithTag:1]; // This will select radio button number 1
    
}

- (void)selectButton2:(id)sender
{
    	// This simply selects the proper radio button using the tag.
    	[ButtonBox selectCellWithTag:2]; // This will select radio button number 2
}

- (void)selectButton3:(id)sender
{
	// This simply selects the proper radio button using the tag.
	[ButtonBox selectCellWithTag:3]; // This will select radio button number 3
}

- (void)selectButton4:(id)sender
{
	// This simply selects the proper radio button using the tag.
	[ButtonBox selectCellWithTag:4]; // This will select radio button number 4
}

@end
