Suggested Change to FloatPanel

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #40420
    mcone
    Participant

    I just realized I posted this to the wrong forum. It should be in “suggestions.” My apologies.
    Mike

    #40469
    Support
    Keymaster

    Hello Mike

    Thank you for suggestion, I'll be thinking how to implement it soon.

    #40484
    mcone
    Participant

    Thanks Serge –

    I discovered that I needed a mouse up event to make this work. Well, the call to SC_DragMove for WM_BUTTONDOWN causes the regular MouseUp event to never be triggered. After scouring the net for this issue, I found that it is a very common problem. This is how others have solved it.

    I added a MouseIsUp event with a new object private FWasDragging boolean value. Whenever the panel floats, then I set the FWasDragging to TRUE. Then, when the left button comes up, the logic drops to the section below where we test the FWasDragging value for TRUE, then send the MouseIsUp event. It works every time.

    You can probably improve on it by using the standard MouseUp and MouseDown events. However, I wanted get to a solution quickly – and this was the quickest way for me.

    -Mike

    In the class definition add:

    CODE
    .
        FOnMouseIsUp: TNotifyEvent;
    .
    .
        property OnDragMouseIsUp: TNotifyEvent read FOnMouseIsUp write FOnMouseIsUp;

    In the constructor add:

    CODE
      FWasDragging := false;

    At the bottom of the WndProc procedure add:

    CODE
    .
    .
    .
        WM_LBUTTONDOWN : if IsFloat then
        begin
          if Assigned(FOnMouseIsDown) then FOnMouseIsDown(Self);
          Message.Result := 0;
          ReleaseCapture;
          Perform(WM_SYSCOMMAND, $F012, 0);         //SC_DragMove
          FWasDragging := true;
          Exit;
        end;
      end;

      if FWasDragging then
      begin
        FWasDragging := false;
        if Assigned(FOnMouseIsUp) then FOnMouseIsUp(Self);
      end;
    .
    .
    .

    #41118
    Support
    Keymaster

    Hello
    ACExtra package was updated today :
    http://www.alphaskins.com/sfiles/acextra.zip
    In the FloatPanel added FWasDragging:boolean property (True when panel is in dragging). Also added OnMove event.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.