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.
Related
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've been trying to achieve this for months now and nothing seems to work!
Both Opera and Firefox 4 draw their menu button on the top-left corner. I can tell from a mile away that the button's ON THE FORM, because, when minimizing the form, the shrinking minimize effect shows the buttons, and the tabs.
I couldn't find any working ways or code in C# to do this, or in C++.
I know this is possible, but does any of you happen to know how?
You'd be helping a lot of people if you'd tell us.
search on internet how to draw anything on the non client area of a window.
in the times I was working with Visual C++ I was able to do so if I remember right taking care of the WM_NCPAINT which paints on the non client area, I do not have examples here but it should not be a problem to find some code on Internet.
I guess there are not builtin methods to do it in c# other than overriding the windowProc...
I think WM_NCPAINT should do the job for you, as indicated by Davide Piras.
Otherwise, the easiest way to have a customized title bar would be not to have a title bar at all. And then mimic the title bar functionality in the client area of the form.
You will have to handle a few messages by yourself, though.
I'd like to implement a feature in my application where show a dialog to the user, and the main form (similar to how jQuery looks). My only idea is to take a screenshot of the form, place it as the background of a panel (with opacity to my liking) then pushing the panel over everything on the form. I have to believe there is a better way of doing this, any suggestions?
The Opacity property is what you need to "dim" a form. You'll need to create an overlay, my code in this thread shows how to do this.
Be careful to not make it look like your program is displaying a UAC prompt. While perhaps appropriate in browsers, the user will never have any trouble recognizing that a window overlaid by a dialog is disabled. Controls paint themselves differently to make it clear.
Why not just set the opacity to something like 50% of the parent window just before launching the modal dialog and then back to 100% when the modal dialog is dismissed? This isn't exactly what you're asking for serves the same function for the end user.
If you do want to do something like your JQuery example you would indeed have to do the screen cap/augment/set as background idea that you described.
I know this is an old thread but if still interested you can take a look at this project.
Download Project
Is it possible to take focus from another program to respond to an event, but then once the response has been handled, switch back to the previous program and restore the cursor where it was?
This sounds like a weird question, but think of it along the lines of
User is typing in a text box in Program A.
A window for Program B pops up and user presses a few buttons to confirm something.
Program B returns control to Program A and restores the selection of the textbox.
If there is a complete C# solution, then great, but this sounds like it might require a little more effort than usual.
Any thoughts?
Personally, doing this could very likely result in the user selecting undesired values in the popup window. For example, someone is typing away in Word. Your application pops up a window, where hitting "Enter" selects a value ... such as the default button. Without wanting to, the user "selected" an incorrect value on your form.
Windows itself tends to do this, and it's very annoying. Quickly double-clicking a desktop shortcut to open an application and then switching back to (for example) an e-mail before the app launches, will tend to remove focus from the focused e-mail window and put focus in the just-opened application, causing your e-mail text or keyboard strokes to go to the just-opened window.
In my experience windows programs work just this way. It often appears that they don't because the user is returning focus with a mouse-click, which itself resets the focus. If it's a winforms app you can probably do something with the lost focus/got focus events at the form level.
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