Autor Beitrag
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 21.09.02 10:59 
:?: Hallo Leute,
weiß jemand wie man eine ProgressBar bzw. Gauge mit einen Button klick bewegen kann! :?:


:D
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Sa 21.09.02 12:19 
was willst du machen? Willst du, dass die ProgressBar auf deinem Formular hin und her springt? Ich gehe mal davon aus, dass du willst, dass - wenn man auf einen Button klickt - sich die Gauge dann "füllt".

Wenn es so ist, dann habe ich hier mal einen ungetesteten Code:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
begin
  Gauge1.MaxValue := 100;  //Maximalwert auf 100 setzen
  Gauge1.MinValue := 0;  //Minimalwert setzen
  for i := 1 to 100 do  //von 1 bis 100 zählen
  begin
    Gauge1.Progress := i;  //Gauge-Position setzen
    Sleep(100);  //100ms warten
    Application.ProcessMessages;  //nur damit das Programm noch reagiert
  end;
end;

_________________
Viele Grüße
Jakob
Albanac
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37



BeitragVerfasst: Di 24.09.02 20:44 
anzumerken ist vielleicht noch das beim Progress bar die eigenschaften anders heissen:

ausblenden Quelltext
1:
2:
3:
gauge.MaxValue => progress.Max
gauge.MinValue => progress.min
gauge.Progress => progress.Position
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Di 24.09.02 21:31 
Klar, aber ich dachte mir, dass man dann auch die Idee kommen könnte in der Hilfe unter TProgressBar nach vergleichbaren Eigentschaften zu suchen :mrgreen:

_________________
Viele Grüße
Jakob
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 28.09.02 14:27 
Titel: Danke
Danke für`s antworten, aber ich habe noch eine Frage! Wenn die Gauge bei 100% angekommen ist soll sich ein Button aktivieren!

Also so:
Button wird geklickt, Gauge läuft durch und ein Button wird sichtbar
Albanac
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37



BeitragVerfasst: Sa 28.09.02 14:33 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure Tfrm_hanzwurst.button1Click(Sender: TObject);
var
  x: integer;
begin
  for x := 1 to 100 do Inc(Gauge1.Progress);
    Button2.visible:= true;
end;
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 28.09.02 14:37 
Titel: funktioniert nicht
Danke für deine Antwort Albanac, aber die procedure geht nicht!
Albanac
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37



BeitragVerfasst: Sa 28.09.02 14:44 
war auch weniger als prozedur zum verwenden gedacht sondern eher als anschauungs material...

so wie ich die funktion geschrieben hab ists auch dumm, weil es kein delay in der for schleife gibt.

Am Besten realisierst du das ganze mit nem Ttimer der ne laufzeit von 200-100 (minium) steuerst.
Bei jedem aufruf des Timers checkst du ob Gauge1.Progress = Gauge1.Max ist, wenn ja
-schalt den timer ab
-schalt den button visible
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 28.09.02 14:47 
Titel: Und der Code...
Kannst du mir auch einen kompleten Code geben? :oops:
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Sa 28.09.02 15:04 
wenn du meinen Code nehmen willst, kannste folgendes ergänzen:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.Button1Click(Sender: TObject); 
var 
  i: Integer; 
begin 
  Gauge1.MaxValue := 100;  
  Gauge1.MinValue := 0;  
  for i := 1 to 100 do  
  begin 
    Gauge1.Progress := i;  
    Sleep(100);  
    Application.ProcessMessages;  
  end; //Schelife ist zu ende
  Button2.Enabled := True; //Button2 wird enabled
end;


So, das müsste funtzen.

_________________
Viele Grüße
Jakob