Autor Beitrag
Alpha_Wolf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 297

Ubuntu, Win XP, Win Vista
C#, Delphi 6 Prof, Delphi 2007 Prof, Java
BeitragVerfasst: Mo 06.12.04 11:11 
Hallo :D

So hab auch ma ne Frage bezüglich Formatierung... Möchte den Inhalt eines Edit Feldes rechtsbündig anzeigen.. oke hab mir was überlegt.. bin dann aber hängengeblieben und bin dann doch faul geworden und hab ins buch geguckt.. Lösung ist auch gleich parat nur leider funktioniert sie nicht.. Hier ist der Code...

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TEditRight = class(TEdit);
  TForm1 = class(TForm)
    Edit1: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure Edit1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
    procedure CreateParams(var Params: TCreateParams); override;
  end;

var
  Form1: TForm1;
  Edit: TEditRight;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Edit1 := TEditRight.Create(Self);
  Edit1.Parent := Self;
  Edit1.Text := '1';
end;


//Hier sagt er mir das "CreateParams" ein undefinierter Bezeichner sei <<<<<<<<
procedure TEditRight.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  Params.Style := Params.Style or ES_RIGHT;

end.


Wie lautet der Code richtig damit ich den Inhalt rechtsbündig anzeigen lassen kann...?

Funktioniert das ganze dann auch mit ner DBEdit?

Thx für eure Antworten :!:

Freundliche Grüße

Alpha_Wolf

[meta]Edit, Editierfelder, rechtsbündig, formatieren[/meta]

Moderiert von user profile iconMotzi: Code- durch Delphi-Tags ersetzt.
herzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 168

WINXP pro, SUSE Linux 9.0
D7 Pers.
BeitragVerfasst: Mo 06.12.04 12:33 
tRightEdit ist ein eigenständiger Typ. Der QC funktioniert!
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  tRightEdit = Class (tEdit)
  Protected
    Procedure CreateParams (var Params: tCreateParams); override;
  End;

type
  TForm1 = class(TForm)
    Button2: TButton;
    procedure Button2Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  edit2: TRightEdit;

implementation

{$R *.dfm}
Procedure tRightEdit.CreateParams (var Params: tCreateParams);
begin
  Inherited CreateParams (Params);
  Params.Style := Params.Style or ES_RIGHT;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Edit2 := tRightEdit.Create(Self);
  Edit2.Parent := Self;
  Edit2.Text := '1';
end;
end.
Alpha_Wolf Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 297

Ubuntu, Win XP, Win Vista
C#, Delphi 6 Prof, Delphi 2007 Prof, Java
BeitragVerfasst: Mo 06.12.04 12:52 
Danke für die schnelle Antwort! :) :idea:

Noch eine frage.. Wie weise ich das ganze jetzt einer vorhanden Edit zu?!

thx
Alpha_Wolf Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 297

Ubuntu, Win XP, Win Vista
C#, Delphi 6 Prof, Delphi 2007 Prof, Java
BeitragVerfasst: Di 07.12.04 09:21 
Hallo nochmal :D

Ich kriegs einfach net hin.. Kann mir denn keiner Helfen..

Wie weise ich das ganze jetzt einer vorandenen Edit zu?! Das problem ist einfach das ich nicht extra die Koordinaten angeben will da diese sich ja (korrigiert mich wenn ich falsch liege) bei unterschiedlichen Auflösungen ändert(hab ne MDI-Application)
Das ist für mich wirklich sehr wichtig :idea:


Danke für eure investierte Zeit.. :lol:
Alpha_Wolf Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 297

Ubuntu, Win XP, Win Vista
C#, Delphi 6 Prof, Delphi 2007 Prof, Java
BeitragVerfasst: Di 07.12.04 15:34 
Hat es nicht irgendwie etwas schönes wenn man sich fragen selbst beantworten kann :roll:

Habe das "Problem" auf zwei Arten gelöst.

    :arrow: Ne Eigene Komponente daraus basteln, ist schnell und einfach.

    :arrow: Eine schon vorhande einbeziehen (Raize Komponente (Raize Misc)) die verfügen über eine rechtsbündige Edit eine sogenannte NumericEdit.


Hoffe es hilft denjenigen die das gleiche Problem haben.