Top.Mail.Ru Yandeks.Metrika
Forum: "Bases";
Current archive: 2003.02.13;
Download: [xml.tar.bz2];


How to create a directory? Find similar branches

Сергей   (2003-01-17 13:32) [0]

Dear Delphi experts!
Please share an example of creating a directory.
Task (perhaps a standard, but, unfortunately, a worthy example,
I have not found yet): There is a table A, consisting of two fields: fCode (numeric)
and fName (a string of 50 characters), and table B, which, among others, has
field fA (numerical). It is necessary to make sure that when viewing
instead of the value of its field fA, the user saw records of table B
the value of the field fName from table A (by the bunch B.fA = A.fCode), and when
editing table B instead of editing its field fA would show
full reference (i.e. the contents of table A, which is right there
You can edit (add, modify, delete) !!!), from which the user
can select the desired record, and then the value of the fCode field from this selected
records should be in the field fA of the edited record of table B.
I understand that it takes time to create even a simple example.
But maybe someone at least describes the principle of creating such a directory.
I thank everyone who responded in advance!
My e-mail: book_dsn@mail.ru.

Delirium^.Tremens   (2003-01-17 13:44) [1]

Damn, from all this blizzard, (as I understand it) it follows that we need a classic one-to-many master-detail bundle and an SQL query to view it using the left connection. It is in any, the most stupid, little book about a DB is.

And I won’t say my e-mail :-)

Sergey13   (2003-01-17 13:48) [2]

Serge, namesake, take any book on Delphi and look. What you wrote is a classic of the genre. About this in all books and fully and accessible. And look at the examples for Delf, there probably are. Normal the answer to your question is a few pages - hardly anyone will give you. The question is simple - the answer is long. 8-(

Сергей   (2003-01-17 13:51) [3]

The problem is not just in the bundle, but in the organization of entering information not by pens, but by using a directory in which information can be changed along the way !!!

gek   (2003-01-17 13:54) [4]

Well, add the "edit" button and show what your heart desires

Сергей   (2003-01-17 13:56) [5]

So, I want to know how to add this button correctly and return the selected result.

Sergey13   (2003-01-17 13:58) [6]

What does "right" mean? How it works - that's right.

passm   (2003-01-17 14:08) [7]

Sergey (17.01.03/13/56 XNUMX:XNUMX p.m.)> In the grid, the field with the value from the directory and ByttonStyle = cbsEllipsis and ReadOnly = True.
When you click on the button / press (Enter or Shiht + Enter ... as You like) ... etc. etc. :)

MsGuns   (2003-01-17 16:02) [8]

Sabzh, IMHO, is not entirely correct. Apparently, this meant not creating a directory, but a convenient (for the user, essno) interface for working with it, including adding "on the fly", i.e. without unnecessary clicks on the menu "Directories", etc.

The directory itself and the panel with controls (simple type TEdit) must be built in the form of a form, torn off modally. When you open the form, you must position yourself on the input key, if it is transferred from the goal form as a value acc. fields of the current record of the main table (Locate). "Journey" through the grid reference in the usual way.
By double click (or button or popup), the unit of the directory "takes" the values ​​of the fields of the current record of the directory and writes them into variables (I do this through a record), after which the form closes. The goal of the program checks the values ​​of the record and, if they are not empty, writes down what is needed wherever (with a simple exit from the record, the record is filled with gaps).
The panel is used for editing-adding to the directory and is not visible in normal mode. Turns on according to the special control "Add" / "Change". The panel controls should not be directly related to the directory table. When you open the panel, they are cleaned when added or filled in with the data of the recording when editing. There are 2 more controls: “Save” and “Cancel”. If the first one is selected, then you do the correctness and duplication of keys (search by the Locate help) and if everything is normal, give the table ReadOnly = false, and then on the context, after which the record passed to the goal form is filled as with a simple selection and closes both the panel and the form. Yes, it is preferable to do replacements-inserts by requests. If "Cancel" is clicked, you simply hide the panel.

Сергей   (2003-01-17 18:16) [9]

MsGuns, thanks for the detailed answer! Do you understand me. Yes, I want to make a convenient interface. The only drawback is that you offer to open the form modally. Everything is clear here. But modally opening it (the directory form) is not always convenient for the user, so I would like to open it normally. But as in this case, in processing the form of the directory to find out which form called it and if it had not closed by the time it would be necessary to return the data. Here, then I "float".

atmamont   (2003-01-17 18:20) [10]

To everyone who does not understand - a person wants to do as it is done in 1C: Enterprise.

Сергей   (2003-01-17 18:24) [11]

atmamont, absolutely right! In terms of interface, 1C-Enterprise is now a standard for me to strive for, but, unfortunately, I do not know how to do this yet.

MsGuns   (2003-01-17 18:26) [12]

> Sergey (17.01.03/18/16 XNUMX:XNUMX)

The called form can have methods that are called by the calling forms, for example, an on / off filter. In order to check whether it is necessary to do this (the mod form may be invisible at this moment), just check its Visible property.

In order for the form not to be called modally, but visible, just assign FormStyle: = fsStayOnTop, and if it is already such, but you need to "put it on top", then BringToFront

In general, for a reference, I would not recommend using a non-modal form. Work with the reference book is a rather responsible thing and the user should also relate to this.

Delirium^.Tremens   (2003-01-17 18:30) [13]

The invention of the bicycle lasted five hours. You really would have at least some 2C: The company made, and preferably 3C. There, in "Fuck" the people write their OSes and asks for a piece of an example :-)

MsGuns   (2003-01-17 18:33) [14]

> Sergey (17.01.03/18/24 XNUMX:XNUMX)
> atmamont, absolutely right! In terms of interface, 1C-Enterprise is now a standard for me to strive for, but, unfortunately, I do not know how to do this yet.

But it’s in vain - you’re going the wrong way, comrade!
The 1C interface is extremely overloaded, there are a lot of controls, which 99% of users, if they click, then after that they crawl under the table from fear or call the programmer a good obscenity. Further. Outwardly, everything seems cool, but the mechanism for exchanging data with physical tables (as well as the tables themselves) is completely clumsy. That is why on more than 3 computers without MS SQL server and 1C Entey just does not work.
1C is a great example of a beautiful wrapper in which a piece of g is wrapped ... (I'm not talking about all the 1C implementations. An enterprise, but about the base one, for sure)

However, that's all - IMHO 8))

Delirium^.Tremens   (2003-01-17 18:35) [15]

MsGuns © (17.01.03 18: 33)

> 1C interface is extremely overloaded, there are many controls that
> 99% of users, if they click, then after that they climb under the table
> from fear or a good obscenity is called a programmer

This is how someone configured and 1C is not responsible for other people's crooked hands (the curves itself)

MsGuns   (2003-01-17 18:39) [16]

> Delirium ^ .Tremens © (17.01.03 18: 35)

I gave a footnote - base

Сергей   (2003-01-17 18:40) [17]

In fact, if you understand what you want to do, then there are no big problems in 1C, but convenience is present.

MsGuns   (2003-01-17 18:50) [18]

> Sergey (17.01.03/18/40 XNUMX:XNUMX)
> In fact, if you understand what you want to do, then there are no big problems in 1C, but convenience is present.

Another misconception. The interface is with some YES clauses, but a NORMALLY functioning database with the ability to scale and develop in the future - for nothing!
1C is, first of all, a good (and, perhaps, the only) tool for a behind-the-ear miserable programmer (or someone who considers himself as such) for a couple of months to learn how to quickly and without hassle "cut" money from gullible client lamers, who are embittered to order NORMAL software for their office.

In this regard, 1C as a programming environment, really, knows no equal!

Jeer   (2003-01-17 23:07) [19]

In short, I can tell you how to do it.

The basic form (on the basis of which the descendants are created) has the methods of sending and receiving messages (both in the main and in modal and child forms), as well as a broadcast message.
The message protocol (read the rules for transmitting commands and parameters) in my case is defined as follows:
- command (s - script), i.e. what to do.
- parameter block
"cmd = 8; id = 1234"
Team 8 - positioning (locate)
On record with id = 1234

Accordingly, when the directory is called (modally, for example)
a message is sent to him with the command and parameters.
After selecting (editing, adding) an element in the directory, a return message is sent to the calling form about the result (also a set of command parameters) and the necessary actions are performed to close the modal form in the calling form.

Another example.
If an action is performed in one of the child forms, possibly involving data in other forms present on the screen, then a broadcast message is usually sent.
Inactive forms, having received it, analyze it for "worthy of attention" and react - refresh.
"Dignity" - is determined through the connection with the changed tables through the cross-reference table.
You can, of course, stupidly refresh everything, but it’s unethical.

ЮЮ   (2003-01-18 03:00) [20]

If this is really a directory, then in addition to the name, the object should have some other properties, and adding "on the fly" is pointless. If this table is a bunch of repeating text strings, then it's better to just create a text field and not save space :-)

Wolf   (2003-01-18 12:10) [21]

It is necessary to convince the client that this cannot be done, otherwise it will be in his table A:
hedgehogs, hedgehogs, hedgehogs, hedgehogs, etc.

MsGuns   (2003-01-18 18:16) [22]

> Yu (© 18.01.03 03: 00)
> If this is really a guide, then in addition to the name, the object should have some other properties, and adding "on the fly" is pointless

Not a dispute for the sake of tokmo for the truth;)
Directory reference - discord. In some cases, adding on the fly is not only convenient, but also necessary. Example:

