A funny thing happened on the way to the Label...

Xojo 2017 r2.1 on Mac OS 10.13.1

  1. Start a new Desktop project
  2. Add a Label Control into Window1 (set it to be multi-line and stretch it big enough to handle multiple lines)
  3. in the Open Event Handler for Window1:

[code]Dim url as String = “https://someURL.com/api/public/someDirectory?key=85294f-4fe59b-baa05b-4766c1-0f24ef

url = url + “&” + “geography” + “%5b”+ “latitude” +"%5d="

label1.Text = url

msgbox(url)
[/code]

  • The message box displays the ampersand before the word geography correctly
  • With a breakpoint set at msgbox(url), the variable url in the debugger shows the ampersand correctly
  • The Label Control (label1) drops the ampersand

Is this a bug? or a feature?? or am I doing something wrong???

Try escaping the ampersand:

url = url + "&&" + "geography" + "%5b"+ "latitude" +"%5d="

Windows accelerator keys use the & so in certain controls they have to be doubled up

See the notes on http://documentation.xojo.com/index.php/Label
You can define an accelerator character for a Label. In the Text property, precede the accelerator character with an ampersand. For example, the entry “&Home” signifies that the H is the accelerator. Pressing Alt+H on Windows triggers the AcceleratorKey event.