The HelpAbout button in the ARG CommandBars example uses a “messagebox” to display the copyright and contact details. I wanted to use a form as the “messagebox” displays the standard windows title. Also I wanted extra functionality, to allow a single click to open the current email program, and also to take the Employee to my web site.
The click event for the button is Part of the “Ribbon” collection and can be accessed two ways. I intend to try and produce a map to show how to navigate the CommandBars Manager or the Visual FoxPro form property dialogue.
For now right click on CommandBars Manager and select Builder… On the dialogue select the “CommandBars (Collection)”. On the next dialogue select “Controls (Collection). The last Menu itme should show the Help Icon. Select this and scroll down the right hand window to find the “OnClick()” method.
I placed the following code in the “On Click() text box.
Do Form frmHelpAbout.scx
The form was now taking shape but “how to get the Hyperlinks for my web site and email.
I used my baseForm and added an Edit box into which I place my main message.
LParameters taItems Local lcMessage As Character lcMessage = "Copyright: Peter Hart Computers © 2008 - 2009" + Chr(13) + Chr(13) lcMessage = lcMessage + Chr(9) + "Peter Hart." + Chr(13) lcMessage = lcMessage + Chr(9) + "My House Name," + Chr(13) lcMessage = lcMessage + Chr(9) + "My Street," + Chr(13) lcMessage = lcMessage + Chr(9) + "My Village," + Chr(13) lcMessage = lcMessage + Chr(9) + "My Town," + Chr(13) lcMessage = lcMessage + Chr(9) + "My County." + Chr(13) lcMessage = lcMessage + Chr(9) + "My Postcode" + Chr(13) + Chr(13) lcMessage = lcMessage + Chr(9) + "Phone: 99999 999999" + Chr(13) lcMessage = lcMessage + Chr(9) + "FAX: 99999 999999" + Chr(13) lcMessage = lcMessage + Chr(9) + "Mobile: 99999 999999" Thisform.edtMessage.Value = lcMessage DoDefault().
I then added two labels with the properties
Lable1.AutoSize = .T. Lable1.BackStyle = 0 && Transparent Lable1.Caption = Email Support Lable1.ForeColor = RGB(0,0,255) && Blue Lable1.FontUnderline = .T.
Then in the “Click” event of the first label I placed.
LParameters taItems Local lcEmailAddress As Character,lcSubject As Character,lcMessageBody As Character Declare Integer ShellExecute ; IN SHELL32.Dll ; INTEGER nWinHandle,; STRING cOperation,; STRING cFileName,; STRING cParameters,; STRING cDirectory,; INTEGER nShowWindow lcEmailAddress = "firstname.lastname@example.org" lcSubject = "Support Message from " + oGlobal.LoggedOn lcMessageBody = "Please Help:" ShellExecute(0, "", "mailto:" + lcEmailAddress + "?Subject=" + lcSubject + "&body=" + lcMessageBody, "", "", 1)
This code was courtesy of Eric den Doop and I found it at:
In the “Click” event of the second label I placed
LParameters taItems LOCAL loHyperlink, lcLink lcLink = "http://www.mywesite.co.uk" && not my real website loHyperlink = CREATEOBJECT("Hyperlink") loHyperlink.navigateto(lcLink) loHyperlink = .Null.
From the Visual Foxpro Help.