Office of a large wholesale company. There are about a dozen operating locations from which work with customers - buyers is already on the phone. The operator-manager, writing out the invoice / invoice, must enter into it (invoice): to whom it is issued. Directory number of times. When adding a new client, it turns out that his bank is not included in the general corporate directory of banks. You need to add right there. Handbook number two. Those. "two-layer" editing by a sequential chain of two directories at once. And sometimes more. There is, of course, another option - pre-registering the client with the DB admin or with the leading sales manager. But these are unnecessary delays that customers do not like and harm the image of the company.
How to avoid redundancy (i.e., re-entering the same legal entity) when adding a new client - this is already part of the business logic and depends on the professional qualities of the application developer.

ЮЮ   (2003-01-20 04:08) [23]

MsGuns © (18.01.03 18: 16)
I didn’t convince :-) In this case, only the following is visible: the DB manager doesn’t care about the structure of the database: Clients, Banks, etc., he just needs to write out an invoice with the details. And all these Clients and Banks appeared only from excessive "professionalism" of the application developer :-)
Otherwise, the operation manager should have been the first thing to find the client in the database, in the absence of it, create it and fill out the minimum necessary information, incl. his Bank, and from there call "write an account"

Сергей   (2003-01-25 14:38) [24]

Again I had a free minute and I was very pleased to find that the discussion was still ongoing. I fully support the comprehensive explanation of MsGuns in defense of the need to adjust the directory on the fly. To be honest, at the moment I am engaged in both programming and entering information, therefore I consider the problem more not from the “how convenient for the programmer” side, but from the “how convenient for the user” side. And it’s convenient for the user to solve problems as they arise, and not foresee in advance !!!
Thanks to everyone who responded for the good advice! I have already tried to implement some of them.
Having relied on user friendliness, I want to not use modal forms. And here, excuse me for being stubborn and stupid, I ask again: “Form [A] should call form [B]. Form [C] should return the result to the element of the form [A] that caused it, if by then form [A] will not be closed by the user. How to do this? "

MsGuns   (2003-01-25 17:12) [25]

Form “B” records the output parameters (for example, details of the customer who has been selected (added) by the user) into the parameters (in such cases I use the Record type) that are available to form “A”. Then the “visibility and activity of form“ A ”is checked. If the form is invisible (the user has closed it), then the control remains in the current control, if it is visible, then focus on it, and if it is active, nothing is done at all ( Exit from the corresponding procedure - the button handler "Select" / "Cancel")
If you want form “B” to be on the screen, even when the focus is in form “A”, give it (“B”) FormSlyle: = fsStayOnTop (In my opinion, not the best interface for the directory is its constant presence on the screen - if the directories are not one, but 6, and even a "ladder"?

Pages: 1 whole branch

Forum: "Bases";
Current archive: 2003.02.13;
Download: [xml.tar.bz2];


Memory: 0.67 MB
Time: 0.042 c
2003-01-24 15:56
How can you write programs like that?

Kettle (brewed)
2002-12-23 01:44
How to finish off traffic ???

2002-12-11 14:36
How to write a device driver for Windows 9x?

2003-02-03 07:55
try ... except

2003-02-04 15:38
form interpreter

afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic Indonesian Irish italian Japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Spanish swahili Swedish ภาษาไทย turkish Ukrainian urdu Tiếng Việt welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada Khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
English French German Italian Portuguese Russian Spanish