News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
FL_PUSH on arbitrary area
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
Question  FL_PUSH on arbitrary area

Is it possible to detect FL_PUSH when it isn't done on a button widget?
I've been trying to place points according to mouse clicks on a given region, but Fl:event() aways returns 0 because the region isn't a button. I can test for FL_NO_EVENT and use that, but it is not very reliable because FL_NO_EVENT returns true for both a mouse press and release, and it may return true from other unwanted events.

It doesn't seem logical for Fl:event() to check for a particular type of widget. It seems to me that it _should_ work whenever you click a mouse button, regardless of where the mouse is.

Fl:event_button() and similar didn't work either, since they seem to rely on a test for FL_PUSH

09-03-2007 10:36 AM
Find all posts by this user Quote this message in a reply
iGame3D
Moderator
***


Posts: 231
Group: Moderators
Joined: Apr 2007
Status: Offline
Reputation: 0
Post: #2
RE: FL_PUSH on arbitrary area

Did you look at my earlier graphics demos, I don't know exactly how I pulled it off, its been months now. But that places those rectangles or circles at any point the mouse is down on.

09-05-2007 03:03 AM
Visit this user's website Find all posts by this user Quote this message in a reply
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #3
RE: FL_PUSH on arbitrary area

The last time I looked at the non-segfaulty one (murgaFLTKDrawFunctions) I had no idea at all of how drawing worked, so I kind of stayed away from looking at the source...then of course forgot that it includes mouse tracking.

Looking at it now....

[time passes]

...hmmm, I see "if Fl:event()==5 or Fl:event()==1 then", but I don't think that would be it considering my test of Fl:event() always returned 0 when clicking a mouse button...
Checking for event 5 (drag) sort of works, although it doesn't give the behavior I'm looking for (click to draw a line from the previous click to the current one). It does look a whole lot better than my previous freehand drawing experiment, though, which simply spit out 1000 tiny rectangles per second as you drag the mouse, so I think I'm going to dump the old version.
The above makes me wonder even more if this is a bug. Why would a drag in an arbitrary location be correctly detected, but a click is not?

[more time passes]

Nope, I'm not seeing how it works =o(
I can think of two things that might possibly have an affect, but they are both wild guesses. One is the w:callback(), which may have some influence over Fl:event(). The other is w:make_current(), which I can't seem to make work in my situation. I'm using a nested window, and when I try to make the parent window active from the child script it segfaults, so I have to make the child window the active one. That works fine for the actual drawing, but I wonder if it affects how events are received.

The quaddraw examples use the same check for event 5 or 1, so I dunno what I'm missing.

I suppose it could also be that I'm using a timer which checks for the events. It seems to me that this shouldn't be necessary, but I don't know how else to do it...unless that's what Fl:wait() is for?...i'll have to check that out

This post was last modified: 09-05-2007 06:48 AM by mikshaw.

09-05-2007 06:38 AM
Find all posts by this user Quote this message in a reply
JohnMurga
Administrator
*******


Posts: 381
Group: Administrators
Joined: Apr 2007
Status: Offline
Reputation: 2
Post: #4
RE: FL_PUSH on arbitrary area

mikshaw Wrote:
I suppose it could also be that I'm using a timer which checks for the events. It seems to me that this shouldn't be necessary, but I don't know how else to do it...unless that's what Fl:wait() is for?...i'll have to check that out


That is exactly what Fl:wait() is for ... Unfortunately I haven't had ANY time to look after murgaLua lately, but as of Friday things should be back on track.

Cheers
JohnM

09-05-2007 08:43 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: