Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1234

Summary: Child views can not be added
Product: .NET TeeChart Reporter: narcís calvet <narcis>
Component: AndroidAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED FIXED    
Severity: normal CC: narcis
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Android   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description narcís calvet 2015-06-11 06:16:01 EDT
Child views can not be added over a TChart component. For example, you can not draw a button over it. The call to the method below prevents that.

    /// <summary>
    /// Removes current view items.
    /// </summary>
    private void CleanView()
    {
      this.RemoveAllViewsInLayout();
      this.SetBackgroundDrawable(null);
    }

Code to reproduce it: 

  public class MainActivity : Activity
  {
    protected override void OnCreate(Bundle bundle)
    {
      base.OnCreate(bundle);
      InitializeChart();
    }

    private Steema.TeeChart.TChart tChart1;
    private Steema.TeeChart.Styles.Pie pie1;

    private void InitializeChart()
    {
      tChart1 = new Steema.TeeChart.TChart(this);
      tChart1.Aspect.View3D = false;
      tChart1.Legend.Visible = false;

      pie1 = new Steema.TeeChart.Styles.Pie(tChart1.Chart);      
      pie1.Circled = true;
      pie1.Marks.Visible = false;
      pie1.Add(25);
      pie1.Add(25);
      pie1.Add(25);
      pie1.Add(25);

      SetContentView(tChart1);
      AddButtons();
    }

    private void AddButtons()
    {
      var button1 = new Button(this);
      button1.Text = "button1";
      button1.Click += delegate {
        Toast
          .MakeText(this, button1.Text + " clicked!", ToastLength.Short)
          .Show();
      };

      var buttonRect = new System.Drawing.Rectangle(500, 500, 300, 100);
      var layout1 = new Android.Widget.FrameLayout.LayoutParams(buttonRect.Width, buttonRect.Height);
      layout1.SetMargins(buttonRect.Left, buttonRect.Top, buttonRect.Right, buttonRect.Bottom);
      //layout1.Gravity = 0;

      button1.LayoutParameters = layout1;

      tChart1.AddView(button1);
    }
  }