Hallo,
eine Menge Antworten, vielen Dank für die Mühen.
Das Icon sehe ich jetzt. Wenn der Min- & Max-Button nicht auszublenden ist, dann ist es halt so, nicht optimal, aber damit kann ich leben.
@theo
P.S. Das Icon lädt eigentlich schon, wird aber durch "Self.BorderStyle := bsDialog;" ausgehebelt.
Lass diese Zeile weg, oder setze bsSingle, dann kommt das Icon.
Stimmt, klappt - Danke, da hätte ich wirklich selber drauf kommen können.
Aber wieso zeigt er bei bsDialog das Tatzen-Icon? Zu erwarten wäre dann gar kein Icon.
@Warf
Welches Widgetset wird verwendet?
Da habe ich keinerlei Änderung an der Voreinstellung vorgenommen, also GTK2.
Wie erstellst du die Form?
Dynamisch zur Laufzeit, also nicht über den Form-Editor.
In Kurzform
Code: Alles auswählen
type
XCForm = class(TForm)
public
constructor CreateNew(AOwner: TComponent; Dummy: Integer = 0); override;
procedure SetPanCol(p: TPanel; oParent: TComponent; iTop, iLeft, iCol, iTab: Integer; sHint: string);
procedure PanOnClick(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
end;
...
Code: Alles auswählen
{ XCForm }
constructor XCForm.CreateNew(AOwner: TComponent; Dummy: Integer = 0);
var
fCap, fFrame: string;
btnOk, btnCancel: TButton;
Shape1: TShape;
GroupBox1: TGroupBox;
txName, txRGB: TEdit;
panWahl,
panSnow, panFloralWhite, panLavenderBlush, // usw. gekürzt, sind über 100
begin
if FormCaption = '' then
fCap := 'Farbauswahl'
else
fCap := FormCaption;
if FrameCaption = '' then
fFrame := 'Auswahl'
else
fFrame := FrameCaption;
DialogSelectedName := '';
DialogSelectedColor := -1;
inherited CreateNew(AOwner);
Self.Caption := fCap;
Self.Width := 647;
Self.Height := 544;
Self.Position := poDesktopCenter;
Self.BorderStyle := bsSingle;
Self.BorderIcons := [biSystemMenu];
Self.Icon.LoadFromResourceName(HInstance, 'PIP_16');
//btnCancel
btnCancel := TButton.Create(Self);
btnCancel.Parent := Self;
if FormBtnOKLeft = false then
btnCancel.Left := 392
else
btnCancel.Left := 520;
btnCancel.Height := 40;
btnCancel.Width := 120;
btnCancel.Top := 488;
btnCancel.Caption := 'Abbrechen';
btnCancel.Cancel := true;
btnCancel.TabOrder := 1;
btnCancel.OnClick := @btnCancelClick;
//btnOK
btnOk := TButton.Create(Self);
btnOk.Parent := Self;
if FormBtnOKLeft = false then
btnOk.Left := 520
else
btnOk.Left := 392;
btnOk.Height := 40;
btnOk.Width := 120;
btnOk.Top := 488;
btnOk.Caption := '&Ok';
btnOk.Default := true;
btnOk.OnClick := @btnOKClick;
btnOk.TabOrder := 0;
//TShape
Shape1 := TShape.Create(Self);
Shape1.Parent := Self;
Shape1.Left := 8;
Shape1.Height := 2;
Shape1.Top := 472;
Shape1.Width := 632;
//GroupBox1
GroupBox1 := TGroupBox.Create(Self);
GroupBox1.Parent := Self;
GroupBox1.Left := 8;
GroupBox1.Height := 77;
GroupBox1.Top := 379;
GroupBox1.Width := 632;
GroupBox1.Caption := fFrame;
GroupBox1.TabOrder := 142;
//txName
txname := TEdit.Create(GroupBox1);
txName.Parent := GroupBox1;
txName.Left := 120;
txName.Height := 35;
txName.Top := 10;
txName.Width := 328;
txName.Alignment := taCenter;
txName.AutoSize := False;
txName.ReadOnly := True;
txName.TabOrder := 0;
oName := txName;
//txRGB
txRGB := TEdit.Create(GroupBox1);
txRGB.Parent := GroupBox1;
txRGB.Left := 464;
txRGB.Height := 35;
txRGB.Top := 10;
txRGB.Width := 160;
txRGB.Alignment := taCenter;
txRGB.AutoSize := False;
txRGB.ReadOnly := True;
txRGB.TabOrder := 1;
oRGB := txRGB;
//panWahl
panWahl := TPanel.Create(GroupBox1);
panWahl.Parent := GroupBox1;
panWahl.Left := 8;
panWahl.Height := 35;
panWahl.Top := 10;
panWahl.Width := 96;
panWahl.BevelOuter := bvNone;
panWahl.BorderStyle := bsSingle;
panWahl.Color := clNone;
panWahl.ParentBackground := False;
panWahl.ParentColor := False;
panWahl.ParentShowHint := False;
panWahl.TabOrder := 2;
oWahl := panWahl;
//SetPanCols
SetPanCol(panSnow, Self, 8, 8, 16448255, 2, 'Snow ($FAFAFF)');
SetPanCol(panFloralWhite, Self, 8, 48, 15792895, 3, 'FloralWhite ($F0FAFF)');
// Das kürze ich jetzt mal ab, sind über 100
end;
procedure XCForm.SetPanCol(p: TPanel; oParent: TComponent; iTop, iLeft, iCol, iTab: Integer; sHint: string);
begin
p := TPanel.Create(oParent);
p.Parent := TWinControl(oParent);
p.Left := iLeft;
p.Height := 32;
p.Hint := sHint;
p.Top := iTop;
p.Width := 32;
p.BevelInner := bvRaised;
p.BevelWidth := 2;
p.Color := iCol;
p.ParentBackground := False;
p.ParentColor := False;
p.ParentShowHint := False;
p.ShowHint := True;
p.TabOrder := iTab;
p.Tag := 1;
p.OnClick := @PanOnClick;
end;
// Die Ereignisauswertung unterschlage ich jetzt mal.
Funktioniert das denn wenn die Form nicht Teil des Packages ist?
Bei der Gelegenheit stelle ich gerade fest, dass der unerwünschte Minimieren- & Maximieren Button sich auch aus der Vorlage nicht entfernen lässt, wird also wohl eine KDE-Eigenheit sein.
Hast du irgendwelche speziellen Einstellungen im Package?
Nein, eigentlich nicht.