domb Posted September 16, 2002 Posted September 16, 2002 Hello ! I have links to pictures from a main page. I would like to open theses picture beside my main page. Until now I wasn't able to find a way to do this. I stored my pictures on layouts and when I click on the button (go to layout xx) the layout replaces the main page. I would like to open the picture layout in an other window. Does someone know how to open a layout in a different page ? Maybe with a script ? Thanks for helping. Polopo
Rigsby Posted September 17, 2002 Posted September 17, 2002 This can be done, but you need to re-think the structure of your database. What you need to do is store all your images in another file using a relationship between the two files, then when a user clicks on a link or a thumbnail in the main file, the second file can be brought to the front using go to related record steps. You can then use the window commands in script maker to resize both windows to suit your needs.
CobaltSky Posted September 17, 2002 Posted September 17, 2002 It is not necessary to store all the images in another file to achieve the dual window functionality you are looking for. Instead you can create an 'image viewer' file which has a single record, with one global field and a calculating constant field (with the formula set as 1). The global field should be defined as the primary key field in a relationship to your main file. The calculating constant field should be used as the target (foreign) key in a relationship from a corresponding (calculating constant) field in the main file. Then, on a layout in your 'image viewer' file, you should place the container field from the main file (sized appropriately), and sourced via the relationship to the main file (the one based on the global field in the image viewer file). A script in your main file would then use the calculating constant relationship to the image viewer file to perform a Set field step to write the unique key of the current record into the global field in the image viewer file. The subsequent script step should then invoke an external script in the image viewer file which brings it to the front and sizes it appropriately. Add a few buttons to the image viewer file layout for 'Zoom In', 'Zoom Out' and 'Close' and you're in business. Now the image viewer file is empty and dormant, serving only as a vehicle for displaying images from the current record in your main file.
domb Posted September 17, 2002 Author Posted September 17, 2002 Thank you for your answer. I tried this with complete success ! I still have questions (see bottom...after GOOOD !) ------------------------------------------------------------------------ Here is what I have done: In my master file I have a layout called "diagnosis". For each diagnosis I have the possibility to write text and to add pictures. I have done a column on the right with 20 places to put thumbnails linking to the pictures. Each thumbnail was directed to one layout (picture 1, picture 2 etc...), containing a container and, on the side, the thumbnails (for navigation purposes). So I exported theses 20 layouts and the field "diagnosis" to a new file called image. I then imported the already entered diagnosis/pictures to my new file (matching diagnosis --> diagnosis; thumbnail x --> thumbnail x; picture x ---> picture x) Everything was there. For each diagnosis I had my 20 pictures and 20 thumbnails. Then I erased my layouts picture 1, picture 2... from my master file. Next step was to define the relationships between these two. First I tried to defined a relationship from pictures 1 ---> pictures 1 but it didn't work. So I defined a relationship called diag from diagnosis --> diagnosis. Then I went back to my master file and specified all the thumbnails buttons to use the script "go to related record" with my relationship diag. GOOD ! This worked very well. ---------------------------------------------------------------- Here is what I would like to do: - When I add a new diagnosis in the master file, I wish that I only have to click on button so that it opens directly an empty field in the image file. Actually it is not doing anything at all. (button set to go to related records). Probably I should add something like this in the go to related record script: "if (diagnosis not present in the image file) then create a new diagnosis in the image file with thename of the diagnosis in the master file" I have no clue how to write this !! Can somebody help me ? - When I am entering a new picture and a new thumbnail in the image file, I wish that it automatically adds the same thumbnail in my master file. If you know how, could you please give me detailed instructions ? Thank you very much in advance for your time. Polopo
domb Posted September 18, 2002 Author Posted September 18, 2002 Thanks very much for your answers both of you. I will prefer your idea Cobaltsky. But as I am a newbie could you please be more specific. >you can create an 'image viewer' file which has a single record, with one >global field and a calculating constant field (with the formula set as 1). I don't understand what is calculating constant field with the formula set as 1. >The global field should be defined as the primary key field in a >relationship to your main file. ok. >The calculating constant field should be used as the target (foreign) key >in a relationship from a corresponding (calculating constant) field in the >main file. ::?????? :-o >Then, on a layout in your 'image viewer' file, you should place the >container field from the main file (sized appropriately), and sourced via >the relationship to the main file (the one based on the global field in the >image viewer file). I might have understood that one. >A script in your main file would then use the calculating constant >relationship to the image viewer file to perform a Set field step to write >the unique key of the current record into the global field in the image >viewer file. The subsequent script step should then invoke an external >script in the image viewer file which brings it to the front and sizes it >appropriately. I have no clue how to write this script. Thank you very much in advance for your patience. Polopo
CobaltSky Posted September 19, 2002 Posted September 19, 2002 Hello Polopo, Sorry I didn't explain some things well enough in my previous message! By "Calculating Constant field with the formula set to 1" I simply meant a calculating field of result type number with the formula set as the numral "1" on its own - so that it will always return the number 1 (which means that the relationship based on such a field in both files will join all records in one file to all records in the other). This kind of field is often called a 'constant' field, and the kind of relationship between two such fields is sometimes referred to as a 'global' or 'universal' relationship. So, when I said: "The calculating constant field should be used as the target (foreign) key in a relationship from a corresponding (calculating constant) field in the main file." I simply meant make a field with its formula set to "1" in each file and join them via a relationship. Lets suppose you call the relationship 'ImageViewerGlobal', and you create the global field I referred to in your Image Viewer file and call it 'gCurrentImage'. Lets suppose also that you have a serial number (or recordID) field in your main file which is called 'MainFileSerial' (it doesn't matter what it is called, just that it is unique to each record). Your script in the main file then run as follows: Set Field ["ImageViewerGlobal::gCurrentImage", "MailFileSerial"] Perform Script [sub-scripts, External: "ImageViewer.fp5"] The last step of the above script is calling a script in the Image Viewer file. This second script in the image viewer file should look something like: Go to Layout ["PictureFrame"] ToggleWindow [Zoom] Refresh Window [bring to front] You'd do best to create the script in the Image Viewer file first (so that it's already there ready to be selected when you are creating the script in the main file which refers to it). To create scripts of this type, simply go into the ScriptMaker dialog (from the 'Scripts' menu) and scroll up and down the list at the left to locate each of the commands you need (as listed in my notes above). When you locate a command you need, double click on it and it will be added to the script window at the left. Once it is there you can select it and use the buttons and checkboxes that appear along the bottom of the ScriptMaker window to set the parameters (the parameters are the parts that appear in square brackets after the name of each script command). So for example, you'll find the 'Set Field' command about a third of the way down the list at the left of the ScriptMaker dialog, under the heading 'Fields'. It has two parameters, signified by two buttons which appear below the main script window (in the ScriptMaker dialog) when the Set Field command is selected - Specify Field, and Specify. The first ('Specify Field') is where you need to indicate which field you want to set with the 'Set Field' command. When you click on the 'Specify Field' paramenter button for the 'Set Field' command, you'll be presented with a list of all the fields in the current file. To locate the field you want (which is in the Image Viewer file), you will need to first select the 'ImageViewerGlobal' relationship fromt the drop-down menu at the top of the 'Specify Field' dialog. The list you get when you do that should include the 'gCurrentImage' field and you will be able to select it. When you click the 'Specify' parameter button, you will be presented with a calculation dialog where you can enter the name of the unique serial or recordID field in your main file (the one I have called "MailFileSerial" in my example above). When the 'Set field' script step is configured in this way, it will place a copy of the contents of the 'MailFileSerial' field on the current record in your main file into the gCurrentImage' field in the image viewer file, using the 'ImageViewerGlobal' relationship to gain access to the other file. By using a similar technique to what I've just described for the Set Field step, you should be able to set up the parameters for each of the script steps I have listed above. Then, provided you've got your relationship set up in the Image Viewer file to link 'gCurrentImage' to the 'MailFileSerial' field in your main file, when you run the first script, some 'magic' should happen.
Recommended Posts
This topic is 8105 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now