1. Moving a borderless window - Is there a way?

I have a window with no title bar or borders.  I'd like to be able to 
grab it with the mouse and move it where I want.  Is this possible?

new topic     » topic index » view message » categorize

2. Re: Moving a borderless window - Is there a way?

Evan Marshall wrote:

>
> I have a window with no title bar or borders.  I'd like to be able to 
> grab it with the mouse and move it where I want.  Is this possible?

Take a look at PatRat's library: http://www.rapideuphoria.com/dragwin.zip

Best Regards,
    Guillermo Bonvehi

new topic     » goto parent     » topic index » view message » categorize

3. Re: Moving a borderless window - Is there a way?

Thanks.  That's what I needed.

Guillermo Bonvehi wrote:

>
> Evan Marshall wrote:
>
>>
>> I have a window with no title bar or borders.  I'd like to be able to 
>> grab it with the mouse and move it where I want.  Is this possible?
>
>
> Take a look at PatRat's library: http://www.rapideuphoria.com/dragwin.zip
>
> Best Regards,
>    Guillermo Bonvehi
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: Moving a borderless window - Is there a way?

I found an easier way.
When the window receives a WM_NCHITTEST message,  send a  NTCAPTION 
response back.  This fools the window into thinking that the title bar 
has been clicked on.  A drawback is that the window will no longer be 
able to respond to any other mouse events.



> Thanks. That's what I needed.
>
> Guillermo Bonvehi wrote:
>
>   	
> Evan Marshall wrote:
>
>   	
> I have a window with no title bar or borders. I'd like to be able to
> grab it with the mouse and move it where I want. Is this possible?
>
>
> Take a look at PatRat's library: http://www.rapideuphoria.com/dragwin.zip
>
> Best Regards,
>     Guillermo Bonvehi
>
>
> TOPICA - Start your own email discussion group. FREE!
>

new topic     » goto parent     » topic index » view message » categorize

5. Re: Moving a borderless window - Is there a way?

I have used this algorithm in VB for years. It is as solid as any I know of:


without warning
include win32lib.ew

constant mainWin = create( Window, "Drag test", 0, 0, 0, 300, 100, 0 )

-- we use two global variables. because it is not possible to drag more 
than one window at a time,
-- we only need these two no matter how many windows use them.
sequence refPos
refPos = {0,0}

integer mouseDown
mouseDown = False

procedure mainWin_onMouse(atom event, atom x, atom y, atom shift)
    sequence extent
    sequence size
   
    -- we need to store the position the mouse was at when the button is 
pushed down
    -- otherwise, the window's upper-left corner will "snap" to the 
position of the mouse.
    -- uncomment the second line to see what I mean. this also sets the 
mouseDown flag.
    if event = LeftDown then
        refPos = {x, y}
        --refPos = {0, 0}
        mouseDown = True
    end if
   
    -- if the left mouse button is down, we will now actually move the 
window
    if event = MouseMove and mouseDown then
        -- the extent is used for it's left (1) and top (2) properties
        extent = getRect(mainWin)
        -- getCtlSize is more convienient to use as the 4th and 5th 
arguments to
        -- setRect, because it expects width and height, not right and 
bottom
        size = getCtlSize (mainWin)
       
        -- move the window, and repaint it
        setRect(mainWin,
            extent[1] + x - refPos[1],
            extent[2] + y - refPos[2],
            size[1], size[2], True)
    end if
   
    -- clear the mouseDown flag.
    if event = LeftUp then
        mouseDown = False
        refPos = {0,0}
    end if
end procedure

onMouse[mainWin] = routine_id("mainWin_onMouse")

WinMain(mainWin, Normal)

new topic     » goto parent     » topic index » view message » categorize

6. Re: Moving a borderless window - Is there a way?

>From: Isaac Raway <isaac-topica at blueapples.org>
>Subject: Re: Moving a borderless window - Is there a way?
>
>I have used this algorithm in VB for years. It is as solid as any I know 
>of:
>

  Only thing is, you should use setHandler().

setHandler(mainWin, w32HMouse, routine_id("mainWin_onMouse"))

and of course change the parameters of the procedure.

>
>onMouse[mainWin] = routine_id("mainWin_onMouse")
>
>WinMain(mainWin, Normal)
>

new topic     » goto parent     » topic index » view message » categorize

7. Re: Moving a borderless window - Is there a way?

Elliott Sales de Andrade wrote:

>
>  Only thing is, you should use setHandler().
>
> setHandler(mainWin, w32HMouse, routine_id("mainWin_onMouse"))
>
> and of course change the parameters of the procedure.
>
I did that, and made a few changes, then submitted it to the Archive as 
"Drag".

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu