Autor Beitrag
Ghost40k
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Windows XP Pro x64 Edition
Delphi 2005,Html,ActionScript,Php etc
BeitragVerfasst: Di 16.01.07 20:22 
Hey , ich hätt da mal ne Frage;)
Ich würde gerne einen normalen TButton nach einmaligen Klicken für 4 sekunden deaktivieren , da sich mein Programm sonst Aufhängt . Ich arbeite mit Delphi ... weiß jemand zufällig , wie das geht?
Eine antwort wäre net ...
Ach und genau so würd ich gern einen Wechel der Radiobuttons für 4 sekunden verbieten ...
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Di 16.01.07 20:28 
Enabled auf false und mit nem Timer wieder enablen.

BTW: Wäre es nicht besser, das Problem zu lösen, anstatt es nur zu umgehen? :wink:

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Saubäär
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 376



BeitragVerfasst: Di 16.01.07 20:34 
Hi Ghost,

ich würds mit
ausblenden Delphi-Quelltext
1:
2:
3:
Button1.Enabled := False;
Sleep(4000); //Millisekunden
Button1.Enabled := True;

machen. Problem beheben ist aber sicher die bessere Methode :wink:

Gruß

Saubäär
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Di 16.01.07 20:39 
Ich denk eher, dass das disablem den aktuellen Prozess (= das Behandeln des Klicks) nich anhalten soll, weshalb deins in dem Fall nicht klappt.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Saubäär
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 376



BeitragVerfasst: Di 16.01.07 20:41 
Hi jakob,

stimmt, hab ich net bedacht. Und nen eigenen Thread dafür zu erstellen wäre totaler Blödsinn :P

Bäär
Ghost40k Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Windows XP Pro x64 Edition
Delphi 2005,Html,ActionScript,Php etc
BeitragVerfasst: Di 16.01.07 20:56 
mein Problem ist eins was ganz klar vorrausschaubar war , aber ich auch nicht so ganz weiß , wie ich das Umgehen soll und war
überprüft mein Programm Brüche , nachdem sie generiert worden sind [dies tun sie mit dem random befehl] , die radiobuttons ändern sich ebenfalls bei dem betätigen dieses buttons , jetzt ist das Problem dabei nur , dass beim anklicken eines der Radiobuttons eine procedur sofort gestartet wird , die die Brüche entweder Mutipliziert, Addiert, Dividiert oder Subtrahiert .... so muss es , wenn man mehrmals nacheinander schnell auf den button klickt immer für neue werte etwas anderes berrechnen , was den speicher wohl killt , dies will ich ganz einfach so umgehen , oder gibt es andere vorschläge?
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Di 16.01.07 20:57 
Sleep friert dein komplettes Programm ein.
Ich würds mit application.processmessages machen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
Procedure Delay(Dauer: cardinal);
var
 Start: Cardinal;
Begin
 Start := GetTickCount;
  while (GetTickCount - Start) < dauer do
    application.processmessages;
end;
...
 button1.Enabled := false;
 delay(4000);
 button1.Enabled := true;
...

grüße marc
Flamefire
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Di 16.01.07 21:02 
viel zu kompliziert:
ausblenden Delphi-Quelltext
1:
2:
3:
button1.enabled:=false;
Timer1.delay:=4000;
Timer1.enabled:=true;


dann im Timerevent:
ausblenden Delphi-Quelltext
1:
2:
timer1.enabled:=false;
button1.enabled:=true;


so läuft das proggi weiter und der button wird korrekt gesetzt...
Saubäär
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 376



BeitragVerfasst: Di 16.01.07 21:11 
Wenn du jetzt noch
ausblenden Delphi-Quelltext
1:
Timer1.Interval := 4000;					

schreibst, stimmts sogar.
Ghost40k Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Windows XP Pro x64 Edition
Delphi 2005,Html,ActionScript,Php etc
BeitragVerfasst: Di 16.01.07 21:11 
Danke erstmal , nur leider kennt Delphi 2005 kein "Timer1.delay:=4000; "---- er spaggt bei dem delay
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Di 16.01.07 21:14 
user profile iconFlamefire hat folgendes geschrieben:
viel zu kompliziert:

Was ist daran kompliziert? So sparst du dir den Timer ;)
Saubäär
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 376



BeitragVerfasst: Di 16.01.07 21:18 
Ich finds auch schöner ohne Timer.

@Marc. Hast du dir allerdings mal deine CPU Auslastung angeschaut? :wink:

Gruß

Bäär
Flamefire
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Di 16.01.07 21:19 
sry schreibfehler...
ich finde den timer einfacher...ein element reinziehn methode setzen fertig...

stimmt...CPU verbrauchste mehr...weil ja ne "endlosschleife" läuft...10000/sekunde überprüfen ob fertig...
na gut übertrieben aber so ungefähr
OldGrumpy
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 82



BeitragVerfasst: Di 16.01.07 22:36 
Das mit der Delay-Funktion weiter oben finde ich schon ganz passabel vom Ansatz her, allerdings würde ich in der While-Schleife Sleeps von 100 Millisekunden ausführen, und dazwischen Application.ProcessMessages aufrufen. So bleibt das Programm "bei Bewusstsein" und die CPU-Last ist auch nicht nennenswert. Um das ganze logisch besser zu sortieren, würde ich mir aber vermutlich eine eigene Ableitung von TButton dafür bauen ;)
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 18.01.07 11:51 
Die andere Frage habe ich abgetrennt und in ein eigenes Topic verschoben. hier gehts weiter.

_________________
We are, we were and will not be.