Before you start, make sure you have the "stndrd.olb" and"calendar.pll" file.
1.Open the file stndrd.old from Form Developer. You will notice the item "standards" is added to the object navigator/object libraries section.
2.Next open or create a new form.
3.Go to "Object Libraries" under "STANDARDS" library, expand the "library tabs", and double click on "COMPONENTS" object.
4.Drag the component "calendar" to the new form. A message box wills pop-up to ask whether you want to "sub-class" or "copy". Select "copy" or the new form with the calendar will not work on PC's that does not have the standards item added. Copying will add all required bits you need for the calendar.
5.Next open the "calendar.pll" file. This will add a "calendar" item to the "pl/sql libraries" section on the "object navigator". Select the "program unit" section and drag it up to the "programs unit" section of your form. This will add 2 items to the "programs unit" section (date_lov - package spec & date lov -package body).
6.After that you need to add a program unit procedure named DATE_CHOOSEN in the new form or you will get error “date_choosen not declared”. Copy this code into the procedure:
PROCEDURE date_choosen IS
BEGIN
copy(to_char(date_lov.current_lov_date,'dd-mon-yyyy'), date_lov.date_lov_return_item);
go_item(date_lov.date_lov_return_item);
if date_lov.lov_auto_skip = TRUE then
next_item;
end if;
END;
7.Next on the new form you can add a button to call the "calendar" with button trigger. Use the code below to call the "calendar".
DATE_LOV.GET_DATE
(NVL(:BLOCK.ITEM, SYSDATE),
'BLOCK.ITEM',
200, 100,
'SELECT DATE',
'OK','CANCEL',
TRUE, FALSE, FALSE);
The “block.item” is where you want the date to be inserted into via the calendar user interaction.
Parameters for the Date_LOV.Get_Date are as follows:
date_lov.get_date (initial date,
return block.item,
window x position,
window y position,
window title,
ok button label,
cancel button label,
highlight weekend days,
autoconfirm selection,
autoskip after selection);
You may take a look at the 'Calendar' code that is available as a download from the Oracle Forms website http://www.oracle.com/technology/sample_code/products/forms/6idemos.html
References: http://www.orafaq.com/forum/t/30334/0/
No comments:
Post a Comment