Autor Beitrag
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Sa 30.04.05 14:11 
Hallo,

kann mir mal jemand sagen was ich hier falsch mache?
Zitat:
TWinControl(Form2.bt[ha]).perform(wm_syscommand,sc_dragmove, 0);


Bei mir kommt immer der Fehler:
Zitat:
[Fehler] Unit1.pas(61): E2003 Undefinierter Bezeichner: 'sc_dragmove'


Ich hab im Forum und bei Delphi.Sourece geguckt, aber nichts entsprechendes gefunden, überall wird's so beschrieben...

PS: Unter D3 geht's
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: Sa 30.04.05 15:01 
Hallo,

ich finde den Bezeichner auch nicht im PSDK. Meinst du vielleicht Suche im MSDN SC_MOVE? Verschiebt dieser Befehl das Fenster?

Gruß Hape!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Sa 30.04.05 15:08 
ausblenden Delphi-Quelltext
1:
2:
const
  SC_DRAGMOVE = $F012;

_________________
Ciao, Sprint.
Fabian W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Sa 30.04.05 18:45 
@Wulfskin: Ich weis net was sc_Move macht, aber dragmove soll die Kompo bewegen wenn Maustaste gedrückt, wie der Name schon sagt...

@Sprint: Willst du mir damit sagen, dass es das gibt, oder was?
Tobias1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 454

Win 98, XP Prof
D3 Prof, D2005 Prof
BeitragVerfasst: Sa 30.04.05 18:59 
du muss das von Sprint einfach nur irgendwo deklarieren

_________________
Auch das schlechteste Buch hat seine gute Seite: die letzte. (John Osborne)
Fabian W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Sa 30.04.05 19:06 
Funzt trotzdem net. Wie bei sc_move bleibt der Button zwar gedrückt, bewegen tutu sich da garnix. Und der soll nun mal über das Formular gezogen qwerden können wie Propgrammfenster über'n Desktop.
Fabian W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Sa 30.04.05 19:26 
Mich wundert nur das es unter D3 funzt. Kann vielleicht mal jemand von euch versuchen mit dieser Methode n bUootn in Bewegung zu bringen??
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Sa 30.04.05 20:46 
Zeig doch mal den Source Code.

_________________
Ciao, Sprint.
Fabian W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: So 01.05.05 07:10 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
 procedure TForm1.Verschieben(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
ha: integer;
begin
ha := 0;
if Form4.movebt.checked then
  begin
  for ha := 0 to 100 do
  if sender = Form2.bt[ha] then begin
  ReleaseCapture;
  TWinControl(Form2.bt[ha]).perform(wm_syscommand,sc_dragmove, 0);
  Form2.bt[ha].top:=10*round(Form2.bt[ha].top/10);
  Form2.bt[ha].left:=10*round(Form2.bt[ha].left/10);
  end
  else
  continue;
  end;
end;


So: Ha ist meine interne For-Schleifenvariable. Mit ihr wird überprüft, ob einer der bt’s (Buttons die während der Laufzeit eingefügt werden) das Ereignis ONMouseDown gesendet hat. Diese Procedure liegt auf jedem der bt’s.
Wenn jetzt einer gesendet hat, soll der über’s Formular bewegebar sein (nur bei gedrückter Maustaste) dafür: ReleaseCapture;
TWinControl(Form2.bt[ha]).perform(wm_syscommand,sc_dragmove, 0);
Dann runde ich die Pos noch kurz, damit die Button nachher besser in Reih und Glied zu bringen sind.
sc_dragmove ist ein undefinierter Bez, den hab ich nach Sprint’s Vorschlag in Form1 deklariert.

Einzigstes Problem: Es geht nicht.
Fabian W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: So 01.05.05 08:27 
Ok, ich hab dsa jetzt mal mit nem Button, den ich nicht zur Laufzeiteingefügt habe probiert:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture;
  TWinControl(Button1).perform(wm_syscommand,sc_dragmove, 0);
  Button1.top:=10*round(Button1.top/10);
  Button1.left:=10*round(Button1.left/10);
end;


Das funzt einwandtfrei. Also muss es irgendwas mit der FOR-Schleife oder mit der If-Anwiesung Problemem geben.
Kann es ein dass ein Fehler auftritt, den ich nicht gemeldet bekomme?
Fabian W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mi 04.05.05 13:53 
So, ich hab's hinbekommen!
Ich hab als BT[x] immer eien TSpeedbutton eingefügt. Wenn ich das gleiche mit nem BitBtn mache geht's. Ich versteh zwar net warum, is aber so...
Hat vielleicht jemand ne Idee??