OnDrop event triggers and change data for target control - winforms

I have a rather simple Question but I couldn't find any Answer.
My setup is the following. I have a simple WinForm application which has one Element(A) which can be dragged. He is starting a DragAndDrop event copy simple Text.
I have a second Window(B) (TextEditor e.g.) which can handle an OnDropEvent and just put in the Text.
Now my case. I want that after Drag is finished of A to B, I can handle an Event to open a new Window where you can type in more Text. This text should then be the Data which should be used by the DragAndDrop-Event.
I hope its clear and there is any good soultion.
Thanks for any help.
Best regards

Related

Maya drop down menu

I've got a pretty complex question for any Maya coders...
I want to utilize a drop down menu similar to that of the cmdScrollFieldExecuter's [script editor's] "Show Tooltip Help". It looks like a window that has been appended to the bottom of the inputted text with a feedback of all relative commands or strings.
Does anyone have experience with appending a similar textbox/ window/ menu to typed input, and if so, can you toss me in the right direction?
Note: I am not talking about "optionMenu".
Alternatively, is there a way to get cmdScrollFieldExecuter to reference a different array or set of strings?
A complete port of that won't be possible in vanilla Maya - You'd need to use python and QT because the built-in GUI objects (such as TextField) don't fire any events on keypresses so you won't be able to live-update as the user types.
You can almost fake the visual appearance with a window whose title bar is set to off. Use a formLayout to dock a TextScrollField inside it. You'll need to hack up some way of dismissing it since it won't have a close box -- you could put it on a timer or add an invisible button covering the whole thing which closed the window when clicked

Wpf update source trigger explicit on multiple textboxes when a button is clicked and command is executed. In MVVM scenario

I have a situation like this, I have a browse when I can double click an object and it opens in a form and then I am able to modify it (behind the scenes I am passing that object from one view model to another). Then I am able to modify its fields, however the textblock does it immediately, so I can see the fields changing before I press save changes, whats worse when I press cancel the modifications stay on the browse.
I know I have to tell all the textboxes to UpdateSourceTrigger explicit, but I cannot find a simple example in an MVVM way, so only update when the button save is clicked and command associated with it is executed, that should force that explicit update on all texboxes. Any ideas how can I achieve it?
Thanks :)
You use magic. Or, you send a copy of the model, then wait for an OK, and on OK copy the values back to the original. Then you do a little dance and drink a little water.

Drag from one user control and drop into another user control in Windows Phone 7

I am trying to create two user controls in Silverlight using the Windows Phone SDK 7.1. I would like to be able to drag from one control and drop into the other control (or at least receive the event that the drop has occurred).
I am able to give the appearance that the drag is moving the item by using a TranslateTransform. However, I would be interested in knowing whether this can be done by actually moving the element instead of transforming it. Can this be done?
Second, and probably more importantly, how do I get the second control to see the drop event? I've done lots of reading, and no luck with this so far.
FWIW, I am currently using a Grid in each control, but I would be open to changing to a Canvas or other control type.
I am not much aware of windows phone, but we can drag an object from one controller to another controller.(What i did in iOS)
Steps to be followed:
Both controllers should be in same window.
On ManipulationStarted(touches begin) drag the object or item from one controller, Move on another controller
On ManipulationEnded(touches ended) check the dragged object is within the second controller. if Yes, add the object to second controller.
I hope my answer helped you. If it's not useful sorry for that.

How can I intercept the text to be inserted into a RichTextBox?

There is a TextChanged event for the RichTextBox, what I require is a TextChanging event so I have chance to perform an action before the text is changed. The KeyDown event is not enough as my application uses a speech recognition engine which means it is possible to enter text without using the keyboard.
I was hoping I could intercept something in the WndProc method but nothing stands out.
Any ideas or help would be much appreciated. Thanks.
Try using the TextChanged Event from the RichTextBox class. Based on the description from MSDN
This event is raised if the Text property is changed by either a programmatic modification or user interaction.
It should be able to handle what you are trying to do.
Edit: You could have some sort of intermediary storage of the text so that when the text changes it is stored somewhere else first and after the text changed event is done, you can put the text back into the RichTextBox. But without knowing specifically what you are trying to accomplish, this would be my recommendation.

Tool to know Windows Form Application's Form fields

I am working on a WinForm Application.
The Form has many fields/components but is poorly built.
for example a field is used as user name on one case and used as folder path on the other case. Code is quite poorly maintaned.
Is is possible that when i run the application and GUI appears, i can use a tool like 'spy++' which can show me 'names' of the components (not ids). For instance the name of a button or name of a label.
Or if i can use SPY++ for 'names' please tell me?
I would solve the problem by adding a ToolTip control to your form and iterating over each control and adding a Tool Tip message to each control that is the name of the control.
First, add a ToolTip object to your form (from the Tools section of the designer.) You can rename it, but for the sake of my demo, I left it as the default name toolTip1.
Next, add a method similar to the one I'm posting below to the code page of your form. (I'm assuming this is for C# but the code is simple and can easily be modified for VB or C++).
public void AddNameToToolTip(Control c)
{
toolTip1.SetToolTip(c, c.Name);
foreach (Control child in c.Controls) AddNameToToolTip(child);
}
Finally, from within the Form constructor, add the following line of code after the call to InitializeComponent().
AddNameToToolTip(this);
This will add a ToolTip message to each control in your form. All you should have to do is hover your mouse over each control and the ToolTip will pop up a message after a second or two displaying the name of the underlying control.
Alternatively, you can recursively adding a MouseHover event to each control and when the event is fired, write the name of the control to the debugger. This would also work if you are already using a ToolTip control within your form.

Resources