sexta-feira, 14 de agosto de 2020

DICAS 3019 - WINDEV TUTORIAL 42 - Pesquisa Simples - Navegacao pelos Arquivos - PARTE F



https://youtu.be/vvc0-KmjV-4


Bom Dia/Boa Tarde/Boa Noite

Esse Ao Vivo vai estrear as 19:00 do dia 25/08/2020 

DICAS 3019 - WINDEV TUTORIAL 42 - Pesquisa Simples - Navegacao pelos Arquivos - PARTE F
Tutoriel WINDEV : Leçon 4.3.f. Recherche simple - Parcours des fiches


ASSUNTOS

EXPLICANDO O QUE SERA FEITO
CRIANDO BOTAO PRIMEIRO
ACERTANDO LARGURA IGUAL A ALTURA 
COMANDOS UTILIZADOS
FAZENDO O CODIGO DO PRIMEIRO CLIENTE
   HReadFirst
   HOut
   FileToScreen
FAZENDO O CODIGO DO CLIENTE ANTERIOR
   HReadLast
   HReadPrevious
FAZENDO O CODIGO DO PROXIMO CLIENTE
   HReadFirst
   HReadNext
FAZENDO O ULTIMO CLIENTE   
   HReadLast
   

Video original da Franca

https://youtu.be/y4OfwgxgdcI


Playlist Windev TUTORIAL

// btn_pesquisa_identica
// Encontra o cliente a partir de seu identificador
HReadSeekFirst(Customer_cliente,CustomerID,COMBO_cliente)
IF HFound(Customer_cliente) THEN
// mostrar os dados
FileToScreen()
END
===============================
// BTN PESQUISA GENERICA
// Finds a customer from his name
// Encontra um cliente a partir de seu nome
HReadSeek(Customer_cliente,FullName,EDT_Nome_Procure)
IF HFound(Customer_cliente) THEN
// mostre os dados
FileToScreen()
ELSE
Error("nao encontrado")
END
===============================
// BTN_PRIMEIRO
// Le o primeiro Cliente // Reads the first customer
HReadFirst(Customer_cliente)
IF HOut(Customer_cliente) = True THEN
Info("NAO TEM DADOS")
ELSE
FileToScreen()
END
===============================
// BTN_ANTERIOR 
// If no search is in progress
// Se nenhuma pesquisa estiver em andamento
IF HOut(Customer_cliente) THEN
HReadLast(Customer_cliente) // le o ultimo cliente
END
HReadPrevious(Customer_cliente) // le o cliente anterior
IF HOut(Customer_cliente)=True THEN 
Info("inicio do arquivo de dados alcancado")
ELSE
FileToScreen() // vamos mostrar os dados nos edt
END
===============================

//BTN_PROXIMO
// If no search is in progress
// Se nenhuma pesquisa estiver em andamento
IF HOut(Customer_cliente) THEN
    HReadFirst(Customer_cliente) // Lê o primeiro cliente
END
HReadNext(Customer_cliente) // Le o próximo cliente
// Se o final do arquivo de dados for alcançado
IF HOut(Customer_cliente)=True THEN
Info("FIM DO ARQUIVO ALCANCADO")
ELSE
FileToScreen() //MOSTRA OS DADOS
END
===============================
// BTN_FINAL
// Reads the last customer
// LER O CLIENTE FINAL
HReadLast(Customer_cliente)
IF HOut(Customer_cliente)=True THEN
Info("NAO ENCONTRADO CLIENTE")
ELSE
FileToScreen()
END










Browsing forms

We are now going to add four Button controls to browse the different records of the "Customer" data file. These controls are in a "recorder" layout.
Recorder buttons
These controls will allow you to:
  • browse through the different records in the data file,
  • browse through all the records corresponding to a generic search.
They include an icon and they are used to display:
  • the first record,
  • the previous record,
  • the next record,
  • the last record.
  • To create the Button control used to display the first file record:
    1. If necessary, display the "Finding customers" Tab control pane in the editor.
    2. On the "Creation" pane, in the "Usual controls" group, click Create a Button control.
    3. The shape of the control appears under the mouse pointer. Then click the Tab control pane, below "Generic search". The Button control is automatically created.
  • A skin template will be used to standardize the interface of project windows. This skin template defines the style for all controls found in the windows. A specific style is defined for each recorder Button control. To apply this style:
    1. Select the Button control if necessary.
    2. Display the popup menu (right mouse click) and select "Choose a style".
    3. All styles defined for the buttons are displayed in the window.
      Control style
      Select "BTN_First".
    4. Validate.
  • Modify the name of the Button control:
    1. Open the control description window:
      • Select the Button control.
      • Display the popup menu (right mouse click) and select "Description".
    2. This control is named "BTN_First".
    3. Validate the description window.
  • We are now going to type the WLanguage code associated with this control:
    1. Right-click the control. Select "Code" from the menu that is displayed.
    2. In the code window that appears, write the following WLanguage code in the "Click" event:
      // Reads the first customer
      HReadFirst(Customer)
      IF HOut(Customer) = True THEN
      // No customer
      Info("No form to view.")
      ELSE
      // Displays the customer data
      FileToScreen()
      END
      HReadFirst is used to read the first file record according to the key used for the last search (FullName in our case).
  • Likewise, create 3 Button controls.
    • The names of these controls are: "BTN_Previous", "BTN_Next" and "BTN_Last".
    • These controls are respectively associated with the styles: "BTN_Previous", "BTN_Next" and "BTN_Last".
    • The WLanguage code corresponding to the "Click" event of "BTN_Previous" is:
      // If no search is in progress
      IF HOut(Customer) THEN
      // Reads the last customer
      HReadLast(Customer)
      END
       
      // Reads the previous customer
      HReadPrevious(Customer)
      // If the start of the data file is reached
      IF HOut(Customer) = True THEN
      Info ("Start of data file reached.")
      ELSE
      // Displays the customer data
      FileToScreen()
      END
    • The WLanguage code corresponding to the "Click" event of "BTN_Next" is:
      // If no search is in progress
      IF HOut(Customer) THEN
      // Reads the first customer
      HReadFirst(Customer)
      END
       
      // Reads the next customer
      HReadNext(Customer)
      // If the end of the data file is reached
      IF HOut(Customer) = True THEN
      Info("End of data file reached.")
      ELSE
      // Displays the customer data
      FileToScreen()
      END
    • The WLanguage code corresponding to the "Click" event of "BTN_Last" is:
      // Reads the last customer
      HReadLast(Customer)
      IF HOut(Customer) = True THEN
      // No customer
      Info("No form to view.")
      ELSE
      // Displays the customer data
      FileToScreen()
      END
    In these different codes:
    • HReadLast is used to read the last file record according to the key used for the last search.
    • HReadNext reads the record whose key value is immediately greater than the one of current record.
    • HReadPrevious reads the record whose key value is immediately less than the one of current record.
    In any case:
    • HOut is used to find out whether the data file is empty.
    • FileToScreen is used to display the record on the screen.

Remark

The code in the "Next" and "Previous" Button controls contains additional lines of code to:
  • Check whether a search was already performed in the Customer data file (test of HOut to find out whether the file reading has started).
  • Read the first or last record if necessary. Indeed, the next or previous record cannot be read if no reading was performed in the data file.
  • Save the window by clicking Save an element among the quick access buttons.

Window test

  • Let's run a window test:
    1. Run the window test ( Run the window test among the quick access buttons).
    2. Click the "Finding customers" tab pane if necessary.
    3. Find a customer (perform a generic search on "BEEF" for example).
    4. Browse the data file by clicking each one of the browse buttons.
    5. Stop the test to go back to the 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

Teste

Teste
teste