Autor Beitrag
Klaus-B.Schmidt
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

WinXP u. Win2000
D6 Enterprise
BeitragVerfasst: Mo 24.05.04 20:20 
hi leute, ich hb eben das ganze board durchsucht, und nciht das richtige gefunden, ich möchte eine Progress bar oder sowas ähnliches in eine ListView einbinden, sie soll folgende featurs haben:
-Prozentangabe und eine kb angabe zum selbst konfigurieren
-soll ein bisschen grafisch sein(siehe bild)
-soll ebim verändern der spaltenbreite der anderen imme rin der spalte bleiben, wo sie hingehört
-soll beim verändern der größe, wo sie ist mitresizen
user defined image

//edit: falls das bild nciht angezeigt wird: rechtsklick-> bild anzeigen
MfG
Klaus
adler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 511

Windows XP
Delphi 05 Pers
BeitragVerfasst: Mo 24.05.04 20:31 
:welcome:

Mh, hab ich nicht so recht verstanden?
Also ne Progressbar ist net das Prob, nur das Grafische oder was?
Dnn machste am Besten ein Picture und rechnst dann die breite für deine Prozente aus oder?

_________________
Wo's nix zu gucken gibt, gibts vielleicht was zu hören.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 24.05.04 20:47 
www.luckie-online.de...lt/lvwithbuttons.zip
Mit der Progressbar geht es genauso.
Klaus-B.Schmidt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

WinXP u. Win2000
D6 Enterprise
BeitragVerfasst: Di 25.05.04 13:20 
hi, sorry, habs ncih eindetig geschrieben:)

@adler
Könntest du mir für deinen vorschlag mal eine demo machen? oder sagen, wie ich das hibekomme?


MfG
Klaus
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Di 25.05.04 13:45 
Ich hab grad Luckies Beispiel probiert und es klappt wunderbar mit der Progressbar...
Probiers doch einfach mal...

Einwas nur, beim ändern der Spaltenbreite ändert sich die progressbar immer erst nach dem 2. mal ändern undzwar immer so wie ich die spalte vorhr hatte...
komisch komisch komisch....

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
adler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 511

Windows XP
Delphi 05 Pers
BeitragVerfasst: Di 25.05.04 13:59 
Ja, probier mal Luckies Beispiel...
wenn du das wirklich net hinbekommst, dann schau ich mal das ich ne demo mache.

_________________
Wo's nix zu gucken gibt, gibts vielleicht was zu hören.
Klaus-B.Schmidt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

WinXP u. Win2000
D6 Enterprise
BeitragVerfasst: Di 25.05.04 14:27 
bei Luckies lösung bleiben die button an ein und denselben platz stehen, egal, ob ich die feldgröße ändere etc.

MfG
Klaus
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Di 25.05.04 14:31 
ich habe das beispiel auch für ProgressBar umgeschrieben und mit D6 ausgeführt...
Bei mir ändert sich die größe der ProgressBar schon, nur halt immer erst beim zweiten mal ändern der spaltenbreite wird die erste größenänderung übernommen...

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Di 25.05.04 14:52 
Hallo,

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:
uses
  CommCtrl,

//.......................................

var
  OldWndProc: Pointer;

function NewWndProc(hWnd, uMsg, wParam, lParam: Cardinal): Cardinal; stdcall; forward;

procedure CtrlInLV(Ctrl: TControl; lv: TListView; iCol, iRow: Integer);
var
  R: TRect;
  i, iColLeft: Integer;
begin
  iColLeft := 0;
  for i := 0 to iCol - 1 do
    Inc(iColLeft, lv.Column[i].Width);

  R           := lv.Items[iRow].DisplayRect(drBounds);
  R.Left      := iColLeft;
  R.Right     := R.Left + lv.Columns[iCol].Width;

  Ctrl.Parent := lv;
  Ctrl.Top    := R.Top;
  Ctrl.Left   := R.Left;
  Ctrl.Width  := lv.Columns[iCol].Width;
  Ctrl.Height := 12;
end;

function NewWndProc(hWnd, uMsg, wParam, lParam: Cardinal): Cardinal;
var
  r: TRect;
begin
  Result := CallWindowProc(OldWndProc, hWnd, uMsg, wParam, lParam);
  case uMsg of
    WM_PAINT:
      CtrlInLV(Form1.ProgressBar1, Form1.ListView1, 2, 2);
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  OldWndProc := Pointer(SetWindowLong(ListView_GetHeader(ListView1.Handle),
    GWL_WNDPROC, Integer(@NewWndProc)));
end;


Man muss nicht unbedingt den Spaltenkopf der ListView subclassen. Man könnte die Prozedur auch in dem OnCustomDraw-Ereignis der ListView aufrufen. Allerdings hatte ich da auf langsamen NT-Rechnern Probleme. So aber nicht.

MFG

- Ernesto -
Klaus-B.Schmidt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

WinXP u. Win2000
D6 Enterprise
BeitragVerfasst: Di 25.05.04 15:05 
er sagt mir, dass er mit ListView_GetHeader nichts anfangen kann
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Di 25.05.04 15:09 
Hallo,

ErnestoChe hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
uses
  CommCtrl;


MFG

- Ernesto -
Klaus-B.Schmidt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

WinXP u. Win2000
D6 Enterprise
BeitragVerfasst: Di 25.05.04 15:15 
beim starten kommt die meldung:
Listindex überschreitet das Maximum (2)
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Di 25.05.04 15:27 
Hallo,

ein kleines bisschen muss man auch selber denken. Es müssen natürlich genügen Items und Columns auch wirklich da sein. Wie man sehen kann habe ich in der Prozedur CtrlInLV diesbezüglich keine Prüfungen.

ausblenden Delphi-Quelltext
1:
CtrlInLV(Form1.ProgressBar1, Form1.ListView1, Spalte, Zeile);					


In den beiden letzten Parametern musst du Spalte und Zeile angeben, die auch da sein müssen.

MFG

- Ernesto -
Klaus-B.Schmidt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

WinXP u. Win2000
D6 Enterprise
BeitragVerfasst: Di 25.05.04 16:05 
gut, es funktioniert, nur kann cih das auch in mehreren zeilen verwenden? habs so:

function NewWndProc(hWnd, uMsg, wParam, lParam: Cardinal): Cardinal;
var
r: TRect;
pb: TGauge;
begin
Result := CallWindowProc(OldWndProc, hWnd, uMsg, wParam, lParam);
case uMsg of
WM_PAINT:
pb := Tgauge.Create(Form1.ListView1);
pb.ForeColor:=clSkyBlue;
CtrlInLV(pb, Form1.ListView1, 1, 1);
end;
end;
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Di 25.05.04 16:26 
Hallo,

Ja. Probiers doch einfach aus.

MFG

- Ernesto -
Klaus-B.Schmidt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

WinXP u. Win2000
D6 Enterprise
BeitragVerfasst: Di 25.05.04 17:11 
ich hab das reinegsetzt, weil das nicht funktioniert, vielleicht kann mir da jmd. helfen, ahb schon elles verucht.

MfG
Klaus
Klaus-B.Schmidt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

WinXP u. Win2000
D6 Enterprise
BeitragVerfasst: Di 25.05.04 17:18 
hab fehler gefunde, funktionier auch (einigermaßen) nur mein verändern der größe eines belibigen feldes, hinterlässt die ProgressBAr bzw. Gauge striche ....

//edit: ursache gefunden, ich find ne lösung un poste sie (falls interesse besteht?


MfG
Klaus


Zuletzt bearbeitet von Klaus-B.Schmidt am Di 25.05.04 17:27, insgesamt 1-mal bearbeitet
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Di 25.05.04 17:21 
Probiers mal mit Repaint bzw Refresh...

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
Klaus-B.Schmidt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

WinXP u. Win2000
D6 Enterprise
BeitragVerfasst: Di 25.05.04 18:57 
hab infolge eines anderen problemes den VirtualTreeView benutzt:
www.lischke-online.d...rtualTreeview/VT.php
kann das jemand umschreiben??

MfG
Klaus
mstuebner
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 132

Win2000, XP
D7
BeitragVerfasst: Di 25.05.04 19:35 
Klaus-B.Schmidt hat folgendes geschrieben:
hab infolge eines anderen problemes den VirtualTreeView benutzt:
www.lischke-online.d...rtualTreeview/VT.php
kann das jemand umschreiben??

Sicher, aber warum sollte jemand Dein Programm für Dich schreiben? Viel Initiative lässt Du ja nicht sehen. Just my 2cent.

_________________
mfg Matthias