AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Easymove

Ein Thema von synex · begonnen am 15. Apr 2003 · letzter Beitrag vom 13. Dez 2003
Antwort Antwort
synex

Registriert seit: 14. Apr 2003
147 Beiträge
 
Delphi 6 Personal
 
#1

Easymove

  Alt 15. Apr 2003, 14:07
Ich habe folgendes Problem:
Meine Form2 soll sich rumschieben lassen, egal wo man hinklickt auf der Form (Wie bei Winamp). Ich habe dazu ein folgenden code verwendet:

Delphi-Quellcode:

private
    { Private declarations }
  procedure WMNCHitTest(var M: TWMNCHitTest); message wm_NCHitTest;

//blablabla

procedure TForm2.WMNCHitTest (var M: TWMNCHitTest);
begin
  inherited;
  if M.Result = htClient then
    M.Result := htCaption;
end;
Jetzt funktioniert aber mein SpeedButton nicht mehr, wenn ich auf ihn klicke bewege ich auch nur die Form.

Wie kann ich den Button wieder dazu bringen seine OnClock-Procedure auszuführen?


Mein 2. Problem:

ich habe meinem Programm jetzt einen HotKey zugewiesen (siehe hier )
Wie kann ich durch ein HotKey-Editfeld den Hotkey ändern?

danke schonmal,
der synex
  Mit Zitat antworten Zitat
Benutzerbild von City Light
City Light

Registriert seit: 17. Sep 2002
314 Beiträge
 
#2
  Alt 15. Apr 2003, 15:42
Hallo synex
ich habs getestet und dieser funktioniert!
Delphi-Quellcode:
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
                               Shift: TShiftState; X, Y: Integer);
begin
   ReleaseCapture;
   SendMessage(Form1.Handle, wm_SysCommand,$f012,0);
end;
zu 2. keine Ahnung Sorry
Bis bald man liest sich
Tino
  Mit Zitat antworten Zitat
synex

Registriert seit: 14. Apr 2003
147 Beiträge
 
Delphi 6 Personal
 
#3
  Alt 15. Apr 2003, 16:17
ok danke aber was ändert das?

Wie muss ich das verwenden?
  Mit Zitat antworten Zitat
Benutzerbild von City Light
City Light

Registriert seit: 17. Sep 2002
314 Beiträge
 
#4
  Alt 15. Apr 2003, 16:38
Schreib den Code einfach in MouseDown deiner Form rein
Dann funkt der Speed Button wieder!
Bis bald man liest sich
Tino
  Mit Zitat antworten Zitat
synex

Registriert seit: 14. Apr 2003
147 Beiträge
 
Delphi 6 Personal
 
#5
  Alt 15. Apr 2003, 16:49
hmm sorry aber irgendwie klappt dann der Knopf bei mir noch immer nicht

danke trotzdem
  Mit Zitat antworten Zitat
Benutzerbild von APP
APP

Registriert seit: 24. Feb 2003
Ort: Graz (A)
705 Beiträge
 
Delphi 7 Enterprise
 
#6
  Alt 15. Apr 2003, 17:09
Hallo,

ich glaube Du mußt es umgekehrt machen:

Zitat:
But, I have components on a form!?
In most cases we'll have some components on a form. Let's say, for example, that one Panel object is on a form. If Align property of a panel is set to alClient, the Panel fills the entire client area so that it is impossible to select the parent form by clicking on it. The code above will not work! Why? The code above will not work because the mouse is always moving over the Panel component not the form.

To move our form by dragging a panel on the form we have to add few lines of code in the OnMouseDown event procedure for the Panel component:

procedure TForm1.Panel1MouseDown
(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
SendMessage(Form1.Handle, WM_SYSCOMMAND, 61458, 0);
end;

Note: this code will not work with non-window controls such as TLabel components
Du legst ein Panel auf Deine Form mit Align at Client, dann platzierst Du deine Controls (Buttons,...) die Du bedienen möchtest darauf.

Dann kommt:
Delphi-Quellcode:
unit bUnit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    procedure Button1Click(Sender: TObject);
    procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
  procedure WMNCHitTest(var Msg: TWMNCHitTest);
  message wm_NCHitTest;


    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest);
begin
  inherited;
  if Msg.Result = htClient then
    Msg.Result := htCaption;
end;

procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture;
  SendMessage(Form1.Handle, WM_SYSCOMMAND, 61458, 0);
end;
und nun kannst Du die Form (über das Panel) verschieben und trotzdem die Buttons drücken.

(Frei nach Another Way to Drag a Window auf About.com)

[EDIT] Habe gerade bemerkt, dass es auch ohne Panel funkt, so wie es City Light beschrieben hat!! [/EDIT]
Armin P. Pressler

BEGIN
...real programmers are using C/C++ - smart developers Delphi;
END;
  Mit Zitat antworten Zitat
synex

Registriert seit: 14. Apr 2003
147 Beiträge
 
Delphi 6 Personal
 
#7
  Alt 15. Apr 2003, 17:56
jo thx jetzt tuts.
DANKE!
  Mit Zitat antworten Zitat
Mr.Dollar2k3

Registriert seit: 12. Okt 2003
Ort: KÖLN
29 Beiträge
 
Delphi 7 Enterprise
 
#8

Re: Easymove

  Alt 13. Dez 2003, 15:19
hi
ich hab versucht es nach zu machen aber bei mir funktioniert es nicht ich versuch aber mit einen bild das mann das drauf klickt und es bewegen kann
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:06 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz