manual de developer

20
Manual de Developer Oracle Forms Builder About the Object Navigator The Object Navigator provides a hierarchical display of the objects in all open modules. Objects are grouped under the appropriate node. For example, all of the windows defined in a form module appear under the Windows node. Each object in the Object Navigator is displayed with an icon that indicates its type. For some objects, double- clicking the icon invokes an editor appropriate to that type of object. For example, double-clicking the object icon for a canvas invokes the Layout Editor. You can perform the following operations in the Object Navigator: o expand and collapse entries to locate objects quickly o select objects o create and delete objects o copy and move objects within and between modules o switch between views to display the objects you want to work with o quickly display the code associated with objects such as triggers and program units You can select commands in the Object Navigator from the menu and from the toolbar. The toolbar provides quick access to commands. Click once on the icon for the command you want to execute. To see a pop-up description of a toolbar command, move the cursor over the icon without clicking the mouse. Diseño y Creación Ing. Delvy Paredes 1

Upload: delvy-paredes

Post on 03-Mar-2015

144 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Manual de Developer

Manual de Developer

Oracle Forms BuilderAbout the Object Navigator

The Object Navigator provides a hierarchical display of the objects in all open modules. Objects are grouped under the appropriate node. For example, all of the windows defined in a form module appear under the Windows node.

Each object in the Object Navigator is displayed with an icon that indicates its type. For some objects, double-clicking the icon invokes an editor appropriate to that type of object. For example, double-clicking the object icon for a canvas invokes the Layout Editor.

You can perform the following operations in the Object Navigator:

o expand and collapse entries to locate objects quickly o select objects o create and delete objects o copy and move objects within and between modules o switch between views to display the objects you want to work with o quickly display the code associated with objects such as triggers and program

units

You can select commands in the Object Navigator from the menu and from the toolbar. The toolbar provides quick access to commands. Click once on the icon for the command you want to execute. To see a pop-up description of a toolbar command, move the cursor over the icon without clicking the mouse.

Trigers (Disparadores)This object represents a block of code you write to add functionality to a default application. Every trigger object has a name, and contains one or more PL/SQL

Diseño y CreaciónIng. Delvy Paredes

1

Page 2: Manual de Developer

Manual de Developer

statements. A trigger object encapsulates PL/SQL code so that you can associate it with an event, and execute and maintain it as a distinct object.

Alert(Alerta)An alert is a modal window that displays a message notifying the operator of some application condition. Use alerts to advise operators of unusual situations or to warn operators who are about to perform an action that might have undesirable or unexpected consequences. There are three styles of alerts: Stop, Caution, and Note. Each style denotes a different level of message severity. Message severity is represented visually by a unique icon that displays in the alert window.

Data Block(Bloques de Datos)A data block can be based on any of the following datasources:

table view FROM clause (query datasource only) procedure transactional trigger

Canvas object(Lienzo)This object represents a background entity on which you place interface items, such as check boxes, radio groups, and text items. There are four types of canvas objects: Content, Stacked, Horizontal Toolbar, and Vertical Toolbar.

List of values (LOV) object(Lista de Valores)This object represents an internal Form Builder data structure that has a column/row framework similar to a database table. An LOV object is a scrollable popup window that provides the end user with either a single or multi-column selection list.

Program unit object(Unidades de Programas)This object represents a named PL/SQL function or procedure that you write in a form, menu, or library module. Although trigger objects are the primary mechanism for adding programmatic control to a Form Builder application, this object supplements trigger objects by allowing you to reuse code without having to enter it in multiple triggers.

Properties(Propiedades)Son las que describen las cualidades de los objetos.

Properties palette(Paleta de Propiedades)Es una ventana que nos muestra todas las propiedades de u objeto.

Diseño y CreaciónIng. Delvy Paredes

2

Page 3: Manual de Developer

Manual de Developer

Module properties(Propiedades de un Módulo)

General Nombre

Nombre interno del objeto.

Funcional Título

Título a visualizar por el objeto.

Modulo de MenúsNombre del menú a utilizar con esta pantalla. (DEFAULT&SMARTBAR permite que en la ventana aparezca o no las barras de menús y de herramientas por defecto de Developer).

Windows Properties(Propiedades de la Ventana)

General Nombre

Nombre interno del objeto o ventana, este aparece en la barra de título de la ventana.

Funcional Título

Título a visualizar por el objeto. Lienzo primario

Lienzo que va a ser la lista de contenidos primarios de la ventana. Cierre Permitido

Permite activar o desactivar al comando cerrar de la ventana. Movimiento Permitido

Permite mover la ventana manualmente o mediante programación. Dimencionamiento Permitido

Permito o no cambiar el tamaño de la ventana en tiempo de ejecución. Maximización Permitida

Permite activar o desactivar al comando maximizar de la ventana. Minimización Permitida

Permite activar o desactivar al comando minimizar de la ventana.

Física Posición X

Posición de la ventana en la pantalla con relación al eje de la X. Posición Y

Posición de la ventana en la pantalla con relación al eje de la Y. Ancho

Ancho del objeto en unidades de coordenadas de la pantalla actual. Altura

Altura del objeto en unidades de coordenadas de la pantalla actual.

Diseño y CreaciónIng. Delvy Paredes

3

Page 4: Manual de Developer

Manual de Developer

Color Color del primer plano

Color de la region del segundo plano del objeto(define el color del texto de los Labels o etiquetas).

Color de FondoColor de la región del segundo plano(color del fondo de la ventana).

Fuente Fuente

Se utiliza para especificar el tipo y el tamaño de fuente a utilizar en el objeto.

About the Layout Editor(Editor de Diseño).The Layout Editor is a graphical design facility for creating and arranging

interface items and graphic objects in a form. In the Layout Editor, you work on a single canvas. Canvases are displayed in windows at runtime. You

specify the window a canvas will be displayed in by setting the canvas's Window property.

About text items(elemento de texto) A text item is an interface control that displays and allows editing of text. The text is displayed in a field in either single or multi-line format. Runtime Behavior A text item appears as an empty rectangular box or container. By default, an editor can be invoked from any text item.

Diseño y CreaciónIng. Delvy Paredes

4

Bar

ra d

e H

erra

mie

ntas

de

Dis

eño

Page 5: Manual de Developer

Manual de Developer

Propiedades mas Utilizadas

Funcional Activado

Si puede activar o desactivar el uso del Item con maen la forma. Justificación

Justifica el texto del elemento. Restricciones Mayúsculas/ minúsculas.

Para controlar que el texto que se introduzca en el objeto salga mayúscula/ minúscula o mixto.

Ocultar datos.Oculta los caracteres que los usuarios introducen en los elementos de textos, es muy utilizado para contraseñas.

Navegación Teclado de Navegación.

Permite que el usuario pueda o no navegar con el teclado el objeto.

Datos Tipo de datos

Valores permitidos como entrada y forma en que se visualizan Longitud máxima

Longitud máxima del valor del dato que se puede almacenar en un elemento. Valor inicial

Valor por defecto asignado a un elemento siempre que se inicia un registro. Mascara de formato

Visualizar la entrada y el formato aceptados para los datos del elemento de visualización y de textos.

Format Mask propertySpecifies the display format and input accepted for data in text items.

Character StringsThe following table describes valid format masks for character strings.

Element Example DescriptionX XXXX Any alphabetic, numeric, or special character. End user input string must be exact length specified by format mask. 9 9999 Numeric characters only. End user input string must be exact length specified by format mask. A AAAA Alphabetic characters only. End user input string must be exact length specified by format mask.

NUMBERS

The following table describes valid format masks for numbers.

Diseño y CreaciónIng. Delvy Paredes

5

Page 6: Manual de Developer

Manual de Developer

