My application requires to navigate to another form from Menu, which is attached to all the forms, with the following conditions.
1. If the calling form is in Enter-Query mode, then the query needs to be cancelled and it should navigate to the called form.
2. If the calling form status is 'Changed' then, the user should be prompted to save or cancel the changes and navigation should be made.
My code in the PL/SQL Code part of the Menu item is, (which in turn needs to call 'calledform_a' from any form in the application)
if :system.mode = 'ENTER-QUERY' then
If I invoke this when the calling form is in 'ENTER-QUERY' mode, then the Query gets cancelled; but the 'calledform_a' is not coming up. But, for testing purpose, I just invoked other menu items (which does not do any action in the form) like, calling the 'Keys' menu item under the 'Help' menu. The window which shows the keyboard shortcut keys comes up and when I clicked the OK button on this window, the 'Keys' window is closed and the 'calledform_a' is coming up now.
As another level of testing, I put the same code in the 'When-Button-Pressed' of a button in the form itself and it works fine.
So, I think, it may be synchronization problem between the Menu and the Form. I tried giving 'synchronize' in the Menu item code and it does not work.
I tested this in Forms9i in Windows NT and Sun Solaris.
Please let me know if some one knows the solution.
Open_form still wants to direct the focus from one form (which is in enter-query mode) to another, and so the error 'Cannot navigate out of form' is raised.
That menu code after exit_form is never reached seems to be a feature of Forms, I came across this myself, and I have yet to find a solution for it.....
I am using headstart by the way which does not check for this status in this particular case (probably for the reason stated above), and also calls new_form even though in enter-query mode this is illegal. A bit buggy if you ask me....
An alternative might be to use exit_form in the when_window_decativated trigger, I have not tested this...