Páginas

quarta-feira, 12 de agosto de 2020

DICAS 3012 - WINDEV TUTORIAL 35 - Adicionar e Modificar Janelas - CRIACAO - PARTE H



https://youtu.be/tOUFuAJnhTc


Bom Dia/Boa Tarde/Boa Noite

Esse Ao Vivo vai estrear as 11:00 do dia 24/08/2020 

DICAS 3012 - WINDEV TUTORIAL 35 - Adicionar e Modificar Janelas - CRIACAO - PARTE H
Tutoriel WINDEV : Leçon 4.2.h. Fenêtres d'ajout et de modification - Création

ASSUNTOS

BOTAO novo
  HReset(Product)
  Open(WIN_FICHA_DE_PRODUTOS)
  TableDisplay(TABLE_Product,taCurrentRecord)
BOTAO GRAVAR
  ScreenToFile()
  HSave(Product)
  Close()


Video original da Franca

https://youtu.be/LNK3C1R03Uk


Playlist Windev TUTORIAL


=======================
// btn novo
HReset(Product)
Open(WIN_FICHA_DE_PRODUTOS)
TableDisplay(TABLE_Product,taCurrentRecord)
=======================
// btn alterar
Open(WIN_FICHA_DE_PRODUTOS)
TableDisplay(TABLE_Product,taCurrentFirst)

=======================
// btn gravar
//Product.Reference = EDT_Reference
ScreenToFile()

HSave(Product)

//if Product..NewRecord=true THEN
// hadd(Product)
//else
// HModify(Product)
//END

Close()
========================












Creating a new product
The principle for creating a product is as follows:
  • In the product list window, we will add a "New" Button control that will open the "Product form" window.
  • Then, we will modify the code of "Product form" window to manage the addition into the Product data file.

Adding a Button control

  • To add a "New" Button control into "WIN_Menu":
    1. Display the "WIN_Menu" window in the editor: click the corresponding button in the open documents bar.
    2. On the "Creation" pane, in the "Usual controls" group, expand "Button" and select "New button".
    3. The shape of the control appears under the mouse pointer. Click in the window: the Button control is created.
    4. Position the Button control above the "Modify" Button control (if necessary, reposition the "Modify" Button control).
      Window interface in the editor
    5. Modify the WLanguage code of this control:
      • Right-click on the "New" Button control and select "Code" in the popup menu.
      • Write the following code in the "Click" WLanguage event:
        HReset(Product)
        Open(WIN_Product_form)
        TableDisplay(TABLE_ProducttaCurrentRecord)
        Let's study this code:
        • HReset initializes the item variables in the "Product" data file with the default values to manage a new record.
        • Open is used to open the product form to type the new record.
        • TableDisplay is used to re-display the Table control. The taCurrentRecord constant is used in this code: the Table control is re-displayed from the current record.
    6. Save the modifications by clicking Save an element among the quick access buttons.
    7. Close the code window (click X at the top right corner of code editor).

Adding a new record in the data file

  • We are now going to modify the window of product form to manage the addition of a new record.
    1. Open the "WIN_Product_form" window in the editor.
    2. We will modify the WLanguage code associated with the "OK" Button control:
      • Right-click on "OK" and select "Code" in the popup menu.
      • In the "Click" event, replace the existing WLanguage code with the following:
        ScreenToFile()
        IF Product..NewRecord THEN
        HAdd(Product)
        ELSE
        HModify(Product)
        END
        Close()
        Let's take a look at this WLanguage code:
        • ..NewRecord is used to find out whether the current record must be created.
        • If HRESET has been called previously, the property returns True (click on "New") and the record must be created by HAdd.
        • Otherwise, the current record already exists and it must be modified by HModify.
        • HAdd adds the record into the data file. This function takes the values in memory and writes the content of file items into the data file itself. The indexes are immediately and automatically updated. In this case, it is the "Product" data file that is updated.

          Remark

          The test code of new record can be replaced by HSave. This function is used to check whether the record is already found in the data file, and it allows you to add it or to modify it. The code becomes:
          ScreenToFile()
          HSave(Product)
          Close()
    3. Save the modifications by clicking Save an element among the quick access buttons.
    4. Close the code window (click X at the top right corner of code editor).




DICAS 2978 - WINDEV TUTORIAL 1 - 1.1B - WINDEV TEMA ESCURO E IDIOMA DO AMBIENTE
DICAS 2979 - WINDEV TUTORIAL 2 - 1.2- CRIAR JANELA E INSERIR TEXTO E EXIBIR
DICAS 2980 - WINDEV TUTORIAL 3 - 2.1- VARIAVEIS PARTE 1
DICAS 2981 - WINDEV TUTORIAL 4 - 2.2- VARIAVEIS ESCOPO - PARTE 2
DICAS 2982 - WINDEV TUTORIAL 5 - 2.1- VARIAVEIS OPERADORES PARTE 3
DICAS 2983 - WINDEV TUTORIAL 6 - 2.1.D - VARIAVEIS STRINGS PARTE 4
DICAS 2984 - WINDEV TUTORIAL 7 - 2.1.E - VARIAVEIS ARRAYS PARTE 5
DICAS 2985 - WINDEV TUTORIAL 8 - 2.2.A - CONDICOES IF-SWITCH PARTE 1
DICAS 2986 - WINDEV TUTORIAL 9 - 2.2.B - CONDICOES PARTE 2
DICAS 2987 - WINDEV TUTORIAL 10 - 2.3.A - LOOP PARTE 1
DICAS 2988 - WINDEV TUTORIAL 11 - 2.3.B - LOOP EXEMPLOS PARTE 2
DICAS 2989 - WINDEV TUTORIAL 12 - Lesson 2.4. The procedures - PARTE 1
DICAS 2990 - WINDEV TUTORIAL 13 - Leçon 2.4.b. Procedures Parametros - PARTE 2
DICAS 2991 - WINDEV TUTORIAL 14 - PROCEDURES REFERENCIA - PARTE 3
DICAS 2992 - WINDEV TUTORIAL 15 - PROCEDURES OPCIONAIS OU OBRIGATORIAS - PARTE 4
DICAS 2993 - WINDEV TUTORIAL 16 - PROCEDURES EXEMPLOS - PARTE 5
DICAS 2994 - WINDEV TUTORIAL 17 - PERGUNTAS E RESPOSTA - PARTE 1
DICAS 2995 - WINDEV TUTORIAL 18 - PERGUNTAS E RESPOSTA - PARTE 2
DICAS 2996 - WINDEV TUTORIAL 19 - WINDEV E OS BANCOS DE DADOS
DICAS 2997 - WINDEV TUTORIAL 20 - PROJETO E ANALISE - CRIACAO
DICAS 2998 - WINDEV TUTORIAL 21 - PROJETO E ANALISE - ARQUIVOS DADOS CLIENTE - PARTE 2
DICAS 2999 - WINDEV TUTORIAL 22 - PROJETO E ANALISE - ARQUIVOS DADOS CRIACAO ARQUIVO PEDIDO - PARTE 3
DICAS 3000 - WINDEV TUTORIAL 23 - PROJETO E ANALISE - IMPORTANDO CVS-ARQUIVO TEXTO - PARTE 4
DICAS 3001 - WINDEV TUTORIAL 24 - PROJETO E ANALISE - IMPORTANDO ARQUIVO PRODUTO - PARTE 5
DICAS 3002 - WINDEV TUTORIAL 25 - PROJETO E ANALISE - LINK - PARTE 6
DICAS 3003 - WINDEV TUTORIAL 26 - RAD COMPLETO
DICAS 3004 - WINDEV TUTORIAL 27 - VISAO GERAL
DICAS 3005 - WINDEV TUTORIAL 28 - Adicionar e Modificar Janelas PRODUTOS - PARTE A
DICAS 3006 - WINDEV TUTORIAL 29 - Adicionar e Modificar Janelas PRODUTOS Formulario - PARTE B
DICAS 3007 - WINDEV TUTORIAL 30 - Adicionar e Modificar Janelas PRODUTOS ALINHAR CAMPOS - PARTE C








Nenhum comentário:

Postar um comentário