function draw_onto( object, parent_handle )
%DRAW_ONTO Draws the controls onto the parent_handle.  This function needs
%to be called everytime an update happens.
%   This function draws the entire handle onto the handle.  This function
%   needs to be called everytime the back table is updated.  The class will
%   notify when its necessary.

    %Need to invert y, so need total size
    [~, y] = object.get_bounding_box();

    % First delete an extra controls
    if size(object.controls, 2) > object.my_table_grid.width
        delete(object.controls(:, object.my_table_grid.width+1:size(object.controls, 2)));
        object.controls(:, object.my_table_grid.width+1:size(object.controls, 2)) = [];
    end
    assert( ~(size(object.controls, 2) > object.my_table_grid.width), 'Implment delete when necessary.');
    if size(object.controls, 1) > object.my_table_grid.height
        delete(object.controls(object.my_table_grid.height+1:size(object.controls, 1), :));
        object.controls(object.my_table_grid.height+1:size(object.controls, 1), :) = [];
    end
    assert( ~(size(object.controls, 1) > object.my_table_grid.height), 'Implment delete when necessary.');

    if size(object.controls, 2) ~= object.my_table_grid.width || size(object.controls, 1) ~= object.my_table_grid.height
        object.controls(object.my_table_grid.height, object.my_table_grid.width) = 0;
    end
    
    for i = 1:object.my_table_grid.width
        for j = 1:object.my_table_grid.height
            position = [(i-1)*object.gui_params.edit_width, y-((j)*object.gui_params.edit_height), object.gui_params.edit_width, object.gui_params.edit_height];
            str = object.my_table_grid.get_cell(j, i).get_user_string();
            
            if object.controls(j,i) ~= 0 && ishandle(object.controls(j,i))
                set(object.controls(j, i), 'Parent', parent_handle);
                set(object.controls(j, i), 'Position', position);
                set(object.controls(j, i), 'String', str);
                set(object.controls(j, i), 'Callback', @(src,event)GUIHelpers.update_cell(src, event, object.my_table_grid.get_cell(j, i)) );
            else
                %Standardize this
                object.controls(j, i) = uicontrol(parent_handle, 'Style', 'edit', 'Position', position, 'String', str, 'Callback', @(src,event)GUIHelpers.update_cell(src, event, object.my_table_grid.get_cell(j, i)));
            end
        end
    end

end

