Do you know the code to make a program press the F1 key without touching the keyboard? In other words when I click a button I want the computer to respond as if I had pressed the F1 key.
What functionality are you looking to duplicate Kyle?
The way that if you highlight text and hit F1 it brings up the help dialog with a list of search results on that text?
Just wondering if it would be easier to figure out what calls F1 makes and just call them, instead of trying to just click on F1 (cause I'm sure that the help shortcut needs to be mapped somehow to the help files for the app.).
I'm totally just thinking out loud here, so correct me if I'm off on anything.
I'm working with the Microsoft HTML Help Workshop adding Help to a desktop application. It's actually pretty simple but finding information to make it work smoolthly has been a challenge. I successfully got the help screens completed and tied into the application such that pressing F1 runs the Help screen and takes you directly to a help page based on the keyword assigned to the form. I was then looking to put a button on the toolbar that would respond in the same way as pressing the F1 key. I did finally stumble on that. Using Help.ShowHelp will launch Help and access a particular help page so I have added the button and the problem is solved. At the point I didn't have that solution I dreamed up the "simulate pressing F1 key" solution as a backup. You were right to go directly to the method that lauched the application but I wasn't finding it easy to find that piece of the puzzle. The answer to the simulate a keypress is SendKeys.Send({F1}); Of course as usual my syntax is C# but I do think it's cool that the methods available in C# are also availble in VB.NET so we can easily share concepts without the translation between the two languages being much of a hurdle. Thanks for your input. It's always a pleasure to hear from you.
Glad you figured it out. I really do wish we were using C#. It seems to be the languge of choice in the .NET community. Time constraints/learning curve are keeping us with VB.NET for now, but hopefully that will change in the future.
How much longer do they have you doing the desktop stuff? Are you going to be seeing any asp action soon?
I have a projected go live date of April 1st for this desktop application. After that I have some ASP.NET projects. This is so much fun!
By the way, are you familiar with delegates? I'm working on gaining access to MdiChild menu items. After setting the MdiList property to true for a main menu selection and opening several MdiChild forms, a menu list of child forms with the active form checked is displayed from the main menu selection. I'm trying to discover how can I detect (capture) when one of the MdiChild menu selections is clicked or selected? They don't exist until the MdiChild form is opened. On another forum a guy responded to my questions with:
You should have your MdiParent pass a delegate for the Click event of the MenuItem class in the constructor of the MdiChild class. This way, when the MenuItem is constructed, you can have the parent be notified when the child's menu item is clicked.
So I'm trying to figure out exactly what that means. Any thoughts?
hmmm...I've never used delegates before, but I found a bit on it, and here's my take on what he's saying:
VS.NET help says that a Delegate is a data structure that refers to a static method or to a class instance, and a method of that class.
I think he's trying to say: send a pointer to your MenuItem code in the code that creates a child. This in some way will let your parent know if the child's been clicked, although I'm not really sure how.
What are you wanting to do when you capture a menu selection?
I have a Multi Document Interface form that contains a main menu and a toolbar. When a child window is opened inside the MdiForm I have a main menu selection "Window" that has the MdiList property set to true so a dynamic list of open MdiChild forms will be selectable from the Window menu so I can select and switch between multiple opened child forms. This works well for selecting which of the opened child forms you want to view but when I select an input form I only want certain toolbar buttons to appear. When I switch to a Print Preview form I want different toolbar buttons to appear. I wanted to capture the click event for the proper form when selecting from this MdiList menu so I would know which toolbar buttons to turn on and off. I just abandoned the MdiList approach and decided to programmatically add and delete the child menu selections from the "Window" menu and then I have easy access to their click events so I can control my toolbar button selections. Maybe someday I'll better understand delegates ... thanks for your input.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.