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

Ada Discussion :

Librairie GTK pour ADA : Programme compilable et fonctionnel mais incomplet


Sujet :

Ada

  1. #1
    Membre du Club
    Homme Profil pro
    chômeur
    Inscrit en
    Septembre 2015
    Messages
    175
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : chômeur

    Informations forums :
    Inscription : Septembre 2015
    Messages : 175
    Points : 62
    Points
    62
    Par défaut Librairie GTK pour ADA : Programme compilable et fonctionnel mais incomplet
    Bonjour ,

    J'ai un code qui fonctionne bien ( voir plus bas ) .
    Mais je n'arrive pas à utiliser cette fonction =

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     function Get_Text (The_Entry : access Gtk_Entry_Record) return UTF8_String;
       --  Modify the text in the entry.
       --  The text is cut at the maximum length that was set when the entry was
       --  created.
       --  The text replaces the current contents.
    Elle est disponible pour linux dans
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    /usr/share/ada/adainclude/gtkada/gtk-gentry.ads
    Pour les autres OS , elle se trouve dans le dossier gtkada à l'endroit ou vous avez intallé la bibliothéque .

    En effet , je veux utiliser cette fonction Get_text dans mon entrée text que j'ai créer , mais je ne sais pas comment faire !!

    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
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
     
    WITH Gtk.Main ;          USE Gtk.Main ;
    WITH Gtk.Window ;        USE Gtk.Window ;
    WITH Gtk.Enums ;         USE Gtk.Enums ;
    WITH Gtk.Button ;        USE Gtk.Button ;
    WITH Gtk.Alignment ;     USE Gtk.Alignment ;
    WITH Gtk.Box ;           USE Gtk.Box ;
    WITH Gtk.Gentry;         USE Gtk.Gentry;
     
    PROCEDURE prototype IS
     
    -------------------------------
       -- VARIABLES --    |
    -----------------------------------------------------------
       win : Gtk_window ;
     
       Btn1, Btn2 ,Btn3  : Gtk_Button ;
     
       alignG, alignM ,alignD  : Gtk_Alignment ;
     
       Boite  : Gtk_VBox ;
     
       Boutons :  Gtk_HBox ;
     
       saisie : Gtk_Entry ;
     
    -----------------------------------------------------------
    BEGIN
     
       Init ;
     
    --------------------
       -- NEW --   |
    -------------------------------------------
     
       Gtk_New(win);  
     
       Gtk_New(saisie);
     
       Gtk_New(Btn1, "Bouton 1") ;
       Gtk_New(Btn2, "Bouton 2") ;
       Gtk_New(Btn3, "Bouton 3") ;
     
       Gtk_New(alignG,0.0,1.0,1.0,1.0);
       Gtk_New(alignM,0.5,1.0,1.0,1.0);
       Gtk_New(alignD,1.0,1.0,1.0,1.0);
     
      Gtk_New_VBox
      (Boite, homogeneous => false, Spacing => 0) ;
     
      Gtk_New_HBox
      (Boutons, homogeneous => false, Spacing => 0) ;
     
    --------------------------------------------
     
       Boite.Pack_Start(saisie);
       Boite.Pack_Start(Boutons);
       Boutons.Pack_Start(alignG);
       Boutons.Pack_Start(alignM);
       Boutons.Pack_Start(alignD);
     
     
    ---------------------------------
    --  Ajouts                    |
    --------------------------------------------
     
       alignG.add(Btn1) ;
       alignM.add(Btn2) ;
       alignD.add(Btn3) ;
     
       win.Add(Boite);
     
     -------------------------------------------  
     
       win.Set_Default_Size(500,500) ;  
     
       win.set_position(Win_Pos_Mouse) ;
     
       -- win.set_opacity(0.7) ;
     
       win.Show_all ;
       Main ;
     
    END prototype ;
    Help !

  2. #2
    Membre du Club
    Homme Profil pro
    chômeur
    Inscrit en
    Septembre 2015
    Messages
    175
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : chômeur

    Informations forums :
    Inscription : Septembre 2015
    Messages : 175
    Points : 62
    Points
    62
    Par défaut
    Edit=Je sais que pour avoir une réaction , il y les signaux .

    Pour l'instant , je met de coté la réaction de la fenêtre et je me concentre sur la fonction Get_text .

    J'ai modifié le code et utilisé la fonction comme ci-aprés =

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    saisie := Get_text(The_Entry => saisie);
    Donc , la variable "saisie" de type = Gtk_Entry , est bien utilisée dans la fonction .

    Mais alors POURQUOI le compilo affiche =

    prototype.adb:74:14: expected type "Gtk_Entry" defined at gtk-gentry.ads:59
    prototype.adb:74:14: found type "Standard.String"
    Compilation échouée.
    gnatmake: "prototype.adb" compilation error

    ???


    Voici le code entier aprés la modification =

    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
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    WITH Gtk.Main ;          USE Gtk.Main ;
    WITH Gtk.Window ;        USE Gtk.Window ;
    WITH Gtk.Enums ;         USE Gtk.Enums ;
    WITH Gtk.Button ;        USE Gtk.Button ;
    WITH Gtk.Alignment ;     USE Gtk.Alignment ;
    WITH Gtk.Box ;           USE Gtk.Box ;
    WITH Gtk.Gentry;         USE Gtk.Gentry;
     
    PROCEDURE prototype IS
     
    -------------------------------
       -- VARIABLES --    | 
    -----------------------------------------------------------
       win : Gtk_window ;
     
       Btn1, Btn2 ,Btn3  : Gtk_Button ;
     
       alignG, alignM ,alignD  : Gtk_Alignment ;
     
       Boite  : Gtk_VBox ;
     
       Boutons :  Gtk_HBox ;
     
       saisie : Gtk_Entry ;
     
    -----------------------------------------------------------
    BEGIN
     
       Init ; 
     
    --------------------
       -- NEW --   |
    -------------------------------------------
     
       Gtk_New(win);   
     
       Gtk_New(saisie);
     
       Gtk_New(Btn1, "Bouton 1") ; 
       Gtk_New(Btn2, "Bouton 2") ; 
       Gtk_New(Btn3, "Bouton 3") ; 
     
       Gtk_New(alignG,0.0,1.0,1.0,1.0);
       Gtk_New(alignM,0.5,1.0,1.0,1.0);
       Gtk_New(alignD,1.0,1.0,1.0,1.0);
     
      Gtk_New_VBox
      (Boite, homogeneous => false, Spacing => 0) ;
     
      Gtk_New_HBox
      (Boutons, homogeneous => false, Spacing => 0) ;
     
    --------------------------------------------
     
       Boite.Pack_Start(saisie);
       Boite.Pack_Start(Boutons);
       Boutons.Pack_Start(alignG);
       Boutons.Pack_Start(alignM);
       Boutons.Pack_Start(alignD);
     
     
    ---------------------------------
    --  Ajouts                    |
    --------------------------------------------
     
       alignG.add(Btn1) ;
       alignM.add(Btn2) ;
       alignD.add(Btn3) ;
     
       win.Add(Boite);
     
     -------------------------------------------  
     
       saisie := Get_text(The_Entry => saisie);
     
       win.Set_Default_Size(500,500) ;   
     
       win.set_position(Win_Pos_Mouse) ; 
     
       -- win.set_opacity(0.7) ;
     
       win.Show_all ; 
       Main ; 
     
    END prototype ;

  3. #3
    Membre du Club
    Homme Profil pro
    chômeur
    Inscrit en
    Septembre 2015
    Messages
    175
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : chômeur

    Informations forums :
    Inscription : Septembre 2015
    Messages : 175
    Points : 62
    Points
    62
    Par défaut
    Correction à faire=

    Déclaration de chaine vide , donc =
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    chaine : String  := "" ;
    Et utiliser la fonction avec =
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    chaine := Get_text(saisie);

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

Discussions similaires

  1. Librairies Java pour un programme d'hôtellerie
    Par maa dans le forum Général Java
    Réponses: 9
    Dernier message: 22/11/2014, 11h35
  2. Réponses: 18
    Dernier message: 29/07/2010, 23h57
  3. Réponses: 2
    Dernier message: 05/06/2007, 13h49
  4. librairie GTK pour code::blocks
    Par teddy42 dans le forum Code::Blocks
    Réponses: 6
    Dernier message: 25/10/2006, 19h47
  5. Ajouter des librairies externes pour la compilation en C++
    Par Roming22 dans le forum Eclipse Java
    Réponses: 2
    Dernier message: 11/07/2005, 10h15

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