Autor Beitrag
bonanza
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Di 10.01.06 20:35 
Wie kann ich hotkeys setzen, z.B.: das wenn ich eine besondere Taste drücke z.b. eine bestimmte Prozedure ausgeführt werden soll.

danke schonmal im voraus.
mfg
bonanza
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 10.01.06 20:42 
in dem du in der onkeypress - routine beispielsweiße folgendes reinsetzt:


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
begin
  if key = #13 then  // falls enter gedrückt wurde...
begin
  showmessage('Enter wurde gedrückt!');
  beep;
 end;
end;



hoffe das hilft dir weiter [ungetestet]
bonanza Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Di 10.01.06 20:47 
ja danke...
aber woher weiß ich welche Nr. z.B. die taste F4 usw hat?
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 10.01.06 20:53 
ich habe mal ein kleines programm geschrieben um an die codes der klein undgroß buchstaben sowie zahlen un zeichen von ! bis ´ zu kommen ;)
Findest du unten im Anhang!


der befehl, ein zeichen in seinen zahlenwert umzuwandeln lautet  ord(key)
um es ensptrechend wieder umzuwandeln benutzt man  chr(key)

wie man aber nun an maus, f1-f12 kommt weiß ich leider nicht ;)

hoffe konnte dir wenigstens ein wenig weiterhelfen!

mfg, marc
Einloggen, um Attachments anzusehen!
bonanza Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Di 10.01.06 20:55 
user profile iconNoTVerYEvilPzYchO hat folgendes geschrieben:
ich habe mal ein kleines programm geschrieben um an die codes der klein undgroß buchstaben sowie zahlen un zeichen von ! bis ´ zu kommen ;)
Findest du unten im Anhang!


der befehl, ein zeichen in seinen zahlenwert umzuwandeln lautet  ord(key)
um es ensptrechend wieder umzuwandeln benutzt man  chr(key)

wie man aber nun an maus, f1-f12 kommt weiß ich leider nicht ;)

hoffe konnte dir wenigstens ein wenig weiterhelfen!

mfg, marc


Ja danke...das ist sehr gut!
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Di 10.01.06 20:57 
Du solltest am Besten die virtuellen Tastencodes verwenden, die sind dann auch recht lesbar.
www.delphi-library.d...ic.php?p=92949#92949

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
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 10.01.06 21:00 
das wusst ich selbst noch gar nicht, gut zu wissen :)
bonanza Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Di 10.01.06 21:02 
Ich hab da jetzt dann den wert "#70" genommen für F1 aber das funktioniert nicht. woran liegt das?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if key = #70 then  
begin
  showmessage('blubb!');
 end;
end;
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Di 10.01.06 21:05 
Zum einen würde ich die Abfrage umschreiben in if Ord(key) = VK_F1 then, damit Du in einem Monat noch weißt, was das sein soll.

Zum anderen solltest Du mal schauen, ob das Event überhaupt ausgelöst wird und falls nicht, mal in OnKeyUp oder OnKeyDown versuchen. Manche Tasten lösen OnKeyPress nicht aus, aber ich habe gerade einen Totalausfall, welche Tasten das sind. ;-)

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
bonanza Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Di 10.01.06 21:10 
ja danke hat geklappt mit OnkeyUp.

DANKE!
bonanza Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Di 10.01.06 21:49 
Hi,
ich hab das jetzt mit der F1 taste gemacht. Doch habe ich jetzt folgendes problem:
wenn ich in der form, in der ich diese abfrage mache einen button (der eine andere Form aufruft) drücke und dann F1 drücke funktioniert die "hilfe" nichtmehr.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Di 10.01.06 22:03 
Stell mal Form1.KeyPreview auf True dann müsste es gehen.
bonanza Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Di 10.01.06 22:12 
Ja danke funktioniert.