Missing mouse up event from different canvas in smartGWT - mouseevent

I have two canvases located to each other. One is supposed to be a kind of workspace you can add items to, select and rearange them. The other one is just a property view.
What I want to do is to be able to draw a rectrangle on the workspace. As long as the user holds down the mouse button the rectangle will show up. If he releases the button all items that are beneath the rectangle will be selected. This currently works good with the MouseDown, MouseStillDown und MouseUp events. I'm drawing another rectangle shaed canvas on the workspace which will be transformed on every MouseStillDown event and the selection will occur on the MouseUp event. My problem is, that if the user hold down the mouse button and moves it to the property canvas and then releases the button the MouseUp event from the workspace isn't called. Neither is the one from the property since it's missing a MouseDown event. So if the user releases the button there the selection won't work and the rectangle stays in the workspace.
Is there an oppurtunity to somehow avoid this? Or is there a better way to determine the area the user selected with it's mouse while holding down the left mouse button?

Related

Slow label and picturebox event firing which are child of Button

i have developed custom control which inherits Button control, actually i`m creating button with one picturebox and label on Button(picturebox and label are child controls). I created same method and wired child controls to behave as clicking on parent(Button), it works but its slow no mather what i do(tried with InvokeOnClick, me.performclick, Me.OnClick(New EventArgs()), tried with same method for all events), but clicking on label or picture box is slow, i need it to be fast as clicking directly on button cause in my application is very important to be able to click on button twice in second for example, if you click on label or picturebox twice at second it will fire just one time not 2.
What i have been thinking of is to make label and picturebox invisible for event is it possible or anyother idea ?
Thanks in forward
You are doing battle with ControlStyles.StandardDoubleClick. Which is turned on for the PictureBox and Label controls but turned off for Button.
So when you are clicking rapidly on either the picturebox or the label then they'll generate the DoubleClick event instead of the Click event. You'll interpret that as "slow" since you probably didn't write a handler for that event. Subscribing the event and calling Me.OnClick is a workaround.
Just don't do this. PictureBox and Label are point-and-click convenience controls but they are extraordinarily wasteful. It takes just two lines of code in the button's OnPaint() method override to get the exact same outcome, minus the overhead and the event problems. Use e.Graphics.DrawImage() to draw the pb's image and TextRenderer.DrawText() to draw the label's text.
Using MouseDown event ensures the event is triggered once per click, regardless of click/doubleclick.

UIButton events. What's the difference?

I've encountered a problem where my button should remain "pressed down" while it shows popover called from it. Popover is selector for some filter and filter is shown on button itself. When I tap on it and it shows popover it becomes deselected no matter what.
I think I have to redefine it's behavior on touch event and make it respond not to standart touch up inside. Then I wondered what are other events responsible for? But I couldn't find events list in iOS library and in StackOverflow are only questions about incorrect behavior of touch up inside or touch down.
So what's the difference betweeen touch events?
touch cancel - when you touch button but move your finger away and
it remains deselected?
touch down - right on tap.
touch down repeat ??
touch drag enter ??
touch drag exit ??
touch drag inside ??
touch drag outside ??
touch up inside - when you tap and release button remaining in it's
bounds . It changes UIButtons state to Normal.
touch up outside - when you tap and release button leaving it's
bounds ?
other IBActions are not sent by UIButton, right?
Also how those events change UIButton's appearance? Like highlighted or selected?
I'd appreciate a link on good article about IBActions, because I couldn't find it.
From Apple's doc for UIControlEvents:
UIControlEventTouchCancel
A system event canceling the current touches for the control.
UIControlEventTouchDown
A touch-down event in the control.
UIControlEventTouchDownRepeat
A repeated touch-down event in the control; for this event the value of the UITouch tapCount method is greater than one.
UIControlEventTouchDragEnter
An event where a finger is dragged into the bounds of the control.
UIControlEventTouchDragExit
An event where a finger is dragged from within a control to outside its bounds.
UIControlEventTouchDragInside
An event where a finger is dragged inside the bounds of the control.
UIControlEventTouchDragOutside
An event where a finger is dragged just outside the bounds of the control.
UIControlEventTouchUpInside
A touch-up event in the control where the finger is inside the bounds of the control.
UIControlEventTouchUpOutside
A touch-up event in the control where the finger is outside the bounds of the control.
Listed in, what I would consider, order of common use/likelihood of occurrence for a normal button:
UIControlEventTouchDown: The user tapped the button. This fires on the finger/stylus making contact.
UIControlEventTouchUpInside: The user tapped the button. This fires on the finger/stylus contact pulled back away from the screen.
Useful for sliders and drag events like moving a component around. The below are in order of occurrence:
UIControlEventTouchDragInside: Triggered as the finger drags into the button area.
UIControlEventTouchDragExit: Triggered during a drag motion. It is called only once, as the users finger/stylus leaves the bounds of the button.
UIControlEventTouchDragOutside: Triggered during a drag motion, after 'UIControlEventTouchDragExit', and is called continuously, as long as the original touch continues.
UIControlEventTouchUpOutside: This is simply the finger/stylus being lifted BUT only if the finger/stylus is no longer within the bounds of the button. The important thing (and probably obviously) to call out is that the touch had to have been within the button at some point to associate this event with the button.
Note: My understanding is that the above can be helpful for:
Sliders: as you might expect the touch may have been intentional but because of the quick swipe action, their finger movement may be sloppy and lift up outside of the slider area.
Moving components around, as when you push things around a screen you want the movement to happen when the finger/stylus touches the border of the component/object.
Other events:
UIControlEventTouchCancel: Something out of the user's control is cancelling their touch action. Think of this as something "going wrong" on the phone side of things.
UIControlEventTouchDownRepeat: Want to detect when your user is mad and tapping a button furiously? Want to detect if they're still in Windows mode and are trying to "double click"? Or maybe you designed a button to do something different if they tap twice. This event helps with all of those!
References:
SO 1: Dif between UIControlEventTouchDragOutside and UIControlEventTouchDragExit
SO 2: What is UIControlEventTouchCancel?

UIView drag event

I have an slide show application. There is a UIView on main screen, I want when someone slide his fingers horizontally it moves to next screen.
What this event is called? (slide fingers horizontally/vertically)
How can i detect this event? Want to call a method xyz on this event
You might be looking for a Page Control.
If not, then you can use touchesMoved:withEvent: to detect the drag event. In this event handler you need to compare the coordinates to detect whether it is moving horizontally or vertically.

VB.NET Minesweeper issue

I have fully programmed my Minesweeper; however, I was having difficulty trying to get the same result as in the original minesweeper for when a user clicks and moves the mouse around while still right clicking. You may notice that in the original Minesweeper, when a user does as explained, the tiles that the user goes to will then look blank. If the user releases the mouse, the current tile they hovered to will become the clicked tile. In my Minesweeper, the tile I click on is the only one that will look blank, and when I hover over to the next tiles, they do not get blank like the first one I clicked on. Then when I release my mouse button when over to another tile, the very first tile I clicked on is the one that gets uncovered. Here is what I already have used. I have the MouseDown event which checks to see if the game has been started to begin the game timer. It also has some color properties for tiles when I click on them and I set a boolean to true or false depending on the user left or right click. I have the MouseUp event which looks at the boolean to determin what the user had clicked on the mouse so I know if I flag or simply click to uncover. Then I have the MouseEnter and MouseLeave which are needed to yield the proper glow I want for the tiles. What should I do to get the same results as in the original Minesweeper with the MouseDown and MouseEnter into other tiles? I tried many other things such as MouseEnter, MouseMove and MouseHover, but all seem to yield the same crummy result as what I already have.
Just another piece of information, the MouseEvents are built in to a UserControl which I then use as my tile in Minesweeper. It almost as if when an event is active, another one cannot be done at the same time.
You might want to consider, DragOver and Drag related events

Mouse events for an NSSegmentedCell subclass?

I'm trying to implement some rudimentary tabs in a Cocoa editor I'm working on. I am using an NSSegmentedControl and adding segments to it as tabs. I'm using a custom NSSegmentedCell subclass for the tabs to draw a little 'x' icon next to the text for closing tabs and so far it's been going pretty smooth.
However, I cannot figure out how to actually process mouse events for the tabs to check if someone moused over (or clicked) the 'x' icon. I tried overriding "mouseMoved" in my NSSegmentedControl subclass, but for some odd reason it stops getting called when I add a new segment to it (I set "setAcceptsMouseMovedEvents" to yes in awakeFromNib, do I have to also set it somewhere else??). NSSegmentedCells, being NSCell subclasses seem to not have any mouse event processing, aside from mouse tracking, which gets triggered only when the control is clicked.
So the question is, how would I properly process mouse events, either in the NSSegmentedControl or in the NSSegmentedCell subclass?
Take a look at NSTrackingArea. You can add a tracking area to your NSSegmentedControl and get mouse-entered events on that to highlight the close button.
As for getting the click events, you're probably best off using a separate NSActionCell subclass for the close button and do some hit testing there.