Trouble with Ampersand Character

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Trouble with Ampersand Character

Re: Trouble with Ampersand Character

by wxdude » Tue Dec 18, 2012 6:15 pm

Now it's starting to make sense to me.....thanks again Lowlander.

Re: Trouble with Ampersand Character

by Lowlander » Mon Dec 17, 2012 3:43 pm

In the button a single & is used to indicate the shortcut key to access the button. ie. If you have a button text like Click H&ere the e is used as shortcut key (Alt+E or if that's wrong Ctrl+E).

Re: Trouble with Ampersand Character

by wxdude » Sun Dec 16, 2012 1:37 am

Thanks for that Lowlander.

I knew it had to be easy and I tried every other escape sequence I knew of....guess I'm just unsure why it has to be escaped in button text, but not the form text.

Re: Trouble with Ampersand Character

by Lowlander » Sat Dec 15, 2012 10:30 pm

Trouble with Ampersand Character

by wxdude » Sat Dec 15, 2012 5:54 pm

Does any one know if the Ampersand character (&) needs to be escaped when used in some circumstances?

For example with the code below, the form caption displays the & character correctly, yet the button caption does not. Seems that the & and a space is replaced with an underscore.

Image

The answer is probably simple but I cannot for the life of me figure out how to get the ampersand to display properly on the button...can anyone provide some guidance?

Thanks.

Code: Select all

Option Explicit

Dim Form, Btn
Sub OnStartup
	Script.RegisterEvent SDB, "OnPlay", "OnPlaybackStart"
End Sub

Sub OnPlaybackStart

	Set Form = SDB.UI.NewForm
	Form.Common.SetRect 100, 100, 500, 400
	Form.Caption = "Title with an & ampersand"
	 
	Set Btn = SDB.UI.NewButton(Form)
	Btn.Caption = "Close & exit"
	Btn.Common.SetRect 10, 10, 100, 20
	 
	Form.ShowModal

End Sub

Top