Field statement doesn't work?

I’m test-driving Pan X and have such a simple problem I’m almost afraid to ask. In Pan 6, I create a new database with 2 fields, A and B. I make a form with data cells for these fields, and add a button that calls a procedure with one statement:

field A

As expected, when B is the active field and this button is pressed, A becomes the active field.

When I make the exact same thing in Pan X, the button has no effect. This is true whether the procedure code is in the button itself, or the button calls a separate procedure.

I’m trying to convert some simple Pan 6 databases, e.g., a phone log, and can’t seem to specify an active field programmatically. What am I missing?

When I read your post I thought “no way” since I seem to use the field statement all the time. But when I create a demo database like you describe I am seeing the behavior you describe. Example here:

I put 2 data cells (text editors with popup editing) on the form, along with the two buttons. The active field changes, just as it’s supposed to. The data sheet fields don’t change when the form is active, but they don’t in Pan 6 either.

If the text editor objects aren’t set for popup editing, they behave like text editor superobjects in Pan 6. A field command will make the field active for your procedure, but it doesn’t make the object active. For that you need to use a superobject statement in Pan 6 or Pan X, or an objectaction statement in Pan X.

I’ve modified Bill’s example. Download it from here.

In both Panorama 6 and X, the field statement only affects the current window. In a form window, this is only visible if you have data cells on the form, or in Panorama X, Text Editor objects that use the pop-up editing option.

I downloaded your database, and your form had NO editing objects of any kind. When I added Text Editor objects with the pop-up editing option enabled, the buttons using the field statement worked fine. Here is your revised form after pressing the Select B button, which contains the statement field B.

Here is what this looks like in graphics mode:

Aha – I see that Dave has uploaded the same answer as I was typing!! It’s pretty cool that the forum software updates the thread as I am editing :slight_smile: I’ll post my answer anyway.

Please, don’t ever be afraid to ask, everyone needs a bit of an assist from time to time. That said, I’m not sure how to assist you. Perhaps “pop-up editing” is the hint you needed? Otherwise, you’ll need to give us additional details about what you are doing.

Ah!! Like Aiki, once the issue was raised, I expected to see the field switch in the data sheet, but the form specific nature of the field statement explains why I’ve been able to use it over the years without problems! Thanks (both of you!) for clarifying!!

Ah, thanks. I wasn’t using pop-up editing, and now my little Pan X example file works.

In answer to your question, my Pan 6 phone log has a view-as-list form with calls (records) displayed chronologically, and several buttons in the header. One button is for adding to the conversation in the active record: it appends a date/timestamp to a field «Followup», goes to a data-entry form, and activates that cell, putting the cursor at the end, for me to type some follow-up notes. In Pan 6 the procedure ended with EditCell, no longer implemented in forms in Pan X.

By turning on pop-up editing, the Text Editor Object in the data-entry form is active. I’m still not getting it to open for editing though (unless I double-click, and then the whole contents is highlighted… not what I want). I named that Text Editor Object “ReplyBox”. When the procedure ends with

objectaction “ReplyBox”, “Insert Text”, “”

I get this error:
The form object targeted by the ObjectAction statement does not support this action: INSERT TEXT.

And with that, I’m again stumped. Is there a list somewhere of which commands work with which objects?

I think you need to turn the pop-up editing option back off again, and then use this code:

objectaction "ReplyBox","Open"
objectaction "ReplyBox","SetSelection",-1,-1

In Panorama 6 this would have been written this way, which will still work:

superobject "ReplyBox","Open"
superobject "ReplyBox","SetSelection",30000,30000

The various commands that each object understands are not yet documented in the Panorama X help, but they are the same as what they were in Panorama 6, so for now you can use the Panorama 6 documentation on this topic. However, the Text Editor will only work with these commands if the pop-up editing object is turned off (just as in Panorama 6, these commands would not work with the Data Cell object).

Note: Another way to write this code is:

objectaction "ReplyBox","Open"
activeobjectaction "SetSelection",-1,-1

Once an object is open, you can send more commands to it without having to repeat the object name each time.

The command is “InsertText”, with no space. However, I don’t think you actually want to use that command, especially since you actually weren’t inserting anything, so the command wouldn’t have done anything even if it was spelled correctly.

FYI, you can control what is selected when you double click by using the Initial Selection option.

The Field statement will of course work in the data sheet – but using it in a form only affects that form, not the data sheet. Conversely, using it in the data sheet doesn’t affect any open form windows. The current field can be different in each open window (the current record, on the other hand, is shared by all windows that are open for a particular database).

A post was split to a new topic: GoForm doesn’t work with view as list forms