Element Example Description9 9999 Number of nines determines display width. Any leading zeros will be displayed as blanks. 0 0999 Display leading zeros. 0 9990 Display zero value as zero, not blank. $ $9999 Prefix value with dollar sign. comma 9,999 Display a comma in this position. For correct behavior in multilingual applications, substitute G to return the appropriate group (thousands) separator. period 99.99 Display a decimal point in this position. For correct behavior in multilingual applications, substitute D to return the appropriate decimal separator.

When you mask a number with nines (9), Form Builder adds a space in front of the number to accommodate the plus (+) or minus (-) sign. However, since the plus sign is not displayed, it appears as if Form Builder adds a space in front of the number. (The minus sign is displayed.)

To embed additional characters such as a hyphen (-) or a comma (,), surround the character with double-quotes (").

NUMBER ExamplesFormat Mask Description099"-"99"-"9999 Displays the social security number as formatted, including hyphens, even if end user enters only nine digits.To create a Social Security column, create an 11-character column, set to fixed length, with a format mask of 099"-"99"-"9999. This mask will accommodate Social Security numbers that begin with zero, accepting 012-34-5678 or 012345678 (both stored as 012345678).Format Mask User enters Result99.9 21.1 21.199.9 01.1 1.1

Format Mask property

When you prefix a date mask with FX, the end user must enter the date exactly as you define the mask, including the specified delimiters:

Date Examples

Format Mask DescriptionFXDD-MON-YY Will accept 12-JAN-94, but will not accept 12.JAN.94 or

12/JAN/94 because the delimiters do not match the mask. Will not accept 12JAN94 because there are no delimiters. Will accept 01-JAN-94 but will not accept 1-JAN-94.

FMDD-MON-YY Will accept 01-JAN-94. Will also accept the entry of other delimiters, for example 01/JAN/94 and 01 JAN 94. However, will not accept 01JAN94. Will accept 1-JAN-94, converting it to 01-JAN-94.

Diseño y CreaciónIng. Delvy Paredes

6

Page 7: Manual de Developer

Manual de Developer

DD-MON-YY Will accept 12.JAN.94, 12/JAN/94 or 12-JAN-94. Note: Any delimiter characters will be accepted, but if delimiters are omitted by the end user, this mask will interpret date characters as a delimiters. Will accept 12-JAN94, (but will erroneously interpret as 12-JAN-04); but will not accept 12JAN94, because "AN" is not a valid month name.

Label(Texto) Labels can contain more than one word and any punctuation character.

When Triggers

When-Button-PressedWhen-Checkbox-ChangedWhen-Clear-BlockWhen-Create-RecordWhen-Custom-Item-EventWhen-Database-RecordWhen-Form-NavigateWhen-Image-ActivatedWhen-Image-PressedWhen-List-ActivatedWhen-List-ChangedWhen-Mouse-Click When-Mouse-DoubleClickWhen-Mouse-DownWhen-Mouse-EnterWhen-Mouse-LeaveWhen-Mouse-MoveWhen-Mouse-UpWhen-New-Block-InstanceWhen-New-Form-InstanceWhen-New-Item-InstanceWhen-New-Record-InstanceWhen-Radio-ChangedWhen-Remove-RecordWhen-Tab-Page-ChangedWhen-Timer-ExpiredWhen-Validate-ItemWhen-Validate-RecordWhen-Window-ActivatedWhen-Window-ClosedWhen-Window-DeactivatedWhen-Window-Resized

Diseño y CreaciónIng. Delvy Paredes

7

Page 8: Manual de Developer

Manual de Developer

When-Button-Pressed TriggerFires when an operator selects a button, by clicking with a mouse, or using the keyboard.

KEY-NEXT-ITEMAsigna el foco al proximo Item del form.

Definition Level form, block, or item Example:Commit_Form;

COMMIT_FORM built-inCauses Form Builder to update data in the database to match data in the form. Form Builder first validates the form, then, for each block in the form, deletes, inserts, and updates to the database, and performs a database commit.

When-Validate-Item TriggerFires during the Validate the Item process. Specifically, it fires as the last part of item validation for items with the New or Changed validation status. Definition Level form, block, or item Example:BEGIN SELECT description INTO :Employee.Commplan_Desc FROM commplan WHERE commcode = :Employee.Commcode;EXCEPTION WHEN No.Data_Found THEN Message('Invalid Commission Plan, Use <List> for help'); RAISE Form_Trigger_Failure; WHEN Too_Many_Rows THEN Message('Error. Duplicate entries in COMMPLAN table!'); RAISE Form_Trigger_Failure; END;

When-New-Item-Instance TriggerFires when the input focus moves to an item. Specifically, it fires after navigation to an item. select nvl(max(estudiante.cod_est),0)+1into :cod_estfrom estudiante;Para ir incrementando el valor de un campo de forma secuencial.

When-New-Form-InstanceSET_WINDOW_PROPERTY(forms_mdi_window, window_state, maximize);Permite que la ventana se ejecute de forma maximizada.

SET_ITEM_PROPERTY('fecha_bautizo', ENABLED, property_false);Permite habilitar o deshabilitar un objeto de la ventana.

Diseño y CreaciónIng. Delvy Paredes

8

Page 9: Manual de Developer

Manual de Developer

About the PL/SQL EditorThe PL/SQL Editor is where you enter and compile code objects. Code objects in Form Builder include event triggers, subprograms (functions and procedures), menu item commands, and menu startup code.

Comandos Mas Utilizados

CREATE_RECORD built-inCreates a new record in the current block after the current record. Form Builder then navigates to the new record.

SyntaxCREATE_RECORD;

DELETE_RECORD built-inWhen used outside an On-Delete trigger, removes the current record from the block and marks the record as a delete. Records removed with this built-in are not removed one at a time, but are added to a list of records that are deleted during the next available commit process. If the record corresponds to a row in the database, Form Builder locks the record before removing it and marking it as a delete. If a query is open in the block, Form Builder fetches a record to refill the block if necessary. See also the description for the CLEAR_RECORD built-in subprogram.

In an On-Delete trigger, DELETE_RECORD initiates the default Form Builder processing for deleting a record during the Post and Commit Transaction process, as shown in Example 2 below.

SyntaxDELETE_RECORD;

CLEAR_FORM built-inCauses Form Builder to remove all records from, or flush, the current form, and puts the input focus in the first item of the first block.

Syntax

Commit; CLEAR_FORM;

Diseño y CreaciónIng. Delvy Paredes

9

Page 10: Manual de Developer

Manual de Developer

COMMIT_FORM built-inCauses Form Builder to update data in the database to match data in the form. Form Builder first validates the form, then, for each block in the form, deletes, inserts, and updates to the database, and performs a database commit. As a result of the database commit, the database releases all row and table locks.

SyntaxCOMMIT_FORM;

NEXT_RECORD built-inNavigates to the first enabled and navigable item in the record with the next higher sequence number than the current record. If there is no such record, Form Builder will fetch or create a record. If the current record is a new record, NEXT_RECORD fails.

SyntaxNEXT_RECORD;

PREVIOUS_RECORD built-inNavigates to the first enabled and navigable item in the record with the next lower sequence number than the current record.

SyntaxPREVIOUS_RECORD;

FIRST_RECORD built-inNavigates to the first record in the block's list of records.

SyntaxFIRST_RECORD;

LAST_RECORD built-inNavigates to the last record in the block's list of records. If a query is open in the block, Form Builder fetches the remaining selected records into the block's list of records, and closes the query.

SyntaxLAST_RECORD;

GO_ITEM built-inGO_ITEM navigates to an indicated item. GO_ITEM succeeds even if the target item has the Keyboard Navigable property set to No.

Syntax

GO_ITEM (item_id Item);BEGIN Go_Item('pref_dialog.printer_name'); END;

Diseño y CreaciónIng. Delvy Paredes

10

Page 11: Manual de Developer

Manual de Developer

Para controlar que los campos no pasen vacíos a nivel de programación el código es el siguiente:if :apellidos is null then message('El campo no puede estar vacío'); message('El campo no puede estar vacío');else if :apellidos is not null then next_item; end if;end if;

TRABAJAR CON PROCEDIMIENTOS EN DEVELOPER

PROCEDURE pr_camp_vacio IS

BEGIN if :apellidos is null then message('El campo no puede estar vacío'); message('El campo no puede estar vacío'); go_item('apellidos'); else

commit;clear_form;

IF :system.mode = 'ENTER-QUERY'THEN SET_ITEM_PROPERTY('nuevo', ENABLED, property_false);END IF;SET_ITEM_PROPERTY('fecha_bautizo', ENABLED, property_false);SET_ITEM_PROPERTY('fecha_pri_com', ENABLED, property_false);SET_ITEM_PROPERTY('fecha_confirmacion', ENABLED, property_false);

Message('Transacción completada con éxito... un registro guardado.');end if;

END;

Diseño y CreaciónIng. Delvy Paredes

11

Page 12: Manual de Developer

Manual de Developer

Creating a new menu moduleTo create a new menu module from scratch:

Select the Menus node in the Object Navigator and click the Create button in the toolbar.Form Builder creates a new menu module in the Object Navigator with a default

name, such as MODULE1. Replace the default name with a more meaningful name.

Comando para abrir una forma desde un botón.OPEN_FORM built-inOpens the indicated form. Use OPEN_FORM to create multiple-form applications, that is, applications that open more than one form at the same time.

Ejemplo:open_form('C:\colegio\registros\reg_profesor.fmx');

EXIT_FORM built-inProvides a means to exit a form, confirming commits and specifying rollback action.

In most contexts, EXIT_FORM navigates “outside” the form. If there are changes in the current form that have not been posted or committed, Form Builder prompts the operator to commit before continuing EXIT_FORM processing.

If the operator is in Enter Query mode, EXIT_FORM navigates out of Enter Query mode, not out of the form.

Ejemplo:exit_form;

Diseño y CreaciónIng. Delvy Paredes

12

Page 13: Manual de Developer

Manual de Developer

Report BuilderObject NavigatorThe Object Navigator provides a hierarchical display of all major objects in a report, including attached libraries and external queries. Using this view, you can take such actions as select an object, bring up the Property Palette for an object, edit an object's PL/SQL, drag and drop PL/SQL program units, and search for an object by name.

Unused data model objects(Modelo de Datos)Make sure that you remove or suppress any data model objects that are not actually used in your report. If your data model includes a query that is only used in certain cases (i.e., when a parameter is set to a certain value), you can conditionally suppress the query with the SRW.SET_MAXROW packaged procedure. SRW.SET_MAXROW (queryname, 0) will cause the query to fetch no records.

Diseño y CreaciónIng. Delvy Paredes

13

Page 14: Manual de Developer

Manual de Developer

Layout Model view(Modelo de Diseño)The Layout Model view is a work area in which you can define the format of your report output. To do this, you work with layout objects, such as frames, repeating frames, fields, boilerplate, anchors, and Graphics objects.When you run a report, Report Builder uses the Layout Model as a default template for the report output. This template will grow or shrink based on the data fetched for and the PL/SQL logic assigned to the layout objects.

Parameter Form view(Pantalla de Parámetros)The Parameter Form view is the work area in which you define the format of the report's Runtime Parameter Form. To do this, you define and modify parameter form objects (fields and boilerplate).When you run a report, Report Builder uses the Parameter Form view as a template for the Runtime Parameter Form. Fields and boilerplate appear in the Runtime Parameter Form exactly as they appear in the Parameter Form view. If you do not define a Runtime Parameter Form in the Parameter Form view, Report Builder displays a default Parameter Form for you at runtime.

Diseño y CreaciónIng. Delvy Paredes

14

Page 15: Manual de Developer

Manual de Developer

Diseño y CreaciónIng. Delvy Paredes

15