I have a customEditor with a <select> in it. When I turn on movableColumns, and the user clicks the <select> and still has the MouseDown as they scroll down the list, the column want to move.
Though I havent looked in the code of Tabulator, I would be willing to bet it on the combination of events of MouseDown and MouseMovement within the element are being triggered (though when I test it with the default editor and "select" text to Copy or Paste, it doesnt trigger it, but that might have something to do with focus() as well)
If I'm careful to click on the <select>, release the button, and then move the pointer to the option, the column doesn't attempt to move. Even if after the initial MouseUp, I can then MouseDown and move the pointer all I like, the column wont want to move. So again, I think it has something to do with the <select> then taking focus() and the MouseEvents not being propogated up the tree ?
For the moment, I've disabled movableColumns to reduce user frustration, even though I've explained to them the behaviour (do users EVER listen ?!?!) until a solution is found.
Addendum : it's not just MouseClick and MouseMove. if I MouseClick and hold (perfectly) still, a timer fires off and it wants to move the Column.
You will need to use a e.stopPropagation() and a e.stopImmediatePropagation() to prevent the event bubbling out of the editor
Related
I am using FLTK 1.3, displaying a single Flex column with a number of Flex rows inside a Fl_Scroll. I want to do something to rows that were outside of the visible area when they scroll into view. But I cannot figure out how to do that. There is no event emitted when the scroll position changes (as far as I can see) nor does a callback on the scroll seem to do anything.
The only solution I can think of is something like using the column's, scroll's, or window's callback to get informed of all UI events (such as move, key up, leave, ..) and use them to check whether the scoll's yposition has changed from the last time and run the code I need if it is....
But there surely must be a better way?
Thank you!!!
This is an Excel VBA Project (because someone edited the title) and I need to clarify what this post is about.
I am writing code that walks/works through VBA Code Modules to list procedures as well as controls on UserForms and list how/what procedures call each other.
I was trying to simulate jiggling of a userform control, at run time, on a Userform in the VBA Editor's Designer window, to notify the user that this particular control, was selected, with the mouse on the ListItem/Node of ListView/TreeView on a modeless userform.
It's complicated to describe in words, so I attached a GIF.
In the GIF, it can be seen, in the Immediate pane, that code execution paused after executing the MouseDown and ItemClick events in the ListView, because I didn't release the pressed Left Mouse Button (LMB).
So I guess the sequence of events in ListViews is like:
MouseDown
ItemClick
Pause
MouseUp
Click.
And, thus, I put my jiggle routine code in ItemClick event of the ListView.
However, when I try to do the same thing with TreeView, I found that the code execution paused right after MouseDown event of the TreeView, if I didn't release the LMB, without going on to execute the NodeClick event, as it did with ListView and it's MouseDown Event.
Since I placed my jiggle code in TreeView NodeClick event handler, which has not occured yet, there was no jiggle effect.
But upon release of the LMB, the control's jiggle effect was quite immediate for the eye to catch, as the code execution continues after the pause at the end of MouseDown event, nonstop, up to the end of MouseUp Event.
This sequence of events can be seen in the Immediate window's output as shown in the GIF below.
It is also evident here that the code execution paused after MouseDown event was handled, if the left mouse button was held down, without going on to NodeClick Event, as it did in ListView.
MouseDown
Pause
NodeClick
MouseUp
Click.
So, the situation was laid out as above.
I tried to place the jiggle code into the MouseDown Event.
However, since I need the SelectedItem from the TreeView to get my jiggle code working, it's like I needed the NodeClick Event anyway.
I tried to examine the SelectedItem/selected-Node of the TreeView in the MouseDown Event but unfortunately, it only returned the previous SelectedItem/selected-Node rather than the Node on which the MouseDown Event just occured, which makes sense in itself, because SelectedItem is not yet set to new Node as NodeClick Event has not occured yet.
I thought that if only I can get the Node under the mouse at the time of MouseDown Event by using HitTest, I could use that Node as the SelectedItem in my jiggle code.
Another obstacle arises, in that, the TreeView HitTest function uses X,Y as Singles which appear to be in ?Twips rather than Pixels, I may be required to use magic numbers=88,90 and the magical TwipsPerPixel function and recalculate it for different monitors and resolutions.
So, I searched for a different solution.
PS:Being a Myanmar, I have a duty to promote awareness that there's a Revolution occuring right now in Myanmar against a cruel military coup and would like to plead you guys to please support the people of Myanmar. Thank you.
I found the different solution in the form of a custom-made HitTest function, using the SendMessage API call to the TreeView, rather than using the TreeView's default HitTest function, available here.
The code sample there, was allowed to be used freely but not to be published on any website as mentioned in their copyright disclaimer.
So I guess I cannot share the code snippet here but I believe it's ok to share the link to that site.
I had to modify, the code mentioned there, a bit, to return the Node but not the handle to the Node as returned in their function.
I used that function because it uses Pixels as X,Y coordinates rather than the ?Twips that VBA uses.
Similar function for ListViews can also be found elsewhere if one googles hard enough.
So, it works like a charm and the control is jiggling now, inside the MouseDown Event, without using NodeClick event.
I think that the bottom line here, is:
ListViews and TreeViews differ in handling mouseclick events in that ListViews seem to consider ItemClick Event as part of the MouseDown Event sequence and TreeViews consider NodeClick Event as separate from MouseDown Event
I have no idea about the reasoning behind this but suspect that it may be in their origins
I wrote up this Question+Answer post to help fellow VBA programmers with the ItemClick vs. NodeClick Event sequence discrepancy and also to let them know that there is a better HitTest routine out there, which can be used without having to convert mouse coordinates in pixels.
This whole VBA project is part of my VBA Project Info tool (with Code Obfuscator and Visual Codeflow tools) with the barebone-basic Alpha RC version available on GitHub.
Remarks: I cannot, for the life of me, find the official description of MouseClick Event sequences of ListViews and TreeViews anywhere. Thus, had to resort to debug.print "1.TV_MouseDown" stuff.
PS:Being a Myanmar, I urge y'All to please support the Myanmar Spring Revolution.
Vive la Myanmar Révolution!!!
When I'm testing my app on a mouse-driven device, I'm seeing a couple of odd highlight issues that I would like to try and resolve.
The first occurs when I call up the app bar, hover the mouse over a button (at which point the button goes grey) and then press Escape to dismiss the app bar. If I then call up the app bar again, the button has stayed grey, even if the mouse isn't over it, and remains in that state until I move the mouse over it and then away again.
I can't immediately see a property of the button that I can reset to clear that state when the app bar gets dismissed.
The other oddity I'm seeing is that sometimes the first item in the list on the page will get a box drawn around it:
This seems to happen when the app bar is being dismissed. I'm guessing that this is because the item is in a particular state that causes the box to appear but I'm not sure what state or how to clear it. The box does not appear during normal use of my app.
Thanks for any clarification or solutions you can provide.
I found a simple way to workaround this issue. In the code for Clicked/Tapped set Visibility of the button:
CreateNewDatabase.Visibility = Visibility.Collapsed;
CreateNewDatabase.Visibility = Visibility.Visible;
It will reset button state to Normal.
Hope this helps!
So, the issue is that the VisualState for the Button is being set to PointedOver, and then not being unset (because your mouse isn't leaving the bounds of the control and therefore triggering a PointerExited event). What this means is that you'll have to manually set the VisualState of the Button if you want it to change in this manner. You could do it on AppBar's Closed event. Basically, do a recursive check of all Children of the Content property of the AppBar using the VisualTreeHelper. Check to see if the Child is a Button. If it is, set its VisualState using VisualStateManager.GoToState().
I've also figured out what was causing the black box around the button - it is to indicate that the button has Focus.
The rather strange thing is that I'm not really sure why that specific button is getting focus or how a user is supposed to give focus to a button without it just randomly happening so, until I figure that out, I've decided to comment out the Focus state support from the Visual Manager XAML used in the default GridView item style.
Greetings.
I have to make a draggable MFC dialog window, which has a background - used that: http://www.codeproject.com/KB/graphics/picturewindow.aspx - and has several picturebox controls. I have tried two approaches, and while they do work, they have some problems.
First approach is "Manual" - on the LBUTTONDOWN message I check if it;s on a clean area of my window, and set a flag variable. On MOUSEMOVE, the flag is checked and if it's set, a MoveWindow function is called, and then, Invalidate(1). On LBUTTONUP, flag is unset.
This approach works correctly and redraws as needed, but is somehow very slow - if I'm moving the cursor too fast, the window falls behing and isn't dragged, as cursor's not over the window anymore.
The second approach is "Automatic" - I just call
DefWindowProc(WM_SYSCOMMAND, SC_MOVE+2,MAKELPARAM(point.x,point.y));
on LBUTTONDOWN, and it handles the rest, it's quick and never fall behind, but when I drag it over screen's edge ( so that some part of the window gets invisible), when I drag it back, all the controls get invisible and are not refreshed, background is okay. I suppose that's because Invalidate() isn't called during movement that way, as I actually call it after calling DefWindowProc() and so, everything is refreshed properly when I depress the button.
What should I do to improve either of those solutions? I need it both fast and correct. I may have not provided some required information, I'll add it is need arise.
Thanks in advance.
Solved the problem, by modifying the second way. I added a total redraw to the OnPaint(), and to get rid of flicker, I only redraw durng dragging, by using a flag variable.
I'm using Yui to build a "popup" menu that works a bit differently with the mouse than usual. This is not a ContextMenu, because I want it to respond to left clicks, and the ContextMenu seems bent on responding to right clicks.
Following the examples, if I do this, the menu comes up and everything is close to how I want it:
YAHOO.util.Event.addListener(myClickTarget, 'click', myThingGotClicked);
In my myThingGotClicked function, I manually set the menu's position and show() it.
My problem is that I want to "bind" the menu visibility to the state of the mouse button. That is, on a mouseDown, I want the menu to come up, and on a mouseUp, I want the menu to disappear (selecting the active item, if any). So, listening to the 'click' event doesn't do the right thing, because a "click" is only sent after mouseUp.
The "obvious" solution is to do this:
YAHOO.util.Event.addListener(myClickTarget, 'mousedown', myThingGotClicked);
But this doesn't work. Stepping through in a debugger, you can see that it does actually bring up the menu on a mousedown, but then something immediately hides the menu. At full speed, it looks like nothing happens at all.
Any thoughts?
The problem is that the MenuManager class listens for the mousedown event at the document level and hides all visible Menu instances. So, since you are building a unique sort of Menu implementation, you'll need to stop the propagation of the mousedown event inside your handler so that the MenuManager doesn't handle the event. Here is some pseudo code for you:
var myThingGotClicked = function (event) {
YAHOO.util.Event.stopPropagation(event);
// Do other stuff
};
YAHOO.util.Event.on(myClickTarget, 'mousedown', myThingGotClicked);
Todd
That's a bit closer, as the menu does pop up, but if you try to make a selection in the menu, the text selection of the page underneath goes sort of nuts. I also need to add a mouseup handler, I think, as the menu doesn't go down on mouse release.
What I really want here are menus that work like menus on every version of the Mac OS (until more recently when OS X added the "click to make the menu 'sticky' to the default behavior).