IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Delphi Discussion :

DBLookupComboBox1 et DBNavigator1


Sujet :

Delphi

  1. #1
    Nouveau membre du Club
    Femme Profil pro
    Auditeur informatique
    Inscrit en
    Février 2019
    Messages
    53
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 25
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Auditeur informatique
    Secteur : Biens de consommation

    Informations forums :
    Inscription : Février 2019
    Messages : 53
    Points : 37
    Points
    37
    Par défaut DBLookupComboBox1 et DBNavigator1
    Bonjour tout le monde;

    J'espère vous allez bien

    Ma question aujourd'hui, J'utilise DBLookupComboBox comme liste déroulante pour afficher les désignation(Nom) du produit mais mon souci et que ça marche pas avec DBNavigator !! J aimerai savoir si il y a un moyen de les lier ensemble ou éventuellement une autre méthode de procéder

    Merci

  2. #2
    Rédacteur/Modérateur

    Avatar de SergioMaster
    Homme Profil pro
    Développeur informatique retraité
    Inscrit en
    Janvier 2007
    Messages
    15 036
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 67
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Janvier 2007
    Messages : 15 036
    Points : 40 941
    Points
    40 941
    Billets dans le blog
    62
    Par défaut
    Bonjour,

    ce n'est pas prévu pour ça non plus !
    Mais il y a toujours moyen de faire un truc en utilisant les évènements du navigateur
    Nom : Capture.PNG
Affichages : 185
Taille : 4,7 Ko
    code
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    unit Unit42;
     
    interface
     
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, FireDAC.Stan.Intf, FireDAC.Stan.Option,
      FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,
      FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.FB,
      FireDAC.Phys.FBDef, FireDAC.VCLUI.Wait, FireDAC.Stan.Param, FireDAC.DatS,
      FireDAC.DApt.Intf, FireDAC.DApt, Data.DB, FireDAC.Comp.DataSet,
      FireDAC.Comp.Client, Vcl.DBCtrls, Vcl.ExtCtrls;
     
    type
      TForm42 = class(TForm)
        DataSource1: TDataSource;
        DBNavigator1: TDBNavigator;
        DBLookupComboBox1: TDBLookupComboBox;
        FDConnection1: TFDConnection;
        FDTable1: TFDTable;
        procedure DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
      private
        { Déclarations privées }
      public
        { Déclarations publiques }
      end;
     
    var
      Form42: TForm42;
     
    implementation
     
    {$R *.dfm}
     
    procedure TForm42.DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
    begin
    case Button of
      nbFirst,
      nbPrior,
      nbNext ,
      nbLast: DBLookupComboBox1.KeyValue:=FDTable1.FieldByName(DBLookupComboBox1.KeyField).Value;
      else FDTable1.Cancel;
    end;
    end;
     
    end.
    dfm
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
     
    object Form42: TForm42
      Left = 0
      Top = 0
      Caption = 'Form42'
      ClientHeight = 242
      ClientWidth = 527
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      OldCreateOrder = False
      PixelsPerInch = 96
      TextHeight = 13
      object DBNavigator1: TDBNavigator
        Left = 48
        Top = 46
        Width = 144
        Height = 25
        DataSource = DataSource1
        VisibleButtons = [nbFirst, nbPrior, nbNext, nbLast]
        TabOrder = 0
        OnClick = DBNavigator1Click
      end
      object DBLookupComboBox1: TDBLookupComboBox
        Left = 48
        Top = 72
        Width = 145
        Height = 21
        KeyField = 'COUNTRY'
        ListField = 'COUNTRY;CURRENCY'
        ListSource = DataSource1
        TabOrder = 1
      end
      object DataSource1: TDataSource
        DataSet = FDTable1
        Left = 408
        Top = 88
      end
      object FDConnection1: TFDConnection
        Params.Strings = (
          'Database=Employee'
          'User_Name=SYSDBA'
          'Password=masterkey'
          'DriverID=FB')
        Connected = True
        LoginPrompt = False
        Left = 328
        Top = 24
      end
      object FDTable1: TFDTable
        Active = True
        IndexFieldNames = 'COUNTRY'
        Connection = FDConnection1
        UpdateOptions.UpdateTableName = 'COUNTRY'
        TableName = 'COUNTRY'
        Left = 408
        Top = 24
      end
    end
    MVP Embarcadero
    Delphi installés : D3,D7,D2010,XE4,XE7,D10 (Rio, Sidney), D11 (Alexandria), D12 (Athènes)
    SGBD : Firebird 2.5, 3, SQLite
    générateurs États : FastReport, Rave, QuickReport
    OS : Window Vista, Windows 10, Windows 11, Ubuntu, Androïd

  3. #3
    Nouveau membre du Club
    Femme Profil pro
    Auditeur informatique
    Inscrit en
    Février 2019
    Messages
    53
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 25
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Auditeur informatique
    Secteur : Biens de consommation

    Informations forums :
    Inscription : Février 2019
    Messages : 53
    Points : 37
    Points
    37
    Par défaut
    Citation Envoyé par SergioMaster Voir le message
    Bonjour,


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    procedure TForm42.DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
    begin
    case Button of
      nbFirst,
      nbPrior,
      nbNext ,
      nbLast: DBLookupComboBox1.KeyValue:=FDTable1.FieldByName(DBLookupComboBox1.KeyField).Value;
      else FDTable1.Cancel;
    end;
    end;
    Merci Sergio pour votre réponse rapide
    J'ai testé ce code et ça marche très bien !!

    Problème résolu

  4. #4
    Rédacteur/Modérateur

    Avatar de SergioMaster
    Homme Profil pro
    Développeur informatique retraité
    Inscrit en
    Janvier 2007
    Messages
    15 036
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 67
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Janvier 2007
    Messages : 15 036
    Points : 40 941
    Points
    40 941
    Billets dans le blog
    62
    Par défaut
    Encore une fois, un sur mon message plutôt qu'une citation
    MVP Embarcadero
    Delphi installés : D3,D7,D2010,XE4,XE7,D10 (Rio, Sidney), D11 (Alexandria), D12 (Athènes)
    SGBD : Firebird 2.5, 3, SQLite
    générateurs États : FastReport, Rave, QuickReport
    OS : Window Vista, Windows 10, Windows 11, Ubuntu, Androïd

  5. #5
    Nouveau membre du Club
    Femme Profil pro
    Auditeur informatique
    Inscrit en
    Février 2019
    Messages
    53
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 25
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Auditeur informatique
    Secteur : Biens de consommation

    Informations forums :
    Inscription : Février 2019
    Messages : 53
    Points : 37
    Points
    37
    Par défaut
    Ça marche un grand 👍

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. DBLookupComboBox1 et grid
    Par looping dans le forum Bases de données
    Réponses: 1
    Dernier message: 18/10/2008, 10h18
  2. Transformer ListBox1 en DBLookupComboBox1
    Par yanba dans le forum Bases de données
    Réponses: 8
    Dernier message: 24/02/2006, 17h13

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo