segunda-feira, 3 de agosto de 2020

DICAS 2993 - WINDEV TUTORIAL 16 - PROCEDURES EXEMPLOS - PARTE 5



https://youtu.be/L4ngEc2ToMw


Esse Ao Vivo vai estrear as 20:00 do dia 07/09/2020 SEGUNDA


Bom Dia/Boa Tarde/Boa Noite

DICAS 2993 - WINDEV TUTORIAL 16 - PROCEDURES EXEMPLOS - PARTE 5
Tutoriel WINDEV : Leçon 2.4.e. Procédures - Exemples

ASSUNTOS

Criando Janela nova procedure exemplos
Criando os edt, o  combox e o botao calcula
vamos fazer o codigo de calcula
simplificando o codigo com procedure

https://windevdesenvolvimento.blogspot.com/2020/08/dicas-2993-windev-tutorial-16.html
https://youtu.be/L4ngEc2ToMw

https://doc.windev.com/en-US/?1410087517&name=lesson_24_the_procedures

Video original da Franca

https://youtu.be/ttK7eNy5-DE


Playlist Windev TUTORIAL
https://www.youtube.com/playlist?list=PLwJwZaqiZW-lxU1XF0M0htb5S5f8pavuE













Creating and using a procedure
  • To create the procedure for calculating the amount IOT:
    1. Click the window background.
    2. Display the events associated with the window (F2).
    3. In the code editor, on the "Code" pane in the ribbon, in the "Procedures" group, expand "New" and select "New local procedure".
    4. In the window that is displayed, type the name of local procedure ("Calc_IOT") and validate ("Add" button).
    5. The new procedure local to the window is automatically created and its code is displayed in the code editor.
    6. Write the following WLanguage code:
      PROCEDURE Calc_IOT(PriceBTVATRate)
      cyIOT is currency
      cyIOT = PriceBT * (1 + VATRate/100)
      RESULT cyIOT
      Let's take a look at this WLanguage code:
      • The Calc_IOT procedure expects 2 parameters: the price before tax and the VAT rate.
      • This procedure declares a currency variable. This variable is used to store the calculated price IOT.
      • This procedure calculates the price IOT and returns the calculated value.
    7. Close the code window (click X at the top right corner of code editor).
Remark
When creating a procedure, comments are automatically generated BEFORE the procedure code. These comments are mainly used to specify the content of parameters and return value.
It is important to fill these comments. Indeed, they will be automatically displayed in a tooltip when typing the call to the procedure in the code editor.

  • Let's now call the procedure from the calculation Button control.
    1. Select the "Calculate" Button control.
    2. Display the events associated with the Button control (press F2, for example).
    3. In the "Click" event, replace the existing code with the following code:
      SWITCH COMBO_VAT..DisplayedValue
      // 5.5 %
      CASE 5.5
      EDT_PriceIOT = Calc_IOT(EDT_PriceBT5.5)
      // 10 %
      CASE 10
      EDT_PriceIOT = Calc_IOT(EDT_PriceBT10)
      // 20 %
      CASE 20
      EDT_PriceIOT = Calc_IOT(EDT_PriceBT20)
      END
      This code calls the Calc_IOT procedure to calculate the amount IOT. Two parameters are passed to the procedure: the price BT and the VAT rate. The result returned by the procedure is assigned to the EDT_PriceIOT control.
    4. Close the code window (click X at the top right corner of code editor).
  • Let's now run the window test:
    1. Run the window test ( Run the test of a window among the quick access buttons). Give a price BT. Select the different values in the Combo Box control and click "Calculate".
    2. The amount IOT is displayed.
    3. Close the test window.



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








Nenhum comentário:

Postar um comentário

Teste

Teste
teste