November 19, 200619 yr With the cursor in a field, or the field otherwise in focus, using "Get ( ActiveFieldContents )" works as expected. When I make the field into a button, the field is no longer active after the click-event has finished, hence its contents are not returned. I want to be able to use a script using "Get ( ActiveFieldContents )" generically (i.e., not tied to any specific field). In HyperCard, which used a hierarchy for layers and objects, a mouse-click event could be passed (or not, depending on scripting) to the next layer/object after the layer/object higher in the hierarchy received the message/event, and so on. I mention this because the FM field-as-a-button seems to intercept the click and not pass it on to the field. Ken
November 19, 200619 yr With 8.5, there may be other ways using Go To Object. But one way to maintain focus is to allow the cursor to leave the field and then return - let tab order do it for you. Example: Field 1 is the field you want to copy (first in tab order). Field 2 is another field (second in tab order). Script attached to field 1 with: Go To Previous Field Go To Next Field Set Field [ whatever ; Get ( ActiveFieldContents ) ] You can also use script parameter here. LaRetta
November 19, 200619 yr On second thought, I wouldn't use this method. If you change field order, it can break. I wouldn't want to base MY solution on it so I can't recommend it to anyone else either. I used it once when it was the only field on a layout (with only the Go To Previous step) but if there are other fields which were active first, it will set out of sequence on you. Not good.
November 19, 200619 yr Author > With 8.5, there may be other ways using Go To Object. I just tried that, where the Object name is "Get ( ActiveFieldName )", but the problem seems revolve around the fact that the field clicked never becomes active. I just tried the tab order possibility, and it once again appears that the clicked field never becomes active. But thanks for the possiblities! Ken
November 19, 200619 yr You can start your script with Go To Field [ that field ]. But I assumed you wanted dynamic. Tab order method works but only (reliably) if it is the only field.
November 19, 200619 yr How about the user initiating the script via the script CTRL-#'s? That leaves the field as the focus; of course button would work as well then.
November 19, 200619 yr How about defining a script parameter for each button = the field the button is attached to?
November 19, 200619 yr I'm not following, Michael. When you click the field (with button attached to field), the script activates before entering the field. I considered script parameter with Get ( ActiveFieldContents ) and script of: Set Field [ globalText ; Get ( ScriptParameter ) ] ... globalText just being a holding area for the test ... but it wouldn't pick it up. If we preceed with Go To Field [ theField ] then we lose the dynamic ability of it. What am I missing in your suggestion, please? Edited November 19, 200619 yr by Guest
November 19, 200619 yr Each field needs to be defined as a button, individually. At that time, tell the button which field it is attached to, i.e. make the script parameter = SomeField Get (ActiveFieldContents) cannot work here, since - as Ken correctly surmised - the field we are interested in will not be activated by clicking the button.
November 19, 200619 yr Author Comment's last reply works, though as he points out, the work must be done for every field in which you desire this to work. I posed my original question in a generalized way, because the specific thing I was trying to achieve is very simple to do by direct hard coding, but I was looking for a more transportable method that I would use in other situations. What I'm doing is opening the URL in a field, and of course all I need to do is to attach 'Open URL' with the field name as the data source. Using Perform Script, with a script parameter of the field name, and 'Open URL [Get (Script Parameter)]' works. Thanks to both of you for the useful discussion. I'm confident now that there is no trick to getting the mouse click to pass through to the field when it is a button. Having that as an option would be a useful feature. Ken
Create an account or sign in to comment