Two New Files For The Database Exchange


#1

GARY’S ADDITIONS1 & HOTKEYS ASSISTANT

I have added two more files that are now available on the Panorama Database Exchange. This first file is called Gary’s Additions1 and includes two new statements and three new functions:

Gary’s Additions1

STATEMENTS

GetTextSheet prompt,inputtext

This statement will open a gettext sheet dialog attached to the current window. This is the same as I had suggested some months ago on this form but now issued as a custom statement.

gettextsheet screenshot

OpenHotkeysAssistant

A new statement that opens a modal Hotkeys Assistant window for creating 1 to 5 new hotkeys using the definehotkeys statement. The Hotkeys Assistant is also available as a stand-alone file as listed and shown below. Note that this statement does not need the stand-alone file below to function - everthing is built into it as is.

FUNCTIONS

MonthsOfYear()

Produces a carriage return separated list of all the months of the year. Can save a lot of typing.

Example: message monthsofyear()

January
February
March
April
May
June
July
August
September
October
November
December

DaysOfWeek()

Another carriage return separated list but of all the names of the days of the week.

Example: message daysofweek()

Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday

NumericArray(startnumber,endnumber)

Again, a carriage return separated list of numbers starting with the start number and ending with the end number.

Example: message numericarray(1302,1311)

1302
1303
1304
1305
1306
1307
1308
1309
1310
1311

The second file is the stand-alone version of the Hotkeys Assistant as mentioned above.

Hotkeys Assistant

Gary Yonaites
image


#2

Great stuff Gary - many thanks.


#3

Gary, your alert sheet input procedure is great. Three questions,
(1) what happens if the user presses Stop? How can the user of the custom statement check for a Stop and provide for an appropriate response?
(2) The form that the procedure relies on is located in the library file and does not need to be located in the database calling the procedure, is that right? And that would be generally true for any custom procedure, i.e., that it can call forms located in the custom procedure databases and use them as part of the custom statement?
(3) We do have to define the variable to be used to hold the results before calling the procedure, true?
Tom


#4

If info("trigger") = "Stop" the Stop button was clicked, otherwise it will return “Dialog.Close”.

Yes, the form is in the library file along with the custom statement procedure. The Gary’s Additions1 file that you downloaded is the same file that is copied to your Users/Library folder so you can look at that original
file and see the form itself along with the custom statement procedure.

That variable has to be declared as in local theText but it is not necessary to actually define its value as in theText="Something". I used a catcherror( to simply assign that variable “” if there is an undefined error.


#5

Why do yo use info(“trigger”) instead of info(“dialogtrigger”) to check if the Stop button was pushed? I see it works, but not what I expected.


#6

This is because my scheme uses the rundialog scheme and that returns button clicks with info(“trigger”) and not info(“dialogtrigger”) like the normal gettext statement. Note that the standard gettext does not return any value if the Stop button is pressed and simply stops the procedure that is running it. If you would prefer this same action in the gettextsheet statement change lines 42 thru 44 from:

If info("trigger")="Stop"
    rtn
Endif

to:

If info("trigger")="Stop"
    stop
Endif

To make the change open the Open View dialog from the View menu, click the +Libaries tab and enter Gettextsheet in the search box. Once you see it double click it to open the procedure. Make the changes and save before closing that procedure window. I wrote the procedure the way I did because I personally prefer not to stop the entire procedure at that point but to allow for some alternate action if Stop is detected. The choice is up to you.


#7

Ok, to make things work exactly like the gettext statement scheme you would need to make a few changes so that button clicks are returned with info(“dialogtrigger”) instead of info(“trigger”).

Change this code:

settrigger ""
endif
endloop
If dlgResult≠"Cancel"
    setparameter 2, __theText__ 
Else
    settrigger "Stop"
Endif
undefine __theText__, __thePrompt__
If info("trigger")="Stop"
    rtn
Endif

To:

setdialogtrigger ""
endif
endloop
If dlgResult≠"Cancel"
    setdialogtrigger "Ok"
    setparameter 2, __theText__ 
Else
    setdialogtrigger "Stop"
Endif
undefine __theText__, __thePrompt__
If info("dialogtrigger")="Stop"
    stop
Endif

After these changes the gettextsheet will return the button click in the info"dialogtrigger") function and will stop the running procedure if the Stop button is pressed.


#8

Gary, is there any way to replace the Panorama standard icon with a custom image in an Alert Sheet?


#9

You could manually change the icon in the form the gettextsheet uses. If you use the Open View… wizard from the View menu you can search for “•|•|•” with Libraries selected. This is the rather cryptic title I assigned to the form. Open that form in graphics mode and you can select the existing icon which is an ImageDisplayObject with the formula currently set to “/Applications/PanoramaX.app/Contents/Resources/AppIcon.icns”. Either change this to the path of your icon or remove it and paste in the icon you want to use. Note that there is a rectangle mask object in front of the icon and if you add your own pasted-in icon you should send it to the back so the mask is on top as before.

Obviously this change will affect all uses of the new gettextsheet in all files. There is no option to declare a special icon with each use.


#10

I’m sure very few people (maybe Gary is the only one?) have written formulas that access resources inside the Panorama application, but if you do, the preferred way to do this example is:

bundleresourcepath(“AppIcons.icns”)

By doing it this way, the formula will work no matter where the Panorama application is installed, and is not dependent on Panorama being installed in the /Applications folder.