User defined buttons |
Top Previous Next |
User defined buttons are resources that cause buttons with custom URL links to appear in the project, study or report toolbar. (below the report)
There are three different user defined button resources. They are identified by being a "Utility - Text lines" resource with specific names. •UserProjectButtons - the buttons specified in this resource will be show on project, study and report pages. They are the most general and can only access project information. They will not have knowledge of the current study or report. •UserStudyButtons - the buttons specified in this resource will be show on study and report pages. They are the most common as they can access study information as well as project information. They will not have knowledge of the current report. •UserReportButtons - the buttons specified in this resource will be show only on report pages. They can access report information as well as project and study information.
All three of these resources share the same format. The only difference is where they are displayed. The format is delimited. For technical reasons, the values are delimited with semi-colon characters ( ; ). If a value contains a semi-colon, it must be quoted with pipe characters ( | ).
The values on each line must be the following and must be in this order: 1.URL - this is the desired URL including any parameters. 2.Hint - shown in a "tool tip" when mouse-over occurs 3.Target - can be used to open a new tab/window or use an existing one 4.Image - a 24x24 pixel image to be used for the button
Each value will be parsed by Crash Magic before use. So any static text (literals) must be enclosed in quotes.
Here is a simple example that creates a button that opens the Pd' Programming web site when it is clicked: "https://www.pdmagic.com";"Open the Pd' Programming web site";"PdSite";"https://www.governmenttools.com/cmimages/CrashMagic.png"
However, in most cases the purpose will be to link to locations that address a dynamic path or take parameters, probably related to the current project, study or report. "http://www.pdmagic.com/" + URLPathEncode( Project.Name.ASCII("","")) + "/" + URLPathEncode( Study.Name.ASCII("",""));"Open Study for editing";"aWindowName";"Editor"; or "http://www.pdmagic.com/SendDataHere/?Project=" + URLParamEncode( Project.Name.ASCII("","")) + "&Study=" + URLParamEncode( Study.Name.ASCII("","")); "Open Study for editing";"PdSite";"Editor"
Some notes: •The expressions can utilize any of the filter functions available in the program. •When using a variable, such at the current project name or study name or such, be sure to wrap it in URLPathEncode() to make sure a legal URL is created. •When using a parameter, use URLParamEncode(). •The image value may point to any image available by URL. It will be scaled to 24x24 pixels. Crash Magic has a plethora of icons to choose from if there is not a suitable custom image available. An index of the image is being prepared. |