Your original post made it sound like you had a procedure that worked in Panorama 6 but not in Panorama X. But obviously your original procedure never worked when triggered by a Text object, since Panorama 6 didn’t allow that.
Panorama X gives you MUCH more flexibility in triggering code when clicking on something in a form. In Panorama 6, this could only be done with a button. And you could only link an existing procedure to a button, you couldn’t write custom code associated with the button (or any other type of object). So this usually meant a lot of extra procedures, or case statement, and extra transparent buttons on top of other objects.
None of that is necessary in Panorama X. First of all, any object can trigger code – not just buttons, but also text, shapes, images, anything.
Secondly, any object can not only link to an existing procedure, but the object can actually contain code itself. So you can have custom code for each object. It doesn’t even have to call a “regular” named procedure. Or, as Gary has shown, the custom code can make adjustments for calling a custom procedure.
Since you’ve already set up a procedure with case statements, probably using settrigger as Gary suggested will be the easiest route.
settrigger "Button.Go To URL"
call "my procedure with case statements"
But there are other ways to do it. For example, you could pass a parameter to the procedure, like this:
call "main procedure","Button.Go To URL"
Then in the main procedure, you could check the parameter, like this:
case parameter(1) = "Button.Go To URL"
Or, you could make a bunch of “mini-subroutines” and use the callwithin statement. In your button, you could use this code:
callwithin "main procedure","gotourl"
Then in the main procedure, you would have the gotourl mini-subroutine
...
gotourl:
shellopendocument URL
return
...
You can have as many mini-subroutines as you want. This is faster because Panorama doesn’t have to cascade through all of the different case statements, it just jumps straight to the code you want to run.
Though actually in this case, since it’s only one line of code, you might just what to put that one line of code into the object itself. (Though not necessarily, if you will have multiple objects doing the same thing and it might change later, it would be better to have it in the subroutine, so a change would only have to happen in one place.)
Pretty much everything I’ve talked about is new in Panorama X. If you’re willing to take the time to learn them, Panorama X gives you much improved programming tools over Panorama 6. These topics are covered in detail in this (non-free) 2 hour training video, Control Flow: