JavaFX8 node resize handles - resize

I have a StackPane to which I add child panes. Each child has MouseEvent handlers to drag it around the StackPane. Works fine. Then I also want to be able to resize that pane. So I added 8 small 'drag' panes to the child in the appropriate places each with its own clicked/drag handlers.
The problem: once a 'drag' pane mouse event fires, I need to set an anchor point for the parent pane. This anchor point will depend on which 'drag' pane was clicked. How do I identify which pane was clicked in the handler? I suspect I am missing something very obvious, but I cannot see it (Google provides no answers).
I tried using the hashcode, but no luck.

Finally realised what the solution was after Googling a different issue. I had tried event.getSource(), but couldn't relate the returned object to my pane. The solution is simply to cast it (Panel)event.getSource() it and then it's all go! Talking about dim!

Related

Pass TappedEvent to a sibling controll in uwp

I have a user control with a bunch of buttons behind a scroll viewer that has a grid with a bunch of rows in it. The first row is empty. The buttons in user control need to respond to tap/click when not obscured by scroll viewer's content. My problem is that the scroll viewer caches the tap event and it is not passed to the user control because it is a sibling to the scroll viewer. I would like to somehow pass/propagate the tap event to the user control to get the buttons working. I can't find a good solution to this issue because there seems to be no RaiseEvent(e) method on UI elements in uwp. Due to specific requirements, the whole page needs to react to scroll and the buttons are required to be behind the scroll viewer content. Does anyone know if it is possible to pass the whole event to another element or somehow allow for both controls to handle it? Thanks in advance.

How to prevent svg drag on specific element?

I'm using the fantastic svg-pan-zoom plugin (https://github.com/ariutta/svg-pan-zoom) to pan/zoom my svg element, I want to enable the mouse drag to let use move it.
I have a single elemen inside my svg where I want to prevent the drag because it has a click event and when the user clicks on it sometimes it drag the svg element.
The requested behavior is to drag as standard except when the mouse is down on this element.
I already try with event.stopPropagation() and event.preventDefault() but seems that svg-pan-zoom plugin has its own event management.
How can I prevent the mouse drag?
You can have 2 layers (if you don't need to pan/zoom that element).
Or you can still keep all elements zoomed but only some of them listening for events. Just place everything you want to listen for events in one SVG Group element <g> and set it to listen for events.
Last solution would be to override default events for click/drag and write your own handlers.
I would recommend option 1 if you don't need your element to be zoomed, or option 2 otherwise.

Button in UserControl in main page not reacting to pointer in Windows Store apps

To share a common display layout in a Split template Windows Store app, I put a Back button, title TextBlock, and another button in a UserControl, and then use that control in most of my pages. My problem is that in the main page, neither of the buttons will react to pointer activity, be it pointer over or clicking. However, it works fine in any other page. To isolate it, I created a blank app and duplicated the UserControl, but it works in that case.
How can I debug this?
Thanks.
-John
In an "ItemView" page of a "Split" template app, the Grid containing the back button and title must be below the GridView and ListView in the XAML code. Apparently the GridView, with no Grid.Row, and a Grid.RowSpan="2" needs to overlay the first and second rows, and if the button is beneath the GridView, it must assume it is not visible and doesn't need to respond to events. I moved my new user control instance to below the GridView, and the buttons work now.
This whole scheme of overlaying both rows makes no sense to me, but without the Grid.RowSpan="2", the items don't split nicely into two rows for me. I think such odd layout should have a comment explaining it in the template. Perhaps it could save someone else from this same kind of issue.

Item below charms bar gets invoked when search is clicked

I have created a page with horizontal layout listview with enough items added to it have a horizontal scrollbar. When you click an item in de listview it navigates to a different page with some details about the clicked item.
Now I have added search functionality to my app by use of the search contract. That's where the problem arises. When you open the charms bar, it overlays over the listview which is good. But when I click the search icon in the charms bar search is opened, but also the listitem's (which is below the charms bar ) click event is getting invoked.
Anyone else who has seen this behaviour? It feels like a bug to me in the charms bar? Hopefully someone has seen this too and has a solution to prevent this behaviour?
Nice try, but whatever you do (Dispatching, Timer...), the click event is raised prior the OnSearchActivated.
Btw, we've "fixed" this problem by providing the view margin of 86 pixels on the right (I measured the Charm bar, and no matter what resolution, it's 86 pixels).
To keep the view symmetric, we also provided 86 pixels on the left.
Tested it yesterday on the RTM version and it seems that this issue is fixed in the RTM version.
Thanks everyone for your input.
One quick thought is that your app is activated from the OnSearchActivated method when the user invokes a search; you could possibly add/remove event handlers in there.

Silverlight - Create expanding side panel

I'd like to know how I can make a side panel which when collapsed only shows a button that upon click will be pushed out by an expanded area which contains a control of choice. Clicking the button again will collapse the expanded area and the only thing you'll see is the button at the edge of the screen again.
I don't have any good examples of something similar so I hope you understand what I mean.
in toolbox there is a control called Expander, which is exactly for that purpose