Failed to change TRectangleTool position when from resized

TeeChart FireMonkey (Windows,OSX,iOS & Android) for Embarcadero RAD Studio, Delphi and C++ Builder (XE5+)
Post Reply
elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Failed to change TRectangleTool position when from resized

Post by elmec » Sat Jul 26, 2014 6:42 am

I want the RectangleTool position change automatically when form size changed.
But if I change form size by dragging the from border, it seems OK,
while nothing changed when maximize the form.

Code: Select all

//---------------------------------------------------------------------------

#include <fmx.h>
#pragma hdrstop
#include <iostream>
#include <string>
#include <Generics.Defaults.hpp>
#include <Generics.Collections.hpp>

#include <vector>

#include "Unit12.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)

#pragma link "FMXTee.Tools.ScrollPager"
#pragma link "FMXTee.Tools.SubChart"
#pragma link "FMXTee.Tools"
#pragma link "FMXTee.Tools.DragPoint"
#pragma resource "*.fmx"
TForm12 *Form12;

using namespace std;

// value index range
int from = 30;
int to   = 50;


__fastcall TForm12::TForm12(TComponent* Owner)
   : TForm(Owner)
{

	series1->FillSampleValues(100);

	RectangleTool->Shape->Color = claRed;
}

void __fastcall TForm12::btnSetPosClick(TObject *Sender)
{

	// Set the position of TRectangleTool with valueindex
	int left  = series1->CalcXPos(from);
	int right = series1->CalcXPos(to);
	RectangleTool->Left   = left;
	RectangleTool->Width  = right - left;

	RectangleTool->Top   = 200;
	RectangleTool->Height = 100;
}
//---------------------------------------------------------------------------


// I want the RectangleTool position change automatically when form size changed.
//  But if I change form size by dragging the from border, it seems OK,
//    while nothing changed when maximize the form.
void __fastcall TForm12::FormResize(TObject *Sender)
{
	btnSetPosClick(NULL);
}
//---------------------------------------------------------------------------

Attachments
Resize Form by Maximizing Form.png
Resize Form by Maximizing Form.png (192.17 KiB) Viewed 15702 times
Resize Form by Dragging Form Border.png
Resize Form by Dragging Form Border.png (84.84 KiB) Viewed 15704 times
Before Resize Form.png
Before Resize Form.png (75.94 KiB) Viewed 15702 times

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Failed to change TRectangleTool position when from resized

Post by elmec » Sat Jul 26, 2014 6:43 am

Pls find the attachment for exampl project.
Attachments
Project.zip
(99.12 KiB) Downloaded 1252 times

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Failed to change TRectangleTool position when from resized

Post by elmec » Thu Jul 31, 2014 4:31 am

Do you have any idea?

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Failed to change TRectangleTool position when from resized

Post by Sandra » Fri Aug 01, 2014 3:29 pm

Hello elmec,

Sorry for the delay. We are investigating the problem you are experiencing and will try to give you an answer in short time as possible.

Thanks in advance,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Failed to change TRectangleTool position when from resized

Post by Sandra » Wed Aug 06, 2014 2:54 pm

Hello elmec,
Sorry for the delay.
After doing some test, we have realised that the problem you are experiencing is produced because is necessary repaint the chart before using CalcXPos method, so the Chart has correct values. To do it you need only add Draw Chart method and call BtnSetPosClick in OnPaint Form event.
Below, I have attached your project with the modification.
Project.zip
(224.12 KiB) Downloaded 1300 times
I hope it will help.
Thanks in advance,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply