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



BeitragVerfasst: Mo 28.02.05 20:14 
habe folgendes problem die effekte für das design funktionieren ja schon alle jedoch möchte ich das wenn ich zum beispiel die 1 gedrückt wird auch der button 1 mit effekt und runterdrück effekt aktiviert wird uns so lange unten bleibt bis ich die taste loslasse

hier der effekt den ich beim runterdücken benutzt habe

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Image27MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin

   image27.left := image27.left + 1;
   image27.top := image27.top + 1;


heir wird der button runter gedrückt

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Image27MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin

   image27.left := image27.left - 1;
   image27.top := image27.top - 1;



so jetzt noch der effekt es wird einfach nen 2.bild darüber gelegt aber egal

vielen dank für eure hilfe

vielleicht versteht ja jemand mein problem

ach weiss gar net ob das hier rein gehört denke aber schon
cartridge
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 209

Win XP
D4 Prof,D6 Prof
BeitragVerfasst: Mo 28.02.05 21:13 
Kann ja sein, dass ich dich falsch verstehe, aber warum verwendest Du nicht den Speedbutton und veränderst die Eigenschaft "Down"?

Gruß
Ingo
Chilla111 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 28.02.05 21:37 
ne ich verwende ein bmp also nen eigens design für den button

user defined image

mri geht es darum das wnen ich die 1 auf der tastatur drücke auch der effekt erscheint also die taste 1 gedrückt wird
cartridge
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 209

Win XP
D4 Prof,D6 Prof
BeitragVerfasst: Mo 28.02.05 21:42 
Dann musst Du halt mit einer Schleife alle deiner Buttons/ Images abklappern und z.B. durch setzen unterscheidlicher Tags den richtigen raus fischen. Fertig!
Chilla111 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 28.02.05 21:50 
ich meine überhaupt wie sage ich wenn ich taste 1 gedrückt habe dann wird das und das gemacht oder dann wird diese procedure ausgeführt wie mache ich das?
Stefan-W
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: Mo 28.02.05 21:57 
hi

du kanns doch in der KeyDown Procedure auch den Key (die Variable heist auch gleich so) auslesen (einfach mit If) geht wunderbar dann malst du das passende Bild und in der KeyUp Procedure machst dus genauso...

Tschau
Chilla111 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 28.02.05 21:59 
ich verstehs voll nicht kannst mri mal nen beispeil scvhreiben steh gard auf dem schlauch am besten für den button1 also man soll auf der tastatur die eins drücken dnan soll der effekt kommen solange wie die 1 gedrückt wird
Stefan-W
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: Mo 28.02.05 22:06 
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:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
    If Key = VK_A then
    begin
        // Bild für A gedrückt malen
    end
    Else If Key = VK_B then
    begin
        // Bild für B gedrückt malen
    end
    {...}
    Else If Key = VK_Z then
    begin
        // Bild für Z gedrückt malen
    end;
end;

procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
    If Key = VK_A then
    begin
        // Bild für A losgelassen malen
    end
    Else If Key = VK_B then
    begin
        // Bild für B losgelassen malen
    end
    {...}
    Else If Key = VK_Z then
    begin
        // Bild für Z losgelassen malen
    end;
end;

Hoffe das reicht als Bsp.
:D

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mo 28.02.05 22:12 
ich glaube chilla meinte die maustasten und nicht die tastatur.
habe zwar immer noch nicht mitgekriegt was das eigentliche problem ist aber vielleicht schaust du dir mal den ShiftState an, der bei den onmousedown/onmouseup events mitgeliefert wird.
Chilla111 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 28.02.05 22:13 
und was soll bei vk_A rein genau da hängt es ja bei mir
Stefan-W
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: Mo 28.02.05 22:14 
da gibs auch so ne Key Variable (ist alles in der DelphiHilfe beschrieben)
Stefan-W
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: Mo 28.02.05 22:14 
VK_A Steht für die Taste 'A' auf der Tastatur
Chilla111 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 28.02.05 22:22 
sorry stephan aber jetzt raff ich gar nix mehr :cry:

irgend wie also wenn die taste 1 auf der tastatur gedrückt wird soll eine procedure ausgeführt werden fertig
Stefan-W
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: Mo 28.02.05 22:31 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
    If Key = VK_1 then
    begin
        // tu das was beim drücken der Taste '1' geschehen soll
    end;
End;

procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
    If Key = VK_1 then
    begin
        // tu das was beim loslassen der Taste '1' geschehen soll
    end;
end;


Also wenn das jetzt nicht hilft weis ich nicht wie ichs erklären soll

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Mo 28.02.05 22:41 
Bin mir nicht sicher ob es VK_1 gibt. Wenn nicht, dann kannst du auch folgendes benutzen
ausblenden Delphi-Quelltext
1:
2:
  if Key = Orc('1') then
    {...}

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
Chilla111 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Di 01.03.05 00:40 
irgend wie funktioniert beides nicht so ernsthaft aht jemand noch ne idee?
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Di 01.03.05 11:08 
muss auch nicht ORC heissen sondern ORD
Chilla111 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Di 01.03.05 19:22 
danke aber hab das prob jettzt auf ne andere art gelöst
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Di 01.03.05 19:54 
darf man wissen wie ?
Chilla111 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Di 01.03.05 19:58 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
Procedure Button_H(x:string; ja:boolean)  ;
begin

if (ja) and not (kickdown) then
  begin
   TImage(Form1.FindComponent('I_B_'+ x)).left:=TImage(Form1.FindComponent('I_B_'+x)).left+1;
   TImage(Form1.FindComponent('I_B_'+ x)).top:=TImage(Form1.FindComponent('I_B_'+x)).top+1;
   kickdown:=true
  end
 else if (not(ja)) and (kickdown) then
  begin
   TImage(Form1.FindComponent('I_B_'+x)).left:=TImage(Form1.FindComponent('I_B_'+x)).left-1;
   TImage(Form1.FindComponent('I_B_'+x)).top:=TImage(Form1.FindComponent('I_B_'+x)).top-1;
   kickdown:=false
  end;



so und jetzt muss ihc zum beispiel nur noch

ausblenden Delphi-Quelltext
1:
if key =vk_numpad1 then button_h('n1',true);					


und schon wird der nutton aufgerufen und je nach dem aktiviert als mit effekten versehen je nach dem halt