I have an invoicing form (invoicing) based on a table "invoice". On the form is a browse for the "invoice" table and a button (Edit Invoice) that calls up another form (Invoice Editing Form) based on a set invoice=>invoice_Detail. On this second form there is a tabbed object with two tabs. The first tab holds data from the "invoice table" the second tab holds the browse for the invoice_detail table. I have a button on the second tab called "print invoice" The report is also based on a set comprised of invoice=>invoice_detail. The xbasic code in the button is derived directly from action scripting.
The problem occurs after the "print invoice" button is pressed and the preview option is chosen. After the user clicks on the X to close the preview window I find that the (Edit Invoice) button will not work.
After closing the app I find that the report object still exists as well as (Invoice Editing Form) object and the (invoicing)object.
While stepping through the debugger I find that the debugger fails to continue stepping through the code after running the following line:
:Report.preview("invoice_r","BETWEEN(RECNO(),"+ current_record+ ","+current_record+")")
The confounding thing is that I have a button in the (Invoicing) form that contains the same code it runs perfectly and doesn't leave objects behind.
Perhaps there is another way to ensure that a report window actually closes when the user presses the X.
The following is the code found in the on_push event of my (Edit Invoice) button:
this.disable()
dim A_ASK_PRINT as c
A_ASK_PRINT = ui_get_radio(this.text, 1, "Print", "Preview")
if A_ASK_PRINT = "Print"
goto print
elseif A_ASK_PRINT = "Preview"
goto preview
else
this.enable()
goto cleanup
end if
print:
current_record = alltrim(str(recno(),10,0))
:Report.print("invoice_r","BETWEEN(RECNO(),"+ current_record+ "," + current_record+")")
this.enable()
goto cleanup
preview:
current_record = alltrim(str(recno(),10,0))
:Invoice_Fm.Hide()
:Report.preview("invoice_r","BETWEEN(RECNO(),"+ current_record+ "," + current_record+")")
this.enable()
:invoice_fm.show()
goto cleanup
end
cleanup:
this.enable()
debug(0)
end
END
The problem occurs after the "print invoice" button is pressed and the preview option is chosen. After the user clicks on the X to close the preview window I find that the (Edit Invoice) button will not work.
After closing the app I find that the report object still exists as well as (Invoice Editing Form) object and the (invoicing)object.
While stepping through the debugger I find that the debugger fails to continue stepping through the code after running the following line:
:Report.preview("invoice_r","BETWEEN(RECNO(),"+ current_record+ ","+current_record+")")
The confounding thing is that I have a button in the (Invoicing) form that contains the same code it runs perfectly and doesn't leave objects behind.
Perhaps there is another way to ensure that a report window actually closes when the user presses the X.
The following is the code found in the on_push event of my (Edit Invoice) button:
this.disable()
dim A_ASK_PRINT as c
A_ASK_PRINT = ui_get_radio(this.text, 1, "Print", "Preview")
if A_ASK_PRINT = "Print"
goto print
elseif A_ASK_PRINT = "Preview"
goto preview
else
this.enable()
goto cleanup
end if
print:
current_record = alltrim(str(recno(),10,0))
:Report.print("invoice_r","BETWEEN(RECNO(),"+ current_record+ "," + current_record+")")
this.enable()
goto cleanup
preview:
current_record = alltrim(str(recno(),10,0))
:Invoice_Fm.Hide()
:Report.preview("invoice_r","BETWEEN(RECNO(),"+ current_record+ "," + current_record+")")
this.enable()
:invoice_fm.show()
goto cleanup
end
cleanup:
this.enable()
debug(0)
end
END
Comment