Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

How to Rotate Text Labels around a fix origin

edited January 2006 in General
Hi there,
RB 9.03 Delphi 7. Running XP SP2
RB with applied rotated text patch.
#
I am still struggling to master these rotated text labels on a report. To
reproduce this example reliably I need 1 copy of delphi and 1 copy of
RB9.03, Create a new app, drop a ppReport onto the form, open the report ,
add a label in the middle of the header say, put sticky paper on screen to
mark position, or better still use an RB shape to mark current position, now
simply rotate the lable by 270 degrees, then back to 0 !

Should not the label now be back in its original position ? ...me hopes the
answer is ALWAYS YES !
Should not the font size affect the position of the Origin (Eg Top and Left)
... me hopes the answer is ALWAYS NO!
as if the text is NOT rotated changing the font size Does NOT make the label
leap off all over the report.

if this is not the case how can anyone rotate text on the screen depending
on external factors and calculate where Report builder is going to drop it.

I remember back in school we had to rotate 3D shapes about on a screen and
the logic being remove offset, apply transformation, then reapply offset,
this always worked... I cant figure what rule is being applied to the
positioning in report builder.

If this is a bug then can i beg you for a patch, or do i need to upgrade to
version 10.00 to fix this ?

Best regards
Colin Coleman

Comments

  • edited January 2006
    Hi Colin,

    The issue you are having is with the AutoSize feature. It is very difficult
    to decide how AutoSize will work for a rotated component (i.e. whether the
    component left should be altered or the text left, etc). I will look into
    this and see if there is something that can be done for a patch but as an
    alternative, try setting the AutoSize property to False before changing the
    angle of a component.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2006
    Hi Nico,
    I tried that it does help a little, but still falls apart when i move the
    origin from 0,0 to 50,50 then increase the font, moving it back to 0,0 does
    not return it it to its original position, as though some vairiable is still
    holding some offset in a buffer you are using, i have a small delphi 7
    example to very simply show my problem only 20 lines of code, can i send it
    to you ?

    Colin

    Contained :--

    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls, Buttons, ppCtrls, ppPrnabl, ppClass, ppBands, ppCache,
    ppComm, ppRelatv, ppProd, ppReport, ppTypes;

    type
    TForm1 = class(TForm)
    ppReport1: TppReport;
    ppHeaderBand1: TppHeaderBand;
    ppDetailBand1: TppDetailBand;
    ppFooterBand1: TppFooterBand;
    ppShape1: TppShape;
    BitBtn1: TBitBtn;
    CheckBox1: TCheckBox;
    BitBtn2: TBitBtn;
    ppShape2: TppShape;
    EditXLEFT: TEdit;
    ppLabel2: TppLabel;
    Label1: TLabel;
    ppLabel1: TppLabel;
    procedure BitBtn1Click(Sender: TObject);
    private
    { Private declarations }
    public
    { Public declarations }
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
    ppreport1.DeviceType := dtscreen;
    if CheckBox1.Checked then
    Begin
    ppLabel1.AutoSize := false;
    // ppLabel1.Angle := 0;
    ppLabel1.Caption := 'Left30 Top10';
    // ppLabel1.Angle := 270;
    ppLabel1.Left := StrToFloat(EditXLEFT.Text);
    ppLabel1.Top := 50;
    ppLabel1.Font.Size := 72;
    ppLabel1.AutoSize := true;
    End
    else
    Begin
    ppLabel1.AutoSize := false;
    // ppLabel1.Angle := 0;
    ppLabel1.Caption := 'Normal Position';
    ppLabel1.Left := 10;
    ppLabel1.Top := 10;
    ppLabel1.Font.Size := 22;
    // ppLabel1.Angle := 270;
    ppLabel1.AutoSize := True;
    End;
    ppreport1.print;
    end;

    end.

    ==========================================
    DFM

    object Form1: TForm1
    Left = 440
    Top = 187
    Width = 453
    Height = 233
    Caption = 'Form1'
    Color = clBtnFace
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    OldCreateOrder = False
    Position = poScreenCenter
    PixelsPerInch = 96
    TextHeight = 13
    object Label1: TLabel
    Left = 72
    Top = 56
    Width = 80
    Height = 29
    Caption = 'Label1'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -24
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
    end
    object BitBtn1: TBitBtn
    Left = 176
    Top = 120
    Width = 75
    Height = 25
    Caption = 'Print'
    TabOrder = 0
    OnClick = BitBtn1Click
    end
    object CheckBox1: TCheckBox
    Left = 192
    Top = 56
    Width = 97
    Height = 17
    Caption = 'move test'
    TabOrder = 1
    end
    object BitBtn2: TBitBtn
    Left = 56
    Top = 120
    Width = 75
    Height = 25
    TabOrder = 2
    Kind = bkClose
    end
    object EditXLEFT: TEdit
    Left = 192
    Top = 24
    Width = 121
    Height = 21
    TabOrder = 3
    Text = '50'
    end
    object ppReport1: TppReport
    PrinterSetup.BinName = 'Default'
    PrinterSetup.DocumentName = 'Report'
    PrinterSetup.PaperName = 'A5'
    PrinterSetup.PrinterName = 'Default'
    PrinterSetup.mmMarginBottom = 1323
    PrinterSetup.mmMarginLeft = 1323
    PrinterSetup.mmMarginRight = 1323
    PrinterSetup.mmMarginTop = 1323
    PrinterSetup.mmPaperHeight = 210000
    PrinterSetup.mmPaperWidth = 148000
    PrinterSetup.PaperSize = 11
    Units = utMillimeters
    DeviceType = 'Screen'
    OutlineSettings.CreateNode = True
    OutlineSettings.CreatePageNodes = True
    OutlineSettings.Enabled = True
    OutlineSettings.Visible = True
    TextSearchSettings.DefaultString = ''
    TextSearchSettings.Enabled = True
    Left = 304
    Top = 96
    Version = '9.03'
    mmColumnWidth = 0
    object ppHeaderBand1: TppHeaderBand
    mmBottomOffset = 0
    mmHeight = 144463
    mmPrintPosition = 0
    object ppShape2: TppShape
    UserName = 'Shape2'
    mmHeight = 13229
    mmLeft = 50000
    mmTop = 50000
    mmWidth = 13229
    BandType = 0
    end
    object ppShape1: TppShape
    UserName = 'Shape1'
    mmHeight = 13229
    mmLeft = 10000
    mmTop = 10000
    mmWidth = 13229
    BandType = 0
    end
    object ppLabel2: TppLabel
    UserName = 'Label2'
    Border.BorderPositions = []
    Border.Color = clBlack
    Border.Style = psSolid
    Border.Visible = False
    Border.Weight = 1.000000000000000000
    Caption = 'Label2'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clBlack
    Font.Name = 'Arial'
    Font.Size = 16
    Font.Style = [fsBold]
    Transparent = True
    mmHeight = 6615
    mmLeft = 82550
    mmTop = 2646
    mmWidth = 17727
    BandType = 0
    end
    object ppLabel1: TppLabel
    UserName = 'Label1'
    Angle = 270
    AutoSize = False
    Border.BorderPositions = []
    Border.Color = clBlack
    Border.Style = psSolid
    Border.Visible = False
    Border.Weight = 1.000000000000000000
    Caption = 'Initial is a small label at box 1'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clBlack
    Font.Name = 'Arial'
    Font.Size = 16
    Font.Style = [fsBold]
    Transparent = True
    mmHeight = 87313
    mmLeft = 10000
    mmTop = 10000
    mmWidth = 7408
    BandType = 0
    RotatedOriginLeft = 7408
    RotatedOriginTop = 0
    end
    end
    object ppDetailBand1: TppDetailBand
    mmBottomOffset = 0
    mmHeight = 1058
    mmPrintPosition = 0
    end
    object ppFooterBand1: TppFooterBand
    mmBottomOffset = 0
    mmHeight = 0
    mmPrintPosition = 0
    end
    end
    end





  • edited January 2006
    Hi Colin,

    Send the example to support@digital-metaphors.com in .zip format and I'll
    take a look at it for you.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.