1. Win32Lib: Mouse Down Event for Window

Shouldn't the following work for the left mouse button down event?

procedure win_Main_onMouse (integer self, integer event, sequence
params)--params is ( int event, int x, int y, int shift )
object junk
	if event != 3 then
		junk = message_box(sprintf("Event = %d",{event}),"Check",MB_OK)
	end if
	if event = LeftDown then
		junk = message_box("Left down!","Check",MB_OK)
	end if
	setText( StatusBar14, sprintf("%d,%d",{mpos[1]-rect[1]+1,mpos[2]-rect[2]+1}) )
end procedure
setHandler( win_Main, w32HMouse, routine_id("win_Main_onMouse"))

new topic     » topic index » view message » categorize

2. Re: Win32Lib: Mouse Down Event for Window

cklester wrote:
> 
> Shouldn't the following work for the left mouse button down event?

I've modified it to the following:

procedure win_Main_onMouse (integer self, integer event, sequence
params)--params is ( int event, int x, int y, int shift )
sequence mpos, rect
integer leftDragged
	mpos = getPointerPos()
	rect = getClientRect( win_Main )
	leftDragged = False
	
	if params[1] = LeftDown or leftDragged then
		leftDragged = True
	elsif params[1] = LeftUp then
		leftDragged = False
	end if
	setText( StatusBar14, sprintf("%d,%d",{mpos[1]-rect[1]+1,mpos[2]-rect[2]+1}) )
end procedure
setHandler( win_Main, w32HMouse, routine_id("win_Main_onMouse"))

Anybody have a "paint by mouse" example anywhere?

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

3. Re: Win32Lib: Mouse Down Event for Window

I think the word we may be looking for here is "fill" as in color only an
certain area given specific boundaries.

~Greg

----- Original Message -----
From: "cklester" <guest at RapidEuphoria.com>
To: <EUforum at topica.com>
Subject: RE: Win32Lib: Mouse Down Event for Window


>
>
> posted by: cklester <cklester at yahoo.com>
>
> Brian Broker wrote:
> >
> > Please define "paint by mouse"...  I started writing an mspaint-type
> > program once, if that's what you mean.
>
> Yeah, I want to be able to "paint" on a
> bitmap with my mouse, like in MSPaint.
>
>
>
>

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

4. Re: Win32Lib: Mouse Down Event for Window

Greg Haberek wrote:
> 
> I think the word we may be looking for here is "fill" as in color only an
> certain area given specific boundaries.

No, I want to be able to click on a bitmap,
and where I click the program "paints" according
to whatever "brush" I've selected. Then, when
I drag my mouse all over, the program continues
to paint the same "brush" pattern... until I release
the mouse and am no longer "painting."

Now, who can show me some of that? :)

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

5. Re: Win32Lib: Mouse Down Event for Window



--  this is a pretty simple demo of how to do
--  something with the mouse button down
--  please note that doPaintBrush() is some routine
--  that paints the current brush to the Window
--  or performs some other drawing task

integer isDown
    isDown = False

procedure DrawHandler( integer self, integer event, sequence params )
atom iMsg
integer x, y, shift

    iMsg = params[1]
    x = params[2]
    y = params[3]
    shift = params[4]

    if iMsg = LeftDown then    -- could also be RightDown

        isDown = True    -- start painting
        doPaintBrush()    -- do initial paint

    elsif iMsg = LeftUp then    -- could also be RightUp

        isDown = False    -- stop painting

    elsif iMsg = MouseMove and isDown = True then    -- painting?

        doPaintBrush()    -- paint the window

    end if

end procedure
setHandler( MyWin, w32HMouse, routine_id("DrawHandler") )


----- Original Message -----
From: "cklester" <guest at RapidEuphoria.com>
To: <EUforum at topica.com>
Sent: Thursday, May 13, 2004 10:50 PM
Subject: Re: Win32Lib: Mouse Down Event for Window


>
>
> posted by: cklester <cklester at yahoo.com>
>
> Greg Haberek wrote:
> >
> > I think the word we may be looking for here is "fill" as in color only
an
> > certain area given specific boundaries.
>
> No, I want to be able to click on a bitmap,
> and where I click the program "paints" according
> to whatever "brush" I've selected. Then, when
> I drag my mouse all over, the program continues
> to paint the same "brush" pattern... until I release
> the mouse and am no longer "painting."
>
> Now, who can show me some of that? :)
>
>
>
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu