Rectangle coordinates

How can I switch the following code so that the cloned form is placed at the top left of the Swap Area?

local swapRectangle
swapRectangle = rectangleinset(objectinfo(“rectangle”,“SwapArea”), 1)

selectobjects unionrectangle(objectinfo(“rectangle”),swapRectangle)=swapRectangle
deleteselectedobjects

cloneform “ShippingSales”,“EditSlipLineItem”,“rectangle”,rectangleoffset(objectinfo(“rectangle”),rtop(swapRectangle),rleft(swapRectangle))
selectnoobjects

Also, how would I change the SwapArea rectangle to a matrix cell or row rectangle?

Rather than digging your code and figuring it all out, could I ask you why you aren’t simply using a Tab Panel for this? Then you could replace all of that code with a couple of lines of code. You can turn off all of the buttons in the Tab Panel if you want, so the appearance would be the same as what you are doing now. (In fact, internally a tab panel works using the same code that cloneform uses, I got the idea for tab panels after implementing cloneform).

That is a great question.

I am creating a way to edit line items that are being displayed in a TextList Object or a Matrix Object. Here is a before and after picture. It is a work in process but currently works well. The delivery slip and the brown header are being displayed in a tab panel object. When a user clicks on the orange Font Awesome icon the edit portion is swapped into the SwapArea rectangle.

One can also use this approach to do things like pop up a search in a form or a small calendar for entering dates in a date field. Here is an example of a search that pops up when the little green search icon is pressed. This is all accomplished with the cloneform code.

When a selection is made or when the cancel button is pushed the pop up goes away.

This approach for editing line items could also be used to edit records in the same database, another database or as I am using it, editing line items in an array.

The downside to this approach is that a user can tab out of the pop-upped form to another field “below” it. Quick question, can rundialog position the window anywhere?

Ideally I would want the fields to appear on top of the matrix or text list cells and would post the results to the separate file, same file or array when the last field is tabbed out of. It could then go to the next “record” in the matrix and repeat the process. I began writing the code for this but didn’t have time to finish it. I also was stuck on how to process the rectangles in a way that would move the fields to the next row.

You are doing some very nice work, I like it.

I looked up cloneform and I see that you basically copied your code right out of the help file. Which is what it is there for.

However, now that I’ve researched it a bit more, I don’t understand your original question.

That code is already designed to place the cloned form object relative to the top left of the swap area. Is that not what it is doing?

Instead of using objectinfo(, you would use the objectaction statement.

objectaction "object","cellrectangle",cellNumber,targetRectangle

This isn’t yet documented in the Panorama X help, but I believe it is documented in the Intensive Training Course, and it for sure is documented in Panorama 6, and it works the same. See page 715 of the *Formula & Programming" pdf file.

You could fix this by doing this before you start – select all text editor objects, then use changeobjects to turn off the tab cycle option:

"$TextEditorTabCycle","0",

When you’re done, do the same in reverse to turn the tab cycle option off again.

If you did this the user could still click on the original text editor objects, but they could not tab to them. Unfortunately, there is no way to disable clicking on the objects.

No, it can’t. But you can use openform or opendialog and position wherever you want.

Hi Jim,

[quote=“admin, post:5, topic:1761”]
That code is already designed to place the cloned form object relative to the top left of the swap area. Is that not what it is doing?[/quote]

It is relative to the top left but it is offset by some value that I can’t figure out. What I would like it to do is be place at the top and left coordinates of the rectangle with no offset.

Thank you for the other tips. I will give them a try.

I don’t think there is any offset. Remember, this is going to make the top left corner of the cloned form into the top left corner of the swap area. So any offset from the top left of the cloned form to the upper left object in that form will be carried over when the form is cloned.

I would make a new test form, with a swap area object that is visible. Then you should be able to see exactly what is going on.

You are exactly right, the offset was in the form I was cloning. Thank you.