On certain windows in our application the keyboard caret disappears when we check in / checkout objects. This makes the UI readonly or editable.
So if I am on a text field and it is editable, and I check it in the blinking caret disappears. I check it back out and the caret is still gone. Both before and after I can use Shift+Left arrow or right arrow to see that the control still has focus (a .NET textbox control).
The odd thing is that it seems to happen all controls on certain windows but works fine for all controls on other windows.
I know this is a little vague, but I'm just looking for ideas of what could possibly make the keyboard caret disappear like this. (or how to troubleshoot or debug this issue)
We don't have any Cursor.Hide calls, there is not any code that calls ShowCaret or HideCaret ( I looked and we have no code with the word "caret" it it anywhere.
I've checked on both the good and bad controls and done some debugging to see that the cursor is "IBeam", and I've put some calls to GetCaretPos and GetCaretBlinkTime in, but in both the good and bad cases the values seem reasonable.
DevExpress has confirmed that this will be fixed in the next release and offered me a temporary build if I need one. Excellent customer support.
Related
I made a small uiautomation app that scrolls through a forms windows searching for a specific richtextbox. Once it finds the richtextbox, it would extract the text and verify against a constant. I already coded the entire program but I have two issues:
The FindAll function sometimes misses the textbox. I believe its due to scrolling too fast since if I step through my app, it works everytime.
The TextPattern applied to the richtextbox provides me with DocumentRange.GetText function. However, it doesn't retrieve any returns/new lines.
Is there anything I can implement to consistently catch my textbox without slowing down the scroll?
Is there any option to extract the text with returns/new lines included? I can consider Copy/Paste since some of my textboxes aren't selectable.
Update 1/19/2015
For problem 1, I placed a couple Thread.Sleep(500) . I'm not sure where it would indicate the pane is still loading due to scrolling.
For problem 2, I found out that the textboxes I thought were unselectable are selectable. However, I still don't want to use the copy option since one event that changes my projects focus will copy the wrong location. I barely keep the SendKeys option as it is.
I have whipped up a C# clipboard application that stores multiple 'clippings' for later use. I use low-level keyboard hooks to pop open my application's window(s) on command. When the window is closed (or a clipping is double-clicked), it is supposed to paste the selected clipping into the last active window (the window prior to my application's window). I use low-level WINAPI methods to determine the last active application, snag its handle, and then return focus to it before simulating a Ctrl+V keystroke to paste.
This typically works except in one very unique scenario: I am in a WPF application project, Quick Finding in a XAML file, the cursor automatically switches to the body text, not the Quick Find textbox, and pastes it there. It seems to have something to do with the loss of focus/activation, as it moves the cursor whenever I activate another window, regardless of my own application's running.
VB files, C# files, what have you, and XAML opened in WinForm projects do not steal the Quick Find focus when switching between the VS2013 application and my own; upon returning to the last active application, the text pastes into the Quick Find box.
Only the XAML in WPF application projects gives me this problem.
So far. I know it is a fringe case, but I expect to run into more. This program is meant to be used in a coding environment and it's pretty important that it be able to handle these kinds of scenarios.
I've tried getting the internal control handle using code from http://www.codeproject.com/Articles/34752/Control-in-Focus-in-Other-Processes, so that I can return the focus to it, but it seems that the handle for the body text and the handle for the Quick Find text box are the same.
A partial solution is found in: How do I prevent the original form from losing focus when I show another form? The popup window I use is navigated primarily through my low-level shortcuts, and therefore has no need of explicit activation.
Using the mouse on it or any of my other windows (as I expect my users will sometime), will cause it to gain activation and circumvent this fix. However, it's such a fringe case it doesn't seem to matter. Hopefully this helps anyone in a similar situation (if not necessarily specifically this one).
I'm trying to make an application that will test some features of an existing app and I wanted it not to be window-size dependent and not to require focusing the window or etc.
I've already figured out how to get window handles for different controls in the tested app so I can click buttons, enter text to textboxes etc. with Send/Post Message but still got a few unsolved problems.
The first is selecting an item from a pop-up menu that can be triggered by button click (TAdvGlowMenuButton class) or right click somewhere- I can't even see any messages related to it in Spy++ so I have no idea how to do it, is it possible to select an item by name? as I don't have it's id
The second thing is clicking next to something, for example 10 pixels to the right of a button.
I have the button handle so I can get it's size and it's parent but I still don't know how to get it's position inside the parent - any ideas?:)
And also a quick one but I don't believe it is possible - can I somehow get position of a label in the tested app? I can't even see it in Spy++ .
I hope you can help me to find it out ;)
Edit: I forgot about the most important thing:P , I'd like to achieve it with Send/Post Message if only it is possible.
My recommendation would be to abandon the message sending/posting model altogether and instead use UI Automation. Automated testing tools is exactly what the UI Automation APIs were designed for, and they are much more capable than SendMessage/PostMessage.
Yes, I realize that this is exactly the opposite of the answer you were looking for. But you will have no end of trouble getting messages to do what you want. A fair number of them rely on the application having the focus, and it is completely reasonable for your code to make this assumption when you receive e.g. a WM_KEYDOWN message. A testing tool should not flag that as a bug.
I notice you've tagged this question with the C# and .NET tags. In that case, you may be interested to learn that the UI Automation APIs have been wrapped in the .NET Framework.
I am thinking of using a messagebox to display validation failure messages in the windows mobile app. that I am currently working on. My thinking here is that there is such limited screen realestate that I'd struggle to dedicate an area on the main form specifically for displaying these validation failures. I am a little concerned as to the usability aspect as the user will be force to close the validation messagebox after a validation failure.
Does anyone have any thoughts on this approach or experience that would suggest that there is a better way of doing this?
I know the ErrorProvider is not available within the compact framework. But maybe this would be a starting point on how to do it.
Like the ErrorProvider i would show a simple icon next to the input box that shows something is wrong. Due to the fact, that you don't have a mouse cursor to hover over it, i would in case of clicking on that icon show a concrete error message in a text box docked at the bottom that will hide again if you simply click it.
So the user gets a hint that something is wrong (maybe he already knows what) and can hit on the icon to get a clue. While the clue is showing he can still insert something within the form (he can't see everything, but currently he is only interested in this single box) and one click further (on the appeared text box) he gets back to full screen.
At a last step the box should maybe also automatically disappear if the focus is changed to another input box or the error is fixed.
I would show a message at the top of the screen (as browsers do) that summarizes the errors encountered, in the likes of "X required fields where not filled". And then a more detailed error closer to each of the fields that could not be validated.
That way, the information about the mistakes is still visible while the user is correcting them.
I know that when a drag/drop operation is completed, upon receiving a MouseUp or Esc key event, it returns an enum that indicates what happened (Move, Copy, None, etc.) My question is this: is there a way to send back status information to the form/control that initiated the drag event, while it is going on?
The use case is as follows (think Visual Studio-esque layout manager for all of this): I am writing a layout/window managing component that allows regions of the layout to be dragged around. I use a transparent form to paint a semi-transparent overlay that changes based on where the mouse is dragging over, a la the preview overlay that appears when dragging windows around in Visual Studio.
Another motivation is that the serialization process I describe is relatively resource intensive, and I'd prefer not to do it if the dragging is all going to occur within the same process/window. So, if there was a way to lazily serialize only when an actual "drop" in another window happens, that would probably make all the difference in usability.
What I want to do is enable dragging between different windows or even different instances of the application. I've already plumbed out the serialization code and everything, but the issue is that, when I drag a chunk of layout into another window, the first window doesn't have any way of knowing that the mouse is now over another instance of the application, which is more than capable of painting its own overlay. So, the original overlay hangs around like an idiot and my program looks like crap.
Is there any way for me to pass along some kind of callback or is there any message or property I can listen for/poll during a drag operation that will tell me if my mouse pointer is over a region that can accept its data? Please don't make me resort to listening for the CursorChanged event, I've already lost too much self respect using reflection to hack around weird wpf/winforms dragging interop bugs. If anyone could suggest a clean resolution for this problem I would be extremely grateful.
Additionally, if anyone could point me to any favorite sites which describe how to go about doing reeeeally funky things with drag and drop, it would be appreciated, as I've found there is quite a lack of really nitty gritty information available about dragging. Usual things like custom cursors and the like are okay, but I'm probably more interested in Win32 black arts and the like.
UPDATE:
I actually just found out about the GiveFeedback event a second ago, came back to my question, and there it was. Huge facepalm moment. However, since I've got you here, what about my second question: is there any way to lazily load the information only when it encounters a valid target? Could I somehow implement my own IDataObject or do things get marshaled righ when the mouse leaves the form? GiveFeedback provides me only with whether there's a valid target under the cursor, but doesn't let me change what data is being dragged...
ANOTHER UPDATE:
Is there any way to determine the source of a drag operation? That is, when my control receives a DragEnter message, how can I tell if the source of the drag is my own control or a foreign one? I know I can hackishly encode it by messing with the AllowedEffects property, but is there any more direct route?
Check out the GiveFeedback event (there's a nice article here) - that sounds to me to be exactly what you're after.