Click to See Complete Forum and Search --> : How to create a popup menu?
CardTracker
October 29th, 2008, 08:10 PM
I'm using C# and .NET 2005/2.0
I'm creating a collection database running in a Windows Forum, and I want to enable advanced search options without taking up extra space.
What I want is something like Word's advanced options.
For example, start word and Ctrl + D
That's what I want to have happen when the user clicks "Advanced Search."
Part of the problem is that I'm not even sure what to call this.
Any help on naming, finding a tutorial, and capturing the information would be greatly appreciated.
Arjay
October 29th, 2008, 08:22 PM
What version of Word are you running? On my 2007 Word edition, CTRL+D displays the font dialog.
Do you want to display a dialog or a context menu?
CardTracker
October 29th, 2008, 08:29 PM
The font setting is what mine brings up too.
I don't want a context menu, I've got that already.
I want something to pop up with more options, like the font controls do for Word.
I also don't want a speciffic dialogue box (not an open or save-as box).
Nope, I don't think that's it either.
Any detail on that would be helpful, but in the meantime I'll keep messing with things. :D
nabeelisnabeel
October 30th, 2008, 12:28 AM
If you are making some windows forms application, you just have to make a form object with its border styles adjusted to dialog boxes and call form's ShowDialog() method.
Arjay
October 30th, 2008, 12:39 AM
I want something to pop up with more options, like the font controls do for Word.
I also don't want a speciffic dialogue box (not an open or save-as box).
Nope, I don't think that's it either.Can you explain what you want to see?
CardTracker
October 30th, 2008, 08:47 AM
Well, I figured something out.
What I've done for now is create a new form and have the button create and call that.
I didn't know how to do that before, so that will probably solve several problems.
It looks about how I wanted now, but if there is a better way to do this, let me know. If not, I'll just mark this as resolved and move on. :)
http://i294.photobucket.com/albums/mm110/DragonsWrath_MTG/Card%20Tracker/screenshot.jpg
I'd like to remove the minimize option however.
What I'd
yraen
October 30th, 2008, 10:54 AM
this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
Place that in the code for your AdvancedSearchOptionsForm... or you can set it in the Designer view :)
CardTracker
October 30th, 2008, 12:25 PM
Ah, that border style change looks much better.
I also figured out how to hide the minimize/maximize button, lock the size, and force the popup to stay on screen (so you can't click out of it)
The only concern I have now is how to retrieve the information.
Right now, I changed the constructor class to include a list of parameters, sent by the form that called it. The constructor then changed the settings on each of the controls to match the values sent.
On the Advanced Options form, the click event for 'OK' changes a bool value named shareResults to true, and closes the window. The 'Cancel' button simply closes the window.
Back in my primary form, after the "advancedOptions.ShowDialogue()" line I have this:
if (advancedOptions.shareResults)
{
distinguishArtifactCreaturesAs = advancedOptions.distinguishArtifactCreaturesAs;
distinguishLegendaryStatus = advancedOptions.distinguishLegendaryStatus;
distinguishSnowStatus = advancedOptions.distinguishSnowStatus;
distinguishTribalStatus = advancedOptions.distinguishTribalStatus;
distinguishWorldStatus = advancedOptions.distinguishWorldStatus;
distinguishAuraStatus = advancedOptions.distinguishAuraStatus;
//Advanced COLOR search options
distinguishNumberOfColors = advancedOptions.distinguishNumberOfColors;
distinguishEveryColor = advancedOptions.distinguishEveryColor;
}
Is this an acceptable way to get the information from the new form? I tried sending the original values by ref, but that didn't work for some reason...
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.