Hi guys,

i am working on allowing the user to drag windows around inside their parent. I am having trouble with restricting how far a user can drag the child outside the client area of the parent. In psuedo code, this is what i am doing:
[size=9]

.IF (left side of child + width of child) < (left of parent + small offset)
...set left pos of child = (left of parent + small offset) - width of child
.ELSE
...
[/size]


what this does is allow the user to drag a child window around inside the parent window, and if they drag the child so far to the left that it disappears from view, then the left of the child will be reset so that a few pixels (the 'small offset') of it will still be visible inside the parent window, thus ensuring the child window never totally disappears.

However, this will only work if there is such a thing as a 'signed compare', because if we take the above .IF statement and put proper values in it, it will look like this:
[size=12]

.IF 0FFFFFFFEh < 00000006h
...set left pos of child...
[/size]

Using a normal compare, this will not work because 0FFFFFFFEh is not less than 00000006h, which means i need the compare to realise that 0FFFFFFFEh is actually -2. And if i was to swap the 'less than' to a 'greater than', then the reposition code would always move the child window to the left, even if it's left edge was not left of its parents left edge.

So, there is the explanation of what i want to do.... is there a signed compare instruction? If not, is there a way of using a normal compare then checking certain flags to achieve the correct result?
Posted on 2002-07-12 21:53:19 by sluggy
Just have to tell MASM you using SDWORDs and it will use the
correct Jcc. Or you could use Svin's great tttn tool. :)
Posted on 2002-07-12 22:11:04 by bitRAKE
Thanks bitRake, using SDWORD PTR worked a treat. :grin:
Posted on 2002-07-13 01:06:04 by sluggy