1 (edited by tcoton 2023-08-18 19:45:42)

Topic: What is the real action behind a button with the event "Show Form"?

I am really confused with the event Show or ShowModal in a script vs using a button with the event "Show Form" as when the form shows, it does not display any record in a grid when used in a script but displays with the button. How should I write a script to display a form containing a grid with all its content?

This code does not display the content of a grid in the opening form.

procedure Form1_securityPNG_OnClick (Sender: TObject);
begin
 Administration.Show;
end;

http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=9778

Post's attachments

Attachment icon Grid_issue001.png 121.39 kb, 18 downloads since 2023-08-18 

Re: What is the real action behind a button with the event "Show Form"?

tcoton wrote:

I am really confused with the event Show or ShowModal in a script vs using a button with the event "Show Form" as when the form shows, it does not display any record in a grid when used in a script but displays with the button. How should I write a script to display a form containing a grid with all its content?

This code does not display the content of a grid in the opening form.

procedure Form1_securityPNG_OnClick (Sender: TObject);
begin
 Administration.Show;
end;

http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=9778

show - второе окно появляется на экране и работает вместе с первым, возможно использовать элементы программы за этим окном
showModal - создает модальное окно, которое полностью берет на себя управление программой. Не возможно использовать элементы программы за этим окном
showRecord (TableName,id) - Открывает новое окно и передает в него имя таблицы и идентификатор для отображения данных
 
 
show - the second window appears on the screen and works together with the first one, it is possible to use program elements behind this window
showModal - creates a modal window that takes full control of the program. It is not possible to use program elements outside this window
showRecord(TableName,id) - Opens a new window and passes the table name and id to display the data

Re: What is the real action behind a button with the event "Show Form"?

That answers part of the question, is there a very specific code behind the buttons so that when we use the "Show Form" action, it automatically performs a grid.dbupdate on any grid displayed on the form opened?

Re: What is the real action behind a button with the event "Show Form"?

Salut TCoton, Привет Vladimir,
In your script, you can also just use our old 'friend' form1.tablegrid1.dbupdate before displaying the form (whether you are using form1.show or form1.showmodal).
Have a look at the attachment.
Derek.

Post's attachments

Attachment icon show form options.zip 337.1 kb, 84 downloads since 2023-08-19 

Re: What is the real action behind a button with the event "Show Form"?

tcoton wrote:

That answers part of the question, is there a very specific code behind the buttons so that when we use the "Show Form" action, it automatically performs a grid.dbupdate on any grid displayed on the form opened?

The button will open the form and update the contents of the table on it only if the table is already configured to display data. If the data in the table is displayed through the search button or the SQL query button, then automatic updating will not occur. In this case, you need to execute the click method for the button.

Визуальное программирование: блог и телеграм-канал.

Re: What is the real action behind a button with the event "Show Form"?

k245 wrote:

The button will open the form and update the contents of the table on it only if the table is already configured to display data. If the data in the table is displayed through the search button or the SQL query button, then automatic updating will not occur. In this case, you need to execute the click method for the button.

That I understood, hence my question: what is the code behind the button?

The picture in my first post illustrates the very same project with the very same data. The difference being, I want to use a picture as a button since the button are very limited graphically speaking.

While waiting for answers, I went for the scripted onshow dbupdate but I am still curious.

Re: What is the real action behind a button with the event "Show Form"?

Hi,
Another option might be to use the 'bscommandlink' button style. which allows you to place a button on an image without having to use any script (in the attachment, the script is solely to 'nudge' the image but is just cosmetic and not essential).
Just an idea.
Derek.

Post's attachments

Attachment icon show form options.zip 459.38 kb, 83 downloads since 2023-08-19 

Re: What is the real action behind a button with the event "Show Form"?

tcoton wrote:
k245 wrote:

The button will open the form and update the contents of the table on it only if the table is already configured to display data. If the data in the table is displayed through the search button or the SQL query button, then automatic updating will not occur. In this case, you need to execute the click method for the button.

That I understood, hence my question: what is the code behind the button?

The picture in my first post illustrates the very same project with the very same data. The difference being, I want to use a picture as a button since the button are very limited graphically speaking.

While waiting for answers, I went for the scripted onshow dbupdate but I am still curious.

The developer of this system could have answered your question more precisely, and we can only speculate )))

Визуальное программирование: блог и телеграм-канал.