http://java.sun.com/products/jfc/tsc/articles/mixing/index.html advices how to make JPopupMenus heavyweight. Just set the property:
setLightWeightPopupEnabled(false);
It works fine, but if I have submenus in the popup, implemented as JMenu items, they don't seem to inherit the popup's heavy weight. JMenu doesn't have a method to make itself heavyweight, and using an AWT Menu isn't an option, since I want to put Swing items into it.
How do I make the submenus heavyweight, too?
It seems to be a Swing bug. Setting the global property
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
works! Also submenu JMenu items go heavy, as they should. Obviously the per-instance method setLightWeightPopupEnabled should work similarly, but it doesn't.
I filed a bug (Bug Id: 7005406) on this, but I leave the question here just in case that someone else bumps on this. So the solution is to use the global setting until the bug gets fixed.
Related
I have made a a feature using the native HTML drag and drop API in Vue 3. However, I would like to override the opacity that gets added when dragging. I have tried adding to the style like this in my ondragstart event
event.currentTarget.style.opacity = 1;
but it seems like that style can't be overridden. I have seen a lot of people on various forums complain about how its hard/not possible to change this "ghosting" effect. But if anyone has a solution, please let me know :)
I think the solution to this problem can be much easier than you think. Adding attribute !important to your style will overwrite everything :)
event.currentTarget.style.opacity = "1 !important";
Let me now if this works :)
This done by replacing the default drag behaviour. You setup your own drag experience and then you can control how the browser handles the default behaviour.
Usually, the drag is turned off and a clone is of the node is moved.
I have a few annotations in my graph, 3 to be exact. Two of them are text annotations, which I just need to stay visible, and that's what they're doing.
But I also have a LineArrowAnnotation, which I need to appear and disappear depending on the state of my underlying data model. I have bound the Visibility property bound to a bool property in the view model.
<sci:LineArrowAnnotation Visiblity="{Binding ArrowVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
Pressing F12 on the "ArrowVisible" property in Xaml editor takes me to the appropriate place in the view model. I've verified in debugger that the value of my view model property is set according to my expectations and the getter for of the property is accessed when a change is triggered.
As you can in the screenshot, I can position the arrow by manipulating its X1,X2,Y1,Y2 coordinates (left and center). But if I try to set visibility in the same way, the tip of the arrow is still visible (right). I'm assuming the whole arrow is actually visible, but since the change that disables the arrow also sets all coordinates to 0, it's displayed at the edge of the graph and therefore only partially visible.
As a workaround, I've even tried to bind the stroke thickness of the annotation, setting it to 0 if the arrow is supposed to be hidden.
StrokeThickness="{Binding ArrowStrokeThickness}"
This too did not have any effect. However, it served to verify that the binding is correct and the value is read, because a breakpoint in the ArrowStrokeThickness getter was hit as expected. (I've added this property just for this workaround, so it can't have been accessed from anywhere else).
I realize I could work around it by placing the arrow outside of the visible range when it's not supposed to be visible, but that's an ugly solution that would require me to hack my view model.
I'd like to add that while I'm still using SciChart version 3.31, I've had the solution briefly updated to version 4.0.5 (I've since rolled back this change) and the arrow annotation was behaving the same.
Edit: deleted picture for intellectual property reasons.
This question has been asked many times on the SciChart Forums here, here, here and here.
The accepted solution is to bind to Annotation.IsHidden (boolean DependencyProperty) to show or hide an annotation.
So I found out that the LineArrowAnnotation inherits the Visibility property from UIElement. It seems that it wasn't supposed to actually support it. Either that, or the implementation is incorrect. Anyway, I looked at which properties actually belong to the LineArrowAnnotation class, and I managed to hide the arrowhead by binding the HeadLength property and setting it to 0 when the arrow is supposed to be hidden.
I feel like I'm missing something obvious. I have an application which uses the 'IsSelected' property of GridViewItem to indicate that an item has been selected. When I'm using the application on a desktop computer (no touch devices) and I right-click on the item, it becomes selected. Take the same program and put it on a Surface and I can find no gestures that will select it. Swipe-down, press-and-hold; nothing seems to do the work that the Right-Click does on the desktop.
Anyone have any ideas what might be missing?
OK, got the answer and it's not pretty. In my code, I had attempted to subclass the GridView with my own control called ContentView. In XAML there is no subclassing of standard controls (you can't use the 'BasedOn' to pick up the style of built in controls) so my ContentView was not picking up the styling of a standard GridView. However, after pulling apart the standard style I've discovered the two critical features are:
IsSwipeEnabled - Must be set to true for swiping to work on the item.
ScrollViewer.VerticalScrollMode - Must be disabled so the scroll viewer doesn't try to interpret the swipe motion as a command to scroll downward.
After that, swiping to Right-Click works easy as pie.
I get what you are asking. It seems counterintuitive, huh? In this situation, my preference is to enable item clicking and use item clicking to set the selected item. If find this to be the most intuitive for users. Start with this XAML:
<GridView IsItemClickEnabled="True" ItemClick="GridView_ItemClick" />
And then simply do this:
private void GridView_ItemClick(object sender, ItemClickEventArgs e)
{
var grid = sender as GridView;
if (grid.SelectedItems.Contains(e.ClickedItem))
grid.SelectedItems.Remove(e.ClickedItem);
else
grid.SelectedItems.Add(e.ClickedItem);
}
It should work for SelectionMode Single and Multiple just fine.
Does that make sense?
// Jerry
I simply cannot find a way to get a ScrollViewer to share manipulation events. As soon as I put something inside a ScrollViewer and then set that items ManipulationMode, the ScrollViewer stops working
I have read that the ScrollViewer handles all of these events and stops them bubbling up, but there MUST be a way to get around this without disabling the ScrollViewer's scrolling behaviour.
I am very simply trying to implement a horizontal swipe feature on items in an ItemsControl, which is inside a ScrollViewer. (I have disabled the ScrollViewer's Horizontal scrolling mechanisms to no avail)
Without the ScrollViewer wrapped around it, everything works fine.
Any ideas anyone ? I cannot believe that this simple UI gesture cannot be implemented.
Many thanks
Dean
You can use a ListView to get the built-in cross-slide/swipe behavior if that's what you need. Otherwise - the last time I had to implement dragging out of a list - I put a rectangle in front of the ScrollViewer and captured all input events and then manually handled ScrollViewer scrolling. It's a bad idea, but there is no better choice yet.
I'm working in a mobile app for iPad in Flex 4, I have a list with custom items rendered, data is taken from external XML. In that XML I get an image path, so when I scroll down, the images go out...
Is there a way to prevent the list of items from getting destroyed upon scroll down?
Yes, I believe the feature you are talking about is item renderer recycling.
For performance reasons I don't recommend turning this off but if you have to you can set
useVirtualLayout="false" on your list
Set your list useVirtualLayout property to false. But beware of performance issues !
See :
http://flexponential.com/2010/01/10/caching-images-loaded-from-a-spark-item-renderer/