Файл ресурсов FoxUser.dbf хранит ряд информационных ресурсов (например, позиции окна, наборы цветов, конфигурации окна Просмотра (Browse), определения этикеток и т.д.). FoxUser.dbf - это стандартная таблица FoxPro со связанным с ней мемо-файлом (.FPT). Если индексный файл не существует, то он будет создан при открытии файла FoxUser.dbf.

В отличие от более ранних версий Visual FoxPro, файл ресурсов FoxUser.dbf всегда открыт как SHARED.

Если RESOURCE установлен в SET ON, то FoxPro управляет всеми ресурсами. Вы можете модифицировать данные, содержащиеся в этом файле двумя способами:

  1. Специальные конфигурации окна или других его предустановок, установленные однажды и сохраненные в файле ресурсов, могут быть защищены из последующих диалоговых изменений с помощью модификации поля READONLY для специфицированного ресурса (смотрите пример в секции Конфигурация Встроенного Окна  Просмотра (Predefining Browse Window Configuration)).

  2. Ресурсы, которые больше не нужны или не желательны, могут быть удалены и файл ресурсов может быть упакован.

Модификация поля READONLY и/или удаление записей из файла ресурсов - это единственные действия, которые Вы должны выполнять с файлом FoxUser.dbf. Вы должны скопировать файл ресурсов прежде чем сделать любую его модификацию.

Таблица FoxUser.dbf имеет следующую структуру:
№ поля Имя поля Тип поля Ширина поля

1

TYPE

Character

12

2

ID

Character

12

3

NAME

Memo

4

4

READONLY

Logical

1

5

CKVAL

Numeric

6

6

DATA

Memo

4

7

UPDATED

Date

8

TYPE

Определяет тип информации хранилища ресурсов

ID

Определяет запись с полем TYPE

NAME

Содержит имя, присвоенное ресурсу, например, имя присвоенное набору цветов, окну ПРОСМОТРА (BROWSE) или системным окнам

READONLY

Логическое поле, которое может быть установлено в истину (.T.), для указания на то, что ресурс будет использован только для чтения и не может быть изменен

CKVAL

Используется FoxPro для проверки правильности данных (в мемо-поле DATA)

DATA

Мемо-поле, которое содержит актуальные данные для ресурса

UPDATED

Дата,  когда текущий ресурс последний раз был изменен

Вы можете сделать файл ресурсов FoxUser.dbf доступным только для чтения с помощью МS-DOS команды ATTRIB с параметром <+R>. Маркировка файла "только для чтения" полезна в многопользовательских решениях, поскольку FoxUser.dbf может быть открыт как Shared в сетевых приложениях. 

Expand imageМодификация Файла Ресурсов FoxUser.dbf

The following SET RESOURCE commands make it possible for you to open and easily modify the FoxUser.dbf file's contents, as well as use a resource file other than FoxUser.dbf.

SET RESOURCE TO <resourcefile>

SET RESOURCE TO

SET RESOURCE ON

SET RESOURCE OFF

If you want to make changes to your resources, in the Command window, use the following commands:

  CopyCode imageCopy Code
SET RESOURCE OFF
USE FOXUSER
BROWSE

With the resource file open, you can use CHANGE, EDIT, BROWSE, DELETE, REPLACE and other FoxPro commands to modify or delete data. You can even use COPY TO to create a new resource table. When you have finished modifying the resource file, pack it if you marked records for deletion, and close it. Then, set the resource feature on with the following commands:

  CopyCode imageCopy Code
USE
SET RESOURCE ON

You can open the FoxUser.dbf file in a work area without setting resource OFF by issuing the command USE SYS(2005) AGAIN. SYS(2005) returns the name of the current resource file.

Expand imageКонфигурация Встроенного Окна  Просмотра (Predefining Browse Window Configuration)

One useful modification that you can make to the FoxUser.dbf file is changing the READONLY field for predefined Browse window configurations.

First, adjust a BROWSE window to display specific fields that are sized for easy manipulation, position the window and size it, split the window into two partitions, with one partition in BROWSE mode and one in CHANGE, then close the window. When the BROWSE window is closed, its configuration is saved in the current resource file, provided the field named READONLY is not set to T, and provided the window was not closed with Ctrl+Q.

Then, issue USE SYS(2005) AGAIN and edit the READONLY field, setting it to true ("T"). To do this, look for the BROWSE window resource that has a TYPE of PREFW, and ID of WINDBROW, and a NAME field with the alias of the table you just browsed. When the READONLY field is true (T), the corresponding resource data will not be overwritten if the Browse window configuration is later changed interactively.

Now, whenever the table is browsed with the BROWSE LAST command, the Browse window appears in the same position with all its field, size, and placement configurations the same as the last session. No matter how much the Browse window is changed by the user, it will always return according to the data in the resource when you BROWSE LAST.

Expand imageСм. также