Re: Display only blocks in SQL*Forms

From: craig sivils <casivils_at_lescsse.jsc.nasa.gov>
Date: 15 Jan 93 21:29:54 GMT
Message-ID: <casivils.727133394_at_node_508ba>


In <6656.2b550b5f_at_hayes.com> fgreene_at_hayes.com writes:

>In article <1993Jan13.190453.17942_at_eng.ufl.edu>, mjw_at_mailbox.eng.ufl.edu (Mike Wohlgemuth) writes:

>> I need to create a form in which the user enters information
>> to be used in a query, and the query results show up in a
>> seperate block in the form. The form should allow them to
>> enter the block and navigate through the results, but not
>> allow them to edit the values in the results. I have RTFMed
>> and cannot see any way to make all the fields in a block
>> display only and still be able to enter the block. Am I
>> missing something obvious?
>>
>> Mike

There is another way other than those previously mentioned. Things you cannot do to/inside a block containing display only fields

next_block/previous_block/go_block (to the display only block) and next_field/previous_field (within the block)

Things you can do

go_field,up,down,next_record,previous_record,edit_field (read only).

Solution:
use go_field to navigate to the block, create custom procedures with names similar to nxt_field/prv_field which will navigate the user to the next displayed field in the current block (so that the user could use edit_field to see the contents of a field which cannot be completely displayed)

The nxt_field code isn't too hard, but here is an example you could use as a reference (there are other neat things you can do from this structure)

      PROCEDURE NXT_FIELD IS
      --  PURPOSE/DESCRIPTION:
      --    This procedure emulates the NEXT_FIELD packaged procedure
      --    with the exception that this procedure allows a <Next Field>
      --    to be done even when the block has no enterable fields.
      --
      --  Rest of prologue deleted, this comes from our groups master library
      --
        CURR_BLOCK CHAR(30);
        CURR_FIELD CHAR(61);
        TEMP_FIELD CHAR(30);
      BEGIN
        IF :SYSTEM.CURSOR_BLOCK IS NOT NULL THEN
          -- Store the current field and block.
          CURR_BLOCK := :SYSTEM.CURSOR_BLOCK;
          CURR_FIELD := :SYSTEM.CURSOR_FIELD;
          TEMP_FIELD := SUBSTR(CURR_FIELD, INSTR(CURR_FIELD, '.') + 1, 30);
          LOOP
            -- If the cursor is in the last field, then go to the first field;
            -- else go to the next field.
            IF FIELD_CHARACTERISTIC(CURR_BLOCK || '.' || TEMP_FIELD, NEXTFIELD)
                IS NULL THEN
              TEMP_FIELD := BLOCK_CHARACTERISTIC(CURR_BLOCK, FIRST_FIELD);
              IF :SYSTEM.LAST_RECORD = 'FALSE' THEN
                DOWN;
              END IF;
            ELSE
              TEMP_FIELD := FIELD_CHARACTERISTIC(CURR_BLOCK || '.' ||
                  TEMP_FIELD, NEXTFIELD);
            END IF;
            -- Exit when a displayed field is found.
            EXIT WHEN FIELD_CHARACTERISTIC(CURR_BLOCK || '.' || TEMP_FIELD,
                DISPLAYED) = 'TRUE';
          END LOOP;
          -- Put the cursor in the new field.
          GO_FIELD(CURR_BLOCK || '.' || TEMP_FIELD);
        END IF;
      END;

				Craig
Received on Fri Jan 15 1993 - 22:29:54 CET

Original text of this message