Jump to content

Mouse-clicked button field passing the click through


This topic is 5797 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

> 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

Link to comment
Share on other sites

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 by Guest
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This topic is 5797 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.