Re: My Bits are Flipping (or, "Why Can't I Be Negative?")
Hello Mr. Serpa ...
Well, actually, that's the problem. The value will be positive if the mouse
is *in* the widget, but will become negative if it crosses past the left or
top edge. This would happen, for instance, if the user has their left mouse
button pressed down and slides the mouse to the left. Therefore, we have a
situation where it's *probably* positive, but there is fairly decent chance
that it won't be.
The only other way I can think of doing it is giving the mouse's position in
turns of the global coordinate system, and allowing the user to convert to
the widget's coordinate system as necessary. The process of converting would
include peeking values, so that would fix the situation. But giving the
mouse coordinates in the global coordinate system when receiving the signal
from a widget would be a bit of a hack, and would not be expected behavior.
Or, I could throttle it from the C++ end, and make sure a negative value is
never passed: but if someone is expecting a negative value, and it dead ends
at zero, then again, unexpected behavior.
Mr. Craig, any possibility of putting the ability to detect signed values from
external libraries on the last-minute 2.5 wishlist? Or the first minute 2.6
one?
Thanks everyone for your help!!
Travis.
On Friday 27 August 2004 07:04 pm, Andy Serpa wrote:
> It is not the difference between negative & positive per se -- it is the
> difference between signed & unsigned values. The library either returns
> signed or unsigned values. If it returns signed values, then you convert
> them. There is no danger to it, and no guessing, unless you don't know
> what the library is supposed to be giving you.
--
Besides the device, the box should contain:
* Eight little rectangular snippets of paper that say "WARNING"
* A plastic packet containing four 5/17 inch pilfer grommets and two
club-ended 6/93 inch boxcar prawns.
YOU WILL NEED TO SUPPLY: a matrix wrench and 60,000 feet of tram cable.
IF ANYTHING IS DAMAGED OR MISSING: You IMMEDIATELY should turn to your spouse
and say: "Margaret, you know why this country can't make a car that can get
all the way through the drive-through at Burger King without a major
transmission overhaul? Because nobody cares, that's why."
WARNING: This is assuming your spouse's name is Margaret.
-- Dave Barry, "Read This First!"
|
Not Categorized, Please Help
|
|