Groups > Superbase > Superbase NG > Re: Mouse




Mouse

Mouse
Thu, 08 Nov 2007 10:59:19 -050
I thought I recalled a thread about tracking mouse, but I can't find it.

Can I presently do something like what is below in SBL?  I see the 
wxform properties mousecapture, onmouse, onmousemask.  But I do not 
understand the documentation.  (It doesn't look like dataform1 has these
properties.  And actually wxwindow doesn't either.)

A. what is the difference between:
controlscaptured and mousecapture

both say:
"Indicates whether the mouse is currently captured or not."

B. from the "onmouse" documentation:

"keys" is a collection of bits showing key positions:

Key Type Bit Value
shift down 0x00000001
ctrl down 0x00000002
alt down 0x00000004
meta down 0x00000008

To me this looks like it was possibly written for properties 
keycapture, onkey, onkeymask that were abandoned.  One would think that 
instead of "keys" you'd have a parameter like "mousebutton"
which would 
hold maybe left, middle, right.

or maybe even

leftpress
leftclick
leftdoubleclick
middlepress
middleclick
middledoubleclick
middlescrollup
middlescrolldown
rightpress
rightclick
rightdoubleclick

BUT now I see these methods.

mousecapture()
mouserelease()
setonmousemask()


C.  I guess the long and short of it is that I really don't understand 
it. I never really needed to track this sort of this.

But I was trying as a self made tutorial/challenge to build a polygon 
object/type (basically modifying the listsample and then use that to 
make the line segments) and then testing whether a click/point was 
inside the polygon or not (which is math for which there is plenty of 
code floating around).  But first I need to figure out how to track 
where a mouse click is.


SUB main()
  ON EVENTCLASS MOUSE CALL checkmouse()
  ON EVENTCLASS KEY CALL checkkey()
  EVENTCLASS MOUSE ON
  EVENTCLASS KEY ON
  WHILE NOT done%
   WHILE NOT SuperBase.MouseLButton
   StatusLine$ = "x: " + LTRIM$ ( STR$ (Superbase.MouseX)) + "-
y: " + 
LTRIM$ ( STR$ (Superbase.MouseY))
   SET STATUS StatusLine$
   WEND
  REQUEST "Outside Form x: " + LTRIM$ ( STR$ (MouseX)) + "- y:
" + 
LTRIM$ ( STR$ (MouseY))
  WEND
  END SUB


SUB checkmouse(a%,b%,x%,y%)
  REQUEST "Inside Form x: " + LTRIM$ ( STR$ (x%)) + "- y: "
+ LTRIM$ ( 
STR$ (y%))
  END SUB

SUB checkkey(queued%,keyval%,fnkeytext$)
  END
  END SUB

Post Reply
Re: Mouse
Thu, 08 Nov 2007 17:44:01 -050
I don't care much of the mechanics from your end. Not to be flip but I'm 
just interested in my end.  Is this SBL code really so difficult that it 
cannot be current translated into SIMPOL, now?

SUB main()
  ON EVENTCLASS MOUSE CALL checkmouse()
  ON EVENTCLASS KEY CALL checkkey()
  EVENTCLASS MOUSE ON
  EVENTCLASS KEY ON
  WHILE NOT done%
   WHILE NOT SuperBase.MouseLButton
   StatusLine$ = "x: " + LTRIM$ ( STR$ (Superbase.MouseX)) + "-
y: " + 
LTRIM$ ( STR$ (Superbase.MouseY))
   SET STATUS StatusLine$
   WEND
  REQUEST "Outside Form x: " + LTRIM$ ( STR$ (MouseX)) + "- y:
" + 
LTRIM$ ( STR$ (MouseY))
  WEND
  END SUB

SUB checkmouse(a%,b%,x%,y%)
  REQUEST "Inside Form x: " + LTRIM$ ( STR$ (x%)) + "- y: "
+ LTRIM$ ( 
STR$ (y%))
  END SUB

SUB checkkey(queued%,keyval%,fnkeytext$)
  END
  END SUB

If it can't, how you have a robust thing if it is so complex just to 
track the mouse and keyboard.

 From 
http://www.wxwidgets.org/manuals/stable/wx_wxmouseevent.html#wxmouseeventgetx
wxMouseEvent::GetX
long GetX() const
Returns X coordinate of the physical mouse event position.

wxMouseEvent::GetY
long GetY()
Returns Y coordinate of the physical mouse event position.

And what about using

wxJoystickEvent

Hey Pete might be interested in this:
http://www.wxwidgets.org/manuals/stable/wx_wximage.html#wximagerotate

JDK





Neil Robinson wrote:
> Kromkowski wrote:
>> But I was trying as a self made tutorial/challenge to build a polygon
>> object/type (basically modifying the listsample and then use that to
>> make the line segments) and then testing whether a click/point was
>> inside the polygon or not (which is math for which there is plenty of
>> code floating around).  But first I need to figure out how to track
>> where a mouse click is.
> 
> Welcome to the club :). It turns out that providing this sort of
> functionality is very problematic, especially when working with
> wxWidgets from a separate thread/process. The capture stuff is used by
> the form designer to do what it does, but if use it it means that the
> normal events don't fire. In the case of a polygon you don't care, but
> if you turn it on, you have to decide which controls are captured and
> which are not. You also cannot get live tracking of the mouse position
> or the state of and keyboard keys, at least not currently.
> 
> Unfortunately, I just don't have time right now to go into the mechanics
> of this stuff. Someone else who may have played with these might be able
> to give you some insight.
> 
Post Reply
Re: Mouse
Thu, 08 Nov 2007 18:47:20 +000
Kromkowski wrote:
> But I was trying as a self made tutorial/challenge to build a polygon
> object/type (basically modifying the listsample and then use that to
> make the line segments) and then testing whether a click/point was
> inside the polygon or not (which is math for which there is plenty of
> code floating around).  But first I need to figure out how to track
> where a mouse click is.

