Triggers for different object types (was Case Info("Trigger") = "Button.XXXXX" worked in Pan 6 but not in Pan X)

Merry Christmas!

In Pan 6 I aggregated a bunch of small procedures into one procedure with the Case Info(“Trigger”) = “Button.Go To URL”.

Worked great. See Example code below.
;

;---------This Opens the URL in the Web Browser

Case Info(“Trigger”) = “Button.Go To URL”

ShellOpenDocument URL

:END OF EXAMPLE CODE ABOVE

It does not work in Pan X whether I do it with a Button or assigning the procedure to the Text Description of the field. In this example the Field is a URL Address.

Any comments?

That procedure has a bunch of Case Info(“Trigger”= “Button.XXXXX” literally to the Max that Pan X could take.

This Transition to Pan X has been challenging. Perhaps because I use Panorama so much and have for so long. Since OverVUE.

Thanks and Happy Holidays.

George

On a simple test database with 3 buttons, a series of CASE info(“trigger”)=“Button.{button name}” worked fine, so there is not a fundamental problem with that approach. Since you evidently aren’t getting an error message, I wonder if there’s an exact text match with {button name} or if the procedure is being called as intended.

When something like this is not working, break it down so that you can figure out where it is failing. Prior to the more ‘complex’ ‘ShellOpenDocument’, put a simple ‘Message “Here”’ so that you can see if the procedure is getting to the right place. Then you can see if it should then be doing the ShellOpenDocument part. Figure out where it getting to and where it is stopping by putting in the most simple things that you know do work.

Maybe you mean the “max that Panorama 6 could take?” Panorama 6 definitely had a limit on the number of case statements allowed, Panorama X does not have any limit.

This is excellent advice. And for this code, I would say the first thing to do is make sure that info(“trigger”) contains what you think it does. Try putting

message info("trigger")

at the top of the procedure to verify what is in the trigger value.

Or better yet, learn how to use the new Debug Instrumentation feature, which is much better than using message statements.

Thanks for the advice and I now know why I was having the problem.

I am trying to use this one procedure to aggregate tiny procedures I have.

When I run the procedure by a button the procedure runs fine. When I run it by assigning the procedure to a Text Label it does not run because it does not know what the Case Info(“Trigger”) is because I am not using a classic button.

Is there some variable that I can assign a value equal to the Name of the Case Info(“Trigger”)=“Button.Go To URL”.

When I run the Procedure the
message info(“trigger”)
give a message “TextDisplay.LABEL”

When I run it from a Button I get:

Button.Go To URL

So can I use this procedure when assigning the procedure to a Label? Or is it not possible?

Procedure Below

;CALLED Call “.ButtonMacro45”

message info(“trigger”)

;

Message “Hello Pal - Merry Christmas”

;---------This Opens the URL in the Web Browser

;

Case Info(“Trigger”) = “Button.Go To URL”

;

ShellOpenDocument URL

EndCase

Procedure ends above

Thanks for all your assistance.

You can set the info(“trigger”) value yourself for the Text Label Object using the settrigger statement in the Procedure pane of the Properties panel. I tried the set up below and it returned “Button.Go To URL” in the message just as you require.

image

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: