Why Modal window closes? [message #208503] |
Mon, 11 December 2006 02:11 |
|
I'm validating an item on key_commit of my form. The problem is when I call show_window (window set to modal=Yes) with stack canvas in it, it only appear for about 3 seconds after I clicked message that is placed after calling window and then disappear without waiting any response from the user.
When no message after, it doesn't show.
[Updated on: Mon, 11 December 2006 02:23] Report message to a moderator
|
|
|
|
Re: Why Modal window closes? [message #209444 is a reply to message #208503] |
Thu, 14 December 2006 20:44 |
|
I did, it's running fine but I encountered a bug.
On validate I check whether date was changed or not.
If changed then the pop-up window appear. If the user choose cancel then the date restore the original date.
Now, when I changed the date den press F10,
the window pops up, but if I choose cancel,
the new date was saved to database. Seems like it was saved before I rstore the orig date. I wonder how it happnes cause I understand, the when-validate-item fires first before the commit.
|
|
|
|
Re: Why Modal window closes? [message #209791 is a reply to message #208503] |
Sun, 17 December 2006 20:52 |
|
I call this proc on when-validate
CHECK_DT_CHANGE;
proc CHECK_DT_CHANGE:
PROCEDURE CHECK_DT_CHANGE IS
v_due_dt invstgtn_rep.due_dt%TYPE;
v_timer TIMER;
BEGIN
If variables.v_dt_instance = 'Y' Then --check if date touched
Begin
SELECT due_dt
INTO v_due_dt
FROM invstgtn_rep
WHERE ref_year = :invstgtn_rep.ref_year
AND ref_no = :invstgtn_rep.ref_no
AND hist_seq_no = :invstgtn_rep.hist_seq_no
AND line_cd = :invstgtn_rep.line_cd
AND subline_cd = :invstgtn_rep.subline_cd
AND iss_cd = :invstgtn_rep.iss_cd
AND clm_yy = :invstgtn_rep.clm_yy
AND clm_seq_no = :invstgtn_rep.clm_seq_no;
EXCEPTION
WHEN NO_DATA_FOUND Then
v_due_dt := null;
End;
variables.v_orig_due_dt := v_due_dt;
If v_due_dt <> :invstgtn_rep.dsp_due_dt Then
v_timer := Find_Timer('DUE_DT_TIMER');
IF Id_Null(v_timer) THEN
v_timer := create_timer('DUE_DT_TIMER',1,NO_REPEAT);
END IF;
End If;
End If;
END;
proc CHECK_DT_CHANGE2:
PROCEDURE CHECK_DT_CHANGE2 IS
cur_item VARCHAR2(100);
BEGIN
cur_item := :system.cursor_item;
If UPPER(:SYSTEM.CURRENT_BLOCK) <> 'INVSTGTN_REP' Then
go_block('invstgtn_rep');
go_item('invstgtn_rep.dsp_due_dt');
--go_block('reason2');
go_block('invstgtn_hdr');
go_item('invstgtn_hdr.ref_no');
show_view('main1');
show_view('main3');
show_view('main2');
hide_view('injury_can');
hide_view('inspect_can');
End If;
show_window('reason');
--show_view('reason');
go_item('reason2.reason');
--RAISE FORM_TRIGGER_FAILURE;
variables.v_item := 'reason2.reason';
variables.v_dt_instance:='N';
variables.v_item := null;
END;
code for window OK button:
DECLARE
v_cur_blk VARCHAR2(100);
Begin
v_cur_blk := :SYSTEM.CURRENT_BLOCK;
If :reason2.reason is NULL Then
message('Please specify reason for change of due date');
message('Please specify reason for change of due date');
Else
--hide_view('reason');
hide_window('reason');
If variables.v_save = 'Y' Then
Commit;
go_block('invstgtn_dtls');
execute_query;
variables.v_save := 'N';
End If;
--go_block('invstgtn_hdr');
--execute_query;
go_item('invstgtn_rep.dsp_due_dt');
End If;
-- go_block(v_cur_blk);
End;
code for window CANCEL button:
:invstgtn_rep.dsp_due_dt := variables.v_orig_due_dt;
--hide_view('reason');
hide_window('reason');
go_item('invstgtn_rep.dsp_due_dt');
-->edit
I call CHECK_DT_CHANGE2 on when-timer-expired
[Updated on: Sun, 17 December 2006 20:53] Report message to a moderator
|
|
|
|
Re: Why Modal window closes? [message #210001 is a reply to message #208503] |
Mon, 18 December 2006 21:30 |
|
1) F10 = commit
2) 'variables.v_save' set to 'Y' on form key-commit
3) I use v_due_dt to know if date was altered by the user.
4) Im not used to it, I think it's always safe to fetch from table.
|
|
|
|
Re: Why Modal window closes? [message #210049 is a reply to message #208503] |
Tue, 19 December 2006 02:30 |
|
The problem is that the 'when-validate-item only fires after executing the codes from form 'key-commit'. As I understand, 'when-validate-item' must fire first. Anyway I adjust my code to this situation and it's now running fine. I'm testing for some loopholes.
|
|
|
|
|
|
Re: Why Modal window closes? [message #210224 is a reply to message #208503] |
Tue, 19 December 2006 21:53 |
|
I have plenty of blocks, around 50. The item i'm validating is for example on block3 and doest contain key-commit. The master of block3 is block2 which has key-commit. Then form has key-commit.
The form key-commit fire first before the validate of item in block3. key-commit on block2 doesn't fire because i'm only working on items of block3.
|
|
|