Replacement for editselect statement in PanX

Is there a replacement for editselect in Panorama X? I use editselect in Pan6 to insert the cursor in a field cell in an specific location after a button is clicked.

Does anyone has a simple workaround?

Anyone? Comments on this? Is this a limitation on how Apple handles cell editing?

I think you are out of luck with this one. The entire text is selected when the cell is opened and there is no programmatically valid way to override this action. Probably set in stone by Apple (I see that the editselect statement is not listed to be implemented in the future). I found no way to simulate this missing feature but maybe someone else can.

Thank you Gary, I’ll keep looking for options.

Our business heavily relies on Notes entering by clicking a button that automatically adds a new line at the top with a timestamp and user initials, then the cursor is positioned automatically after this to start typing. It is a great time saver.

I’m surprised that no one else has a need for this feature, as I didn’t find any mention of it in the forum.

There are always many ways to skin the cat. What you untilmately need is obtainable. Allow the user to enter their comments into a variable, then when they click the button, preprend your timestamp and user initials to the variable, then prepend that to the existing notes.

My attempt fails and I can’t figure out why. I have a field “Comments” but the procedure does not update with the new comment. Why does this fail?

debug
let lTemp="" 
let lTN=superdatepattern(supernow(),"MM/DD/YY @ ","hh:mm:ss am/pm") 
supergettext lTemp,{height=444 width=888}
message lTemp   //this works
CASE lTemp=""
stop

ENDCASE 

field Comment

cell lTN+" — "+lTemp+¶+Comment

The field is Comment (not Comments)

It fails for me as well, if the cell is already open for editing. If no cell is open, it works.

closeactiveobject is a very useful command at the start of many procedures. Possibly here too.

Thank you Robert. This is my current solution. I was hoping that someone had the cursor insertion worked out already! Thanks for your insight.

If you can incorporate a Text Editor Object to do the editing of the Comment field you can force the cursor to the position you want for editing. I created a Text Editor Object and named it MyEditor and set it to use the Comment field. Using this example code I am able to activate the Text Editor, insert the timestamp and user initials and then set the cursor position for further editing.

let lvText=
superdatepattern(supernow(),"MM/DD/YY @ ","hh:mm:ss am/pm")+" GY"+¶+¶+¶
objectaction "MyEditor","Open"
Comment=lvText+Comment
activeobjectaction "SetSelection",length(lvText)-2,length(lvText)-2

Here is what my test looks like:

TE Set Selection

With the rundialog method you could popup a custom editing form with the Text Editor on it for entry. The rest is up to you if you can figure out a reasonable way to incorporate this.

Gary, This is exactly what I was looking for. My Comments field is already a Text Editor Object in a form. activeobjectaction and SetSelection does the trick.

Thank you everyone for your help!

I’m a bit surprised Gary’s code works. I would think that the order of lines 3 and 4 should be reversed, like this:

Comment=lvText+Comment
objectaction "MyEditor","Open"

The activeobjectaction statement is unfortunately not documented yet. However, the Panorama 6 equivalent was documented, which I assume is how Gary knows about it.

I’m glad Gary figured out what you really needed. You had me thrown because the original request was for editselect, which did not work with Text Editor objects, only with data sheet cells.

I use editselect in Pan X with a Text Editor object:

Local cursorpoint
cursorpoint=0
Notes=datepattern(today(),"mm/dd/yy")+", "+timepattern(now(),"HH:MM am/pm")+": "+¶+Notes
cursorpoint=length(datepattern(today(),"mm/dd/yy")+", "+timepattern(now(),"HH:MM am/pm")+": ")
SuperObject "SONotes","open"
ActiveSuperObject "SetSelection", val(cursorpoint),val(cursorpoint)

@Jeffk There is no editselect statement in the code you just posted. EditSelect was a separate statement available in earlier versions of Panorama that worked with the editcell and floatingedit statements, in the data sheet. Your code is not using any of these statements.