So I have failed to find anything that works...
But what I want a messagebox that wont allow the user to do ANYTHING untill he or she has clicked ok.
So if they were to say...Click outside the message box. it would beep and blink at them untill ok is clicked.
Is this done through the properties on the left hand side for the main parent form? Or is this all done through programming?
Thanks everyone.
Show the window using the .ShowDialog() method.
This question has been answered in this post, but in a nutshell, you need to set the MessageBoxOwner property to the main UI window.
Related
I'm working with GTK# and I have a dialog that I want to close when user clicks out of it. Very similar to the way a combobox works: when the dropdown list is expanded and you click out of it, it closes.
There are similar questions to this problem, but for other languages =( and I can't figure out a way to relate those answers to my problem.
Thanks in advance.
At first guess, you should connect to the notify::has-toplevel-focus signal of your dialog, and close it when the has-toplevel-focus property becomes false.
In my WPF-project im popping up an Microsoft.VisualBasic.Interaction.InputBox to get a filename from the user. If this filename is already in use im popping up a System.Windows.MessageBox to show the hint, that its already in use. After i hit OK on the MessageBox and it closed, i still see parts of the InputBox mixed up with some elements(a button) from my main programm.
Why does this happen?
Thanks in advance
You generally don't want to use any Windows.Forms based controls in a WPF application, it's just somehow against the point. You can easily create your own input box though, with the advantage of total control over behavior and style. This link stackoverflow describes your problem very nicely.
Shame I have to install another toolkit, but this seems to be pretty useful: Coding4Fun InputPrompt.
I am having an issue with it though:
There only seems to be functionality for triggering an event when the input is 'completed' without being able to differentiate between whether the tick is tapped or if the cross is tapped.
Rushed into asking for help unnecessarily there. Found a solution, will post below.
Original question:
Users of my application can currently submit messages which they do by tapping on a textbox and typing in the message and then tapping send.
I want to make this cleaner by not having a permanent textbox for this and instead have users tap on a button on the application bar along the button which brings up the keyboard along with a textbox to type into, and when users tap submit the textbox and keyboard disappear again.
I can't see any way of creating a popup with a textbox in it, so how would I do this?
I'm using the WP Toolkit already for a messagebox with a ListPicker inside, by even this toolkit seemingly has no way of adding a textbox.
I'm not sure what your trying to do is even possible. However, what you could do is have a Parent Form which contains your ideal Interface. Within this Parent you could create an Event Handler that is listening for a response.
Then when it comes to that Textbox it actually creates a Child Form or Page. Which they can input their value into. Then the page automatically closes, which then the Event Handler will already know the change for you to manipulate with the rest of your Logic.
As mentioned above, normally you would go to another page. I don't know if my solution is viable, but it does accomplish your goal. I'd recommend possibly refactoring your interface so that it makes it slightly more elegant. That way your logic handles it more elegant as well.
Hope that helps.
Shame I have to install another toolkit., but this seems to do the trick just fine: Coding4Fun InputPrompt.
They've added input.IsCancelVisible = true to add a cancel button and then use e.PopUpResult.ToString() == "Ok" within the input_completed method to only submit when the tick button is tapped.
I m coding in c# and I want to change the default arrangement of 'Save' and 'Cancel' buttons in SaveFileDialog. The default arrangement is that the 'Save' button is above the 'Cancel' button.
What I want is to place 'Cancel' button on the right hand side of the 'Save' button.
I searched over the web and found that the text on these buttons can be changed(to which the answer was on stackoverflow itself) and nothing found on changing their arrangements (locations).
Please give me a solution if any of you have experienced this so far....
thank you
Please don't do this.
The user is used to where these buttons appear. If you try to change their layout then you will just make you app feel wrong.
If you have to do this then should make sure you use the legacy file dialogs (which will make your dialogs look even more odd on Vista/7). Use the lpfnHook field in the OPENFILENAME struct to obtain hooks in to the dialog procedure. Respond to the CDN_INITDONE notification and move the buttons around with MoveWindow or SetWindowPos. You'll have to hunt for the button window handles.
But really, please don't do this, you'll just make your app worse.
That rings a bell. When you have the code to change the text of the button then you have the handle of the button window. Which you can then use when you pinvoke GetWindowRect and MoveWindow to move the button somewhere else. Visit pinvoke.net for the declarations.
Beware that the dialog changed in every Windows version. The next one might well break your program. Your customer is not going to be disappointed when you don't do this.
I'd like to create a popup dialog box in silverlight in which i can manipulate controls, enter data, and return a value. I want it to be modal, so that when it is open, the page "Below" is inaccessible. I havent found an easy way to do this yet. Any suggestions?
I know the question asked for a Silverlight 2 solution but in Silverlight 3 (Beta now, RTW in July 2009) there is a built-in ChildWindow that can do everything you're looking for.
I haven't found a perfect solution either. The closest I have seen is this:
Using Popup to create a Dialog class
If it is ok to be non-modal, you can try this tip using HtmlPage.PopupWindow().
How to Popup a Browser Window
I'm new to the Sliverlight framework and am just starting to figure it out, but I have a similar need for a popup modal dialog box. I just tried an idea that looks promising:
I created a Rectangle (named "Shield") that covers my entire application area. It exists on top of everything in the main app. I set the fill-brush to White, and the opacity-brush to 81% so that the main app contents show through, but lightly (as in disabled). Then make sure the "Shield" is hit-testable. Now, when the "Shield" is visible, it will also, in effect, block all input to the controls below (at least from the mouse, haven't tried keyboard yet). When the app initializes, set the "Shield" visibility to Collapsed. In that state it won't block input to the main app.
The dialog box is then constructed on another canvas element that exists in the z-order on top of the shield. Normally the dialog box will be invisible, but when I need it, I just set the "Shield" to visible, and the dialog to visible. Since the dialog is on top of the "Shield" I get a very modal-like behavior. When the dialog box is closed, make both the dialog canvas and "Shield" canvas invisible again and the main app is again active.
I'm sure this the most brute-force way of doing it and that I will eventually zero in on a more elegant construct, but it works for now.
A more elegant solution is here:
http://community.devexpress.com/blogs/theonewith/archive/2008/08/06/custom-silverlight-controls-creating-a-reusable-messagebox-dialog-part-i.aspx
I had the same requirement and ScottGu's Building a Basic Modal Dialog Using a User Control was the best solution that fit my requirement.
Here's a free library that provides one: http://www.vectorlight.net/demos/popup_dialogs.aspx