URL Hyperlink in Message Box

I have an application that checks a website to see if an upgrade is available for download.

When an update is available, a Message Box (MsgBox) is displayed telling the user that an upgrade is available and that they should download and upgrade soon.

Is it possible to display the download URL as a hyperlink so they can click on it and launch their Browser.

Thanks in advance.

Ron Bower

Not in a msgbox, but you could create your own. It’s not uncommon to see that as part of an action button on a dialog using the MessageDialog class:

[code]Function Alert(Type as AlertTypes, Title as string, msg as string, btn1txt as string, btn2txt as string, btn3txt as string, w as window = nil) As integer
Dim d as New MessageDialog //declare the MessageDialog object
Dim b as MessageDialogButton //for handling the result

select case Type
case AlertTypes.kCaution
d.icon=MessageDialog.GraphicCaution //display warning icon
case AlertTypes.kNote
d.icon = MessageDialog.GraphicNote
case AlertTypes.kStop
d.icon = MessageDialog.GraphicStop
case AlertTypes.kPlain
d.icon = MessageDialog.GraphicNone
case AlertTypes.kQuestion
d.icon = MessageDialog.GraphicQuestion
end

d.ActionButton.Caption= btn1txt

if btn2txt <> “” then
d.CancelButton.Visible= True //show the Cancel button
d.CancelButton.Caption = btn2txt
else
d.CancelButton.Visible = false
end

if btn3txt <> “” then
d.AlternateActionButton.Visible= True //show the “Don’t Save” button
d.AlternateActionButton.Caption = btn3txt
else
d.AlternateActionButton.Visible = false
end

d.Message = Title
d.Explanation = msg
if w = nil or TargetWin32 then
b=d.ShowModal //display the dialog
else
b = d.ShowModalWithin( w.trueWindow )
end

Select Case b //determine which button was pressed.
Case d.ActionButton
return 1
Case d.AlternateActionButton
return 3
Case d.CancelButton
return 2
End select
End Function
[/code]

Usage would then be something like this:

[code]dim iResp as integer
iResp = Alert(AlertType.Question, “Upgrade Available”, “This is a message”, “Continue”, “Don’t Remind Me Again”, “Go to Website”, self)

Select case iRes
case 0 //Continue
//Ignore
case 1 //Don’t Remind me again
//Do something.
case 2 //Go to Website
showers “www.example.com
end
[/code]

Thank you for the quick reply. I’ll have to spend some time studying and understanding it all.

You have been very helpful and it is appreciated very much.

Ron Bower

Bob -

One quick question, please…

Reference the lines:
case 2 //Go to Website
showers “www.example.com

I do not understand the showers line - what is that ?

Ron Bower

Auto correct sucks. that should ShowURL

I hear that Xojo 2015r4 will feature a new showers function.

Sh…don’t want to violate my NDA.

Ron,

Here is a quick example of how I have done it. It is a much less elegant way to accomplish your goal, but hopefully it will help with ideas.

https://www.dropbox.com/s/5b14oi6wxqs94nz/URL_LinkTest.zip?dl=0

HTH,
Mike