Welcome to the club :). It turns out that providing this sort of
functionality is very problematic, especially when working with
wxWidgets from a separate thread/process. The capture stuff is used by
the form designer to do what it does, but if use it it means that the
normal events don't fire. In the case of a polygon you don't care, but
if you turn it on, you have to decide which controls are captured and
which are not. You also cannot get live tracking of the mouse position
or the state of and keyboard keys, at least not currently.

Unfortunately, I just don't have time right now to go into the mechanics
of this stuff. Someone else who may have played with these might be able
to give you some insight.

Post Reply
Re: Mouse
Fri, 09 Nov 2007 09:53:48 +000
Kromkowski wrote:
> I don't care much of the mechanics from your end. Not to be flip but I'm
> just interested in my end.  Is this SBL code really so difficult that it
> cannot be current translated into SIMPOL, now?
> 
> SUB main()
>  ON EVENTCLASS MOUSE CALL checkmouse()
>  ON EVENTCLASS KEY CALL checkkey()
>  EVENTCLASS MOUSE ON
>  EVENTCLASS KEY ON
>  WHILE NOT done%
>   WHILE NOT SuperBase.MouseLButton
>   StatusLine$ = "x: " + LTRIM$ ( STR$ (Superbase.MouseX)) +
"- y: " +
> LTRIM$ ( STR$ (Superbase.MouseY))
>   SET STATUS StatusLine$
>   WEND
>  REQUEST "Outside Form x: " + LTRIM$ ( STR$ (MouseX)) + "-
y: " + LTRIM$
> ( STR$ (MouseY))
>  WEND
>  END SUB
> 
> SUB checkmouse(a%,b%,x%,y%)
>  REQUEST "Inside Form x: " + LTRIM$ ( STR$ (x%)) + "- y:
" + LTRIM$ (
> STR$ (y%))
>  END SUB
> 
> SUB checkkey(queued%,keyval%,fnkeytext$)
>  END
>  END SUB
> 
> If it can't, how you have a robust thing if it is so complex just to
> track the mouse and keyboard.
> 
> From
>
http://www.wxwidgets.org/manuals/stable/wx_wxmouseevent.html#wxmouseeventgetx
> 
> wxMouseEvent::GetX
> long GetX() const
> Returns X coordinate of the physical mouse event position.
>
> wxMouseEvent::GetY
> long GetY()
> Returns Y coordinate of the physical mouse event position.

