Move window by dragging button

  • Dear list,

    I have a borderless, fully transparant window. The window contains a
    button. I would like the user to be able to move this window by
    dragging the button around, sort of a movableByWindowBackground thing
    but for a button. Is this possible?

    Thanks,
    F.
  • On Jan 14, 2008 10:41 PM,  <slasktrattenator...> wrote:

    > I have a borderless, fully transparant window. The window contains a
    > button. I would like the user to be able to move this window by
    > dragging the button around, sort of a movableByWindowBackground thing
    > but for a button. Is this possible?

    Probably, but it's not the expected behaviour of push buttons (which
    fire when the mouse is *released* after being pressed within the
    region of the button) so I would very much caution against it.

    Hamish
  • On Jan 14, 2008, at 4:57 PM, Hamish Allan wrote:

    > On Jan 14, 2008 10:41 PM,  <slasktrattenator...> wrote:
    >
    >> I have a borderless, fully transparant window. The window contains a
    >> button. I would like the user to be able to move this window by
    >> dragging the button around, sort of a movableByWindowBackground thing
    >> but for a button. Is this possible?
    >
    > Probably, but it's not the expected behaviour of push buttons (which
    > fire when the mouse is *released* after being pressed within the
    > region of the button) so I would very much caution against it.

    Even worse, you'd be taking away an expected behavior - If I click on
    a button and change my mind mid-click, I can drag off of the button
    before releasing it and nothing happens. I would find your proposed
    behavior quite disconcerting. I would recommend having a graphic of
    some kind other than the button that would be used for dragging.

    Glen
  • Actually the button is a huge, borderless button displaying an image,
    so I'm not worried about the expected behavior of a NSButton per se.
    What I'm looking for is a way to move a window with no titlebar, and
    no background. The solution doesn't necessarily have to involve a
    button. I just thought it convenient.

    On Jan 14, 2008 11:57 PM, Hamish Allan <hamish...> wrote:
    >
    > On Jan 14, 2008 10:41 PM,  <slasktrattenator...> wrote:
    >
    >> I have a borderless, fully transparant window. The window contains a
    >> button. I would like the user to be able to move this window by
    >> dragging the button around, sort of a movableByWindowBackground thing
    >> but for a button. Is this possible?
    >
    > Probably, but it's not the expected behaviour of push buttons (which
    > fire when the mouse is *released* after being pressed within the
    > region of the button) so I would very much caution against it.
    >
    > Hamish
    >
  • On Jan 14, 2008 11:28 PM,  <slasktrattenator...> wrote:

    > Actually the button is a huge, borderless button displaying an image,
    > so I'm not worried about the expected behavior of a NSButton per se.
    > What I'm looking for is a way to move a window with no titlebar, and
    > no background. The solution doesn't necessarily have to involve a
    > button. I just thought it convenient.

    Take a look at:

    http://developer.apple.com/samplecode/RoundTransparentWindow/index.html

    But you still have to decide: does the first click of the drag fire
    the action (e.g. draggable tabs in Safari 3), or does it only fire on
    the release of the click if there has been no drag (e.g. items in
    Finder's sidebar)?

    Hamish
  • Thanks, Hamish! That's exactly what I was looking for. And yes, the
    action should fire on release only if there has been no drag.

    On Jan 15, 2008 1:00 AM, Hamish Allan <hamish...> wrote:
    > On Jan 14, 2008 11:28 PM,  <slasktrattenator...> wrote:
    >
    >> Actually the button is a huge, borderless button displaying an image,
    >> so I'm not worried about the expected behavior of a NSButton per se.
    >> What I'm looking for is a way to move a window with no titlebar, and
    >> no background. The solution doesn't necessarily have to involve a
    >> button. I just thought it convenient.
    >
    > Take a look at:
    >
    > http://developer.apple.com/samplecode/RoundTransparentWindow/index.html
    >
    > But you still have to decide: does the first click of the drag fire
    > the action (e.g. draggable tabs in Safari 3), or does it only fire on
    > the release of the click if there has been no drag (e.g. items in
    > Finder's sidebar)?
    >
    > Hamish
    >
previous month january 2008 next month
MTWTFSS
  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      
Go to today