Page 1 of 2

Teecommander

Posted: Tue Mar 29, 2016 6:35 am
by 16575033
Hi
I want to make some buttons of the Teecommander for FMX myself.
How Can I call the MOVE-Function of the Teecommander by hitting one of my self-drawn buttons?
Can you list all commands of the teecommander?
Because my Teecommander has soo small buttons, I can not hit it on the screen, only with mouse it works fine.
thanks

Re: Teecommander

Posted: Tue Mar 29, 2016 2:05 pm
by narcis
Hello,
How Can I call the MOVE-Function of the Teecommander by hitting one of my self-drawn buttons?
That's what that button does:

Code: Select all

  Procedure DoMove;
  var tmpZ : Double;
  begin
    if not FPanel.Canvas.SupportsFullRotation then // SupportsZoom2D
       Set3D;

    With FPanel.View3DOptions do
    begin
      tmpZ:=1;

      HorizOffsetFloat:=HorizOffsetFloat+((X-FOldX)*tmpZ);
      VertOffsetFloat:=VertOffsetFloat+((Y-FOldY)*tmpZ);
    end;

    {$IFDEF FMX}
    InvalidatePanel;
    {$ENDIF}

    FOldX:=X;
    FOldY:=Y;
  end;
InvalidedPanel method being like this:

Code: Select all

{$IFDEF FMX}
// When BufferedDisplay=True this is necessary because View3DOptions does not call
// FPanel.Invalidate
Procedure TTeeCommander.InvalidatePanel;
begin
  FPanel.Invalidate;
end;
{$ENDIF}
Can you list all commands of the teecommander?
I'm not 100% sure about what you request here. Anyway, being a source code customer, you should find all code behind TeeCommander at TeeComma.pas unit.

Re: Teecommander

Posted: Tue Mar 29, 2016 2:14 pm
by 16575033
yes I will look into the source. thanks
Maybe cou could tell me what I should write to a buttonclick method when I want that this botton should MOVE from the Commander.
Thanks a lot.

PS: BWT when I define a SERIES als POINT3DSeries and I click in the IDE Editor on the Series I get an error in XE6. (NOt found a property)
COuld you fix this please? IN the NON 3D POINT SERIES it works fine,

Re: Teecommander

