Delete Field from Menu causes crash

I have a file that I want to convert for other uses and was trying to trim down the number of fields. Using Field>Delete Field worked for a few of the fields, but then it caused PanX to crash (no hang, just crash). Started PanX and tried again. The deleted fields were gone, but every attempt to delete more fields (I tried several different ones) caused a crash.
I thought it was maybe because a form was open that used that field, but tried it with a form without the field and with no forms and still crashed.
Anyone else run into this?

I vaguely recall sometime in the distant past that I had a similar problem with crashing after trying to delete a whole bunch of fields. I think I was able to remove the additional field by using a procedure to eradicate them. I would try making a temporary procedure to pick the fields you want removed and then deleting them.

let theFields=""
superchoicedialog info("fields"),theFields,{buttons="Delete;Cancel",
    horizontalgrid="on",max=10}
if info("dialogtrigger")="Delete"
    looparray theFields, ¶, element, index
        field (element)
        deletefield
    endloop
endif

The dialog will allow you to select multiple fields to delete at one time. No guarantee this won’t crash as well but it might be worth a shot.

@martinmc if you continue to have this problem you can send me the database and I’ll try to run it under the Xcode debugger. I have not heard of a crashing problem with deleting fields.

I suspect it is a very corrupted file. I’ve tried some different things from the menu and gotten bad results.
Show All Fields resulted in all of the filenames being erased.
Field>Morph>Fill With Value…"" crashed PanX

copy of file sent to Jim.

Using a noshow before a deletefield statement and followed by a showpage will crash Panorama X. This happens even if there is an endnoshow statement before the showpage. If I use the showother statement with the 99 code it redraws the datasheet properly and does not crash.

So, this crashes Panorama X:

noshow
deletefield
showpage
endnoshow

But, this does not:

noshow
deletefield
showother «»,99
endnoshow

Note that it will not crash if the datasheet is not open but will crash even if it is open but not the active window.

I just had this same occurrence, using Delete Field from the menu crashed PanX. I noticed, after several attempts, that the crash only happened when I was trying to delete the last field in the database file, the field to the far right in Data Sheet view.

Oddly, I couldn’t drag this last field to the left. However, I could and did ADD a field to its right, thus making it no longer the last field. Then I was able to delete it successfully without a crash. However, when I then tried to delete the new last field, PanX crashed.

Do you possibly have hidden fields next to your last field?

@KJM — Bingo! Yes indeed, and that was the culprit. I made the adjacent hidden field visible, deleted the last field, then re-hid the field I wanted hidden.

Still seems like a bug to me, but glad to know a work around. Hopefully I remember it. :slight_smile:

Thank you for the help.
Jim

For sure that is a bug! Thanks to both of you for pinning this down, I have added it to the list.