Yup, and you get those in the onmouse event. All this tells you is where
the mouse was at the time of the event. It doesn't mean the mouse is
still there, and our concern is that people will expect this to be the
case. We are looking at these things to see how we can provide some form
of ability to query the current mouse position and the state of the
buttons, but we may end up wrapping it in big disclaimers about how
reliable it can be.

> And what about using
> 
> wxJoystickEvent

It is certainly on my list.

> Hey Pete might be interested in this:
> http://www.wxwidgets.org/manuals/stable/wx_wximage.html#wximagerotate

I am certain that there is a lot of functionality provided by wxWidgets
that we can use. The big problem with it, is that it wasn't well
designed and tested for the kind of use we are putting it to. It expects
to be the main dominating event processing code, and we can't allow that
since it would mean that other things that are not wx-specific wouldn't
be running, since wx wouldn't know about them. Other languages wrap wx
very thinly, and expose most of the complexity of using wx to the
language user. We wanted to avoid that. The trade off is that we have to
wrap every item and expose it in our own way. The advantage for our
users is that we don't just say to them, "Sorry, that doesn't seem to
work, contact the wx people". We will eventually put a person on our
team to interact with the wx project and contribute stuff back. We have
already submitted some of our changes but we are trying to avoid needing
to fix significant issues in wx until after we have a released product.

Ciao, Neil

Post Reply
Re: Mouse
Fri, 09 Nov 2007 14:41:55 -050
Let me be more specific.  Can this (below) or something substantially 
close to it be done in SIMPOL, now.  Yes or No.

If YES, how?
If No, when?

>> SUB main()
>>  ON EVENTCLASS MOUSE CALL checkmouse()
>>  ON EVENTCLASS KEY CALL checkkey()
>>  EVENTCLASS MOUSE ON
>>  EVENTCLASS KEY ON
>>  WHILE NOT done%
>>   WHILE NOT SuperBase.MouseLButton
>>   StatusLine$ = "x: " + LTRIM$ ( STR$ (Superbase.MouseX)) +
"- y: " +
>> LTRIM$ ( STR$ (Superbase.MouseY))
>>   SET STATUS StatusLine$
>>   WEND
>>  REQUEST "Outside Form x: " + LTRIM$ ( STR$ (MouseX)) +
"- y: " + LTRIM$
>> ( STR$ (MouseY))
>>  WEND
>>  END SUB
>>
>> SUB checkmouse(a%,b%,x%,y%)
>>  REQUEST "Inside Form x: " + LTRIM$ ( STR$ (x%)) + "- y:
" + LTRIM$ (
>> STR$ (y%))
>>  END SUB
>>
>> SUB checkkey(queued%,keyval%,fnkeytext$)
>>  END
>>  END SUB

How did it work in SB2
GetCursorPosition and/or WM_MOUSEMOVE messages
and SB3?
DirectInput object?

It just seems like given the ubiquity of the mouse that it should be an 
easy thing to. At some point, an OS has to know where the mouse is. If 
the OS knows, then we should be able to know?

I found mousepos.zip.

See also,  http://www.autoitscript.com/forum/index.php?showtopic=41006
where there is something newer.
Post Reply
<< Previous 1 2 3 4 5 6 7 8 9 10 11 Next >>
( Page 1 of 11 )
about | contact