Posted: Tue Mar 29, 2016 2:31 pm
by narcis
Hi Walter,
walter0316 wrote: Maybe cou could tell me what I should write to a buttonclick method when I want that this botton should MOVE from the Commander.
I already posted that code in my previous answer.
walter0316 wrote: PS: BWT when I define a SERIES als POINT3DSeries and I click in the IDE Editor on the Series I get an error in XE6. (NOt found a property)
COuld you fix this please? IN the NON 3D POINT SERIES it works fine,
Thanks for reporting. I added it (bug #1481) to the bug tracking system to be fixed for future releases. Please feel free to sign up and add yourself to the CC List to be notified about status updates.

Re: Teecommander

Posted: Tue Mar 29, 2016 2:52 pm
by 16575033
is there a way to make the button larger so That I do not use a mouse but could use my fingers?
ANd How can I disable the Print and save button in the commander, as SHOWMODAL is not installed in my Tablet.

Re: Teecommander

Posted: Tue Mar 29, 2016 2:58 pm
by 16575033
thanks a lot.

Ok, I ssee the move button. But I do not understand it, sorry I am nooot sooo good in delphi like you.
I would need the code for the first 6 icons on the commander from left.
PLEASE could you give me a code example? I still learn a lot from you.
thanks
walter

Re: Teecommander

Posted: Tue Mar 29, 2016 3:00 pm
by narcis
Hi Walter,
walter0316 wrote:is there a way to make the button larger so That I do not use a mouse but could use my fingers?
Yes, you can customize that at TCustomTeeCommander.CreateButton in TeeComma.pas.
walter0316 wrote:ANd How can I disable the Print and save button in the commander, as SHOWMODAL is not installed in my Tablet.
You should do as in the HideTabs feature as shown in the All Features\Welcome!\Componets\Chart Editor\Chart Editor dialog example in the features demo, available at TeeChart's program group.

Re: Teecommander

Posted: Tue Mar 29, 2016 3:20 pm
by 16575033
the demo does not work properly with XE6. Ara has send me a zip but not working fine. (delphi XE6)
So I have noe demo available.
thanks

Re: Teecommander

Posted: Tue Mar 29, 2016 3:22 pm
by 16575033
Yes, you can customize that at TCustomTeeCommander.CreateButton in TeeComma.pas.
Then I must recompile the stuff, and I do not know how it done,s o that it will work with XE6. I tried to get it run with the demo - demo has some prop in it which XE6 does not have.

Re: Teecommander

Posted: Wed Mar 30, 2016 6:35 am
by narcis
walter0316 wrote:the demo does not work properly with XE6. Ara has send me a zip but not working fine. (delphi XE6)
So I have noe demo available.
This is the VCL demo included with the binary installer, not the Firemonkey demo. Please run Tee9New.exe to find out that demo.

Re: Teecommander

Posted: Wed Mar 30, 2016 6:36 am
by narcis
walter0316 wrote: Then I must recompile the stuff, and I do not know how it done,s o that it will work with XE6.
Just run TeeRecompile tool shipped with the source code installer to compile all TeeChart packages and install them into your environment of choice.

Re: Teecommander

Posted: Wed Mar 30, 2016 6:56 am
by narcis
walter0316 wrote: PLEASE could you give me a code example? I still learn a lot from you.
Find attached a basic example of how you should combine mouse events and commander code to achieve what you request. It is not fully functional, you should look further at TeeCommander on how events are combined.

Regarding mobile devices, you might be interested in a blog post I wrote about Delphi Gestures with TeeChart.

Re: Teecommander

Posted: Wed Mar 30, 2016 9:04 am
by 16575033
Thank you very much.
Would you be also be so kind and give me an example how to disable/hide the last 4 Icons in the commander? THanks!!!

Re: Teecommander

Posted: Wed Mar 30, 2016 9:23 am
by 16575033
ok, Narcis, I had to ignore some Property missing and del the Presentation unit in the uses clause for my XE6.
I could run now the example.

BUt I do not understand, what I must change, when I want to do a ROTATE command.
WOuld you mind telling me how to change it?

I thought the commander would be like the commander from the DB, where the Commandercommang is a Type in the call.

Re: Teecommander

Posted: Wed Mar 30, 2016 11:46 am
by yeray
Hello,

You can hide buttons from the TeeCommander as shown in the demo at "All features\Welcome !\Components\Toolbar\Custom buttons". Ie:

Code: Select all

 TeeCommander1.CreateControls( [ tcbRotate, tcbSeparator, tcb3D ] );
The "move" and the "rotate" buttons in the commander are used as flags.
This is the code being called at the MouseMove event when the "move" button is down (that's what NarcĂ­s' project shows):

Code: Select all

  Procedure DoMove;
  var tmpZ : Double;
  begin
    if not FPanel.Canvas.SupportsFullRotation then // SupportsZoom2D
       Set3D;

    With FPanel.View3DOptions do
    begin
      tmpZ:=1;

      HorizOffsetFloat:=HorizOffsetFloat+((X-FOldX)*tmpZ);
      VertOffsetFloat:=VertOffsetFloat+((Y-FOldY)*tmpZ);
    end;

    {$IFDEF FMX}
    InvalidatePanel;
    {$ENDIF}

    FOldX:=X;
    FOldY:=Y;
  end;
This is the code being called at the MouseMove event when the "rotate" button is down:

Code: Select all

  Procedure DoRotate;
  begin
    // 2D with circled series (Pie, Gauge, Polar, Smith, etc):
    if (not FPanel.View3D) and Assigned(ICircledSeries) then
       ICircledSeries.RotationAngle:=Round(HalfDivPi*ICircledSeries.PointToAngle(X,Y))+ICircledSeries.RotationAngle
    else
    begin
      Set3D;

      with FPanel,View3DOptions do
      begin
        Orthogonal:=False;

        if FAllowRotationX then
           IDifX:=90.0*(X-FOldX)/Width
        else
           IDifX:=0;

        if FAllowRotationY then
           IDifY:=90.0*(FOldY-Y)/Height
        else
           IDifY:=0;
      end;

      IShift:=Shift;

      DoRotation(IDifX,IDifY);
    end;

    FOldX:=X;
    FOldY:=Y;

    IRotating:=True;
  end;

Procedure TTeeCommander.DoRotation(const IDifX,IDifY:Double);

  function AllowFullRotation:Boolean;
  begin
    result:=FAllowFull or FPanel.Canvas.SupportsFullRotation;
  end;

  Function CorrectAngle(Const AAngle:Double):Double;
  begin
    result:=AAngle;

    if result>360 then result:=result-360
    else
    if result<0 then result:=360+result;
  end;

begin
  with FPanel.View3DOptions do
  if AllowFullRotation then
  begin
    if ssShift in IShift then
       Tilt:=Round(CorrectAngle(Tilt+IDifY))
    else
    begin
      RotationFloat:=CorrectAngle(RotationFloat+IDifX);
      ElevationFloat:=CorrectAngle(ElevationFloat+IDifY);
    end;
  end
  else
  begin
    if Assigned(ICircledSeries) then
    begin
      Rotation:=360;

      if not AllowFullRotation then
         Perspective:=0;

      if IDifX<>0 then
         with ICircledSeries do
              RotationAngle:=Round(CorrectAngle(RotationAngle+IDifX));
    end
    else
      RotationFloat:=TRotateTool.RotationChange(AllowFullRotation,RotationFloat,IDifX);

    ElevationFloat:=TRotateTool.ElevationChange(AllowFullRotation,ElevationFloat,IDifY);
  end;

  {$IFDEF FMX}
  InvalidatePanel;
  {$ENDIF}
end;