Autor Beitrag
JRegier
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: Sa 11.06.05 13:40 
Hallo, ich mache noch nicht all zu lange Komponentenentwicklung! Habe da das Problem
gehabt siehe hier www.delphi-forum.de/...43215&highlight=

Habe jetzt in CreateWnd das Hinzufügen der Items zur ComboBox gemacht um das Problem zu
lösen. Aber siehe da, wenn ich die Komponenente auf das Formular setze : verschwindet/beendet Delphi wola!!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
var PR : array[9] of PChar = ('0%', '5%', '10%', ...);

implemetation

procedure TResizeControl.CreatWnd;
var I : Integer;
begin

   FToolBar.Parent := Self;
   FCombo.Parent := FToolBar;
   FUpDownBtn.Parent := FToolBar;
   FUpDownBtn.Glyph.LoadFromResourceName(HInstance, 'UP');
   
   for I:=0 to Length(PR) - 1 do
   FCombo.Items.Add(PR[I]);

end;


Sieht hier jemand ein Fehler??

Moderiert von user profile iconChristian S.: Großschreibung aus Titel entfernt
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Sa 11.06.05 13:56 
jo fehlt nen n bei

implementation

...

vielleicht postest einfach mal den ganzen quelltext der komponente, wenn wieder die hälfte weggelassen wird kann mans gar nicht nachvollziehen

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit
JRegier Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: Sa 11.06.05 14:14 
user profile iconuall@ogc hat folgendes geschrieben:
vielleicht postest einfach mal den ganzen quelltext der komponente, wenn wieder die hälfte weggelassen wird kann mans gar nicht nachvollziehen


Hier der Ganze Quellcode

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:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
unit ResizeControl;

interface

{$R Resize.dcr}

uses
  Windows, Messages, SysUtils, Classes, Controls, ExtCtrls, ComCtrls, Buttons,
  StdCtrls;

type
  TResizeControl = class(TCustomPanel)
  private
  FToolBar : TToolBar;
  FUpDownBtn : TSpeedButton;
  FComb : TComboBox;
  FLow : Boolean;
  //FExpr : Boolean;
  procedure ResetSize(Sender : TObject);
    { Private-Deklarationen }
  protected
    
  public
    constructor Create(AOwner: TComponent); override;
    procedure CreateWnd; override;
  published
    property Parent;
  end;

procedure Register;

var PR : array[0..9] of PChar = ('0%', '5%', '10%', '15%', '20%', '25%', '30%', '35%', '40%', '45%');

implementation

procedure Register;
begin
  RegisterComponents('Standard', [TResizeControl]);
end;

constructor TResizeControl.Create(AOwner : TComponent);
begin
  inherited Create(AOwner);
  Align := alBottom;
  FLow := True;
  FToolBar := TToolBar.Create(Self);
  FUpDownBtn := TSpeedButton.Create(FToolBar);
  FUpDownBtn.OnClick := ResetSize;
  FComb := TComboBox.Create(FToolBar);
end;

procedure TResizeControl.CreateWnd;
var I : Integer;
begin
  FToolBar.Parent := Self;
  FUpDownBtn.Parent := FToolBar;
  FUpDownBtn.Glyph.LoadFromResourceName(HInstance, 'UP');
  FComb.Parent := FToolBar;

  for I:=0 to Length(PR) - 1 do
  FComb.Items.Add(PR[I]);
  FComb.ItemIndex := 1;
  FComb.OnChange := ResetSize;
  ResetSize(nil);
end;

procedure TResizeControl.ResetSize(Sender : TObject);
var S : String;
    H : Integer;
begin
  S := FComb.Text;
  S := Copy(S, 0, Pos('%', S)-1);
  H := StrToInt(S);
  if(FLow)then
  begin
  Height := TWinControl(Parent).Height * (100 - H) div 100;
  FLow := False;
  FUpDownBtn.Glyph.LoadFromResourceName(HInstance, 'DOWN');
  end
  else
  begin
  Height := TWinControl(Parent).Height * H div 100;
  FLow := True;
  FUpDownBtn.Glyph.LoadFromResourceName(HInstance, 'UP');
  end;
end;

end.
JRegier Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: Fr 17.06.05 19:22 
Kann keiner was zum Code sagen?
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Fr 17.06.05 19:28 
1.) Die ComboBox hat keinen Parent

2.) Die ComboBox wird nicht mehr freigegeben

AXMD
JRegier Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: Fr 17.06.05 19:33 
user profile iconAXMD hat folgendes geschrieben:
1.) Die ComboBox hat keinen Parent

2.) Die ComboBox wird nicht mehr freigegeben

AXMD


Doch ich setze denn doch in der CreateWnd Procedur und beim Create(FToolBar) bekommt die ja nen Owner
wieso wird die nicht freigegeben?

Wie könnte ich den Fehler einkreisen wenn Delphi gleich beendet sobald ich die Componente aufs
Formular setze?
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Fr 17.06.05 19:36 
Ich tippe auf Zeile 47. Das Control, das du in Zeile 46 erzeugst hat keinen Parent.

AXMD
JRegier Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: Fr 17.06.05 19:51 
user profile iconAXMD hat folgendes geschrieben:
Ich tippe auf Zeile 47. Das Control, das du in Zeile 46 erzeugst hat keinen Parent.

AXMD


Nein, was ist nun wem soll ich glauben! Die einen sagen den Parent in der CreateWnd Procedur zu setzen
und du sagst im Constructor muß er schon gesetzt werden? Wo gibt es ein gutes Tutorial zu Komponentenentwicklung?

// EDIT

Keine Antwort ist auch eine Antwort!