Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1608 connectés 

  FORUM HardWare.fr
  Programmation
  Ada

  Interface graphique en ADA

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Interface graphique en ADA

n°1287360
Neodyme02
Posté le 19-01-2006 à 11:21:42  profilanswer
 

Voila, j'aimerais bien pouvoir faire des interface graphique avec ADA. Je sait qu'il existe Adagraph et GTKada mais je n'arrive pas a installer, Ni l'un ni l'autre. :??:

mood
Publicité
Posté le 19-01-2006 à 11:21:42  profilanswer
 

n°1287494
Neodyme02
Posté le 19-01-2006 à 13:35:50  profilanswer
 

J'oubliait, j'ai windowx XP et j'ai installer Adagide qui marche sans problème avec le compilateur GNAT3.15.

n°1289475
Fused
Posté le 22-01-2006 à 15:43:51  profilanswer
 

C'est parfait, ça, si tu sais utiliser les packages, télécharge le package jwel.
 
Tu trouvera facilement sur mister Google,
 
Par ailleurs, ton sujet avait déjà été traité ici, fais une p'tite recherche avant la prochaine fois ;)
 
Le sujet ici

n°1289775
Neodyme02
Posté le 22-01-2006 à 23:19:33  profilanswer
 

Non mais en fait, j'aimerais bien trouver quelqu'un qui puisse m'expliquer clairement, parce que je suis mauvais, comment on installe tout ca et comment on s'en sert avec adagide.

n°1289784
Fused
Posté le 22-01-2006 à 23:26:20  profilanswer
 

Clairement il n'y a rien à installer, tu dois tout d'abord te procurer le package jwel, ce sont des fichiers .ada, .adb ...
 
Ce sont des procédures et des types déjà écrit, tu les utilisera juste comme tu utilise la fonction: put("bonjour" ) par exemple.
 
La fonction put est dans le package ada.text_io; que tu appelle au début de tes programmes en général je suppose.
 
La ça sera pareil, tu mettra un use ada.jwel ou un truc comme ça et dans ton code tu appelera des fonctions de ce package.
 
Jusque là tu comprends?
 
Sais tu utiliser des packages?

n°1290115
Neodyme02
Posté le 23-01-2006 à 15:04:18  profilanswer
 

Oui oui oui, jusque la, il y a pas de problème. Je sait qu'il faut donner les packet au début d'un programme.
 
Donc, la, j'ai telecharger le derniere version de jewl (la1.6).
 
Dans le zip, il y a des exemples. mais quand j'essaye de compiler, il me dis qu'il trouve pas le fichier jewl.ads
 
alors du coup, j'ai regarder un peu ce que j'avait dans l'archive et j'ai vu qu'il y avait un dossier source et dans ce dossier, il y avait le truc jewl.ads.
Alors je l'ai copier dans le repertoire ou était enregistrer l'exemple. Et la, MIRACLE, il a compiller !!!!!!!
 
Donc, j'ai essayer de faire build, mais la, c le compilateur (soit GNAT) qui râââââle, il dis qu'il trouve pas le fichier jewl.adb, il met :gnatmake:"jewl.adb" not found.
 
Je sait, qu'il existe une commande gnatmake qu'on peut utiliser avec l'invité de commande. C'est peut etre ca...

n°1290569
Fused
Posté le 23-01-2006 à 23:22:13  profilanswer
 

Décompresse toute ton archive dans un dossier avec tous ces fichiers sinon il va gueuler à chaque fois que tu vas appeler un fichier différent.
 
Si la compilation marche il n'y a pas de raisons que la construction ne fonctionne pas...
 
Sert toi des exemples après pour utiliser les fonction de jewel :)
Ca devrait t'avancer pas mal ça.

n°1290617
Neodyme02
Posté le 24-01-2006 à 00:49:45  profilanswer
 

Non mais le problème c'est que meme les exemples, j'arrive pas a les construire !!! En plus, il demande le fichier jew.adb mais je le trouve pas

n°1291221
Fused
Posté le 24-01-2006 à 17:54:21  profilanswer
 

Euh... c'est bizarre, peut être que ton archive est imcomplète.
 
Télécharge une autre version pour voir, des fois ça vient de pas grand chose ;)

n°1291328
Neodyme02
Posté le 24-01-2006 à 20:08:44  profilanswer
 

uéééééééééééé ca marche. J'ai fait un gnatmake dans l'invité de commande sur jewel-io.adb et ca a marcher !!!

mood
Publicité
Posté le 24-01-2006 à 20:08:44  profilanswer
 

n°1291671
Fused
Posté le 25-01-2006 à 10:21:08  profilanswer
 

Ok! ben c'est bien comme ça alors :)
 
J'ai un petit exemple d'un programme de simulation d'un jeu de belote (rien de bien merveilleux qu'on nous avait demandé de faire).
Recopie le et execute le, ça peut te donner une idée du genre de trucs de base qu'on peut faire, désolé mais il est pas commenté, je pense que tu comprendra :)
C'est un pote qui l'a écrit.
 

Code :
  1. with Jewl.Simple_Windows;
  2. use  Jewl.Simple_Windows;
  3. with Jewl.Io; use Jewl.Io;
  4. procedure Belotejwl is
  5.    
  6.    Bienvenue_Casse : Font_Type := Font("Time new Roman",16, True, False);
  7.    version_casse : font_type := font("Comic sans MS", 8, false, true);
  8.    Bienvenue : Dialog_Type := Dialog(230,200,"Bienvenue", 'B');
  9.    Welcome : Label_type := Label(Bienvenue, (10,10), 200, 230, "Bienvenue dans le programme Belote", center, bienvenue_casse);
  10.    Start : Button_Type := Button(Bienvenue, (10,100), 200, 60, "Commencer", 'S');
  11.    Version : Label_Type := Label(Bienvenue, (10, 70), 200, 20, "Version 0.1 beta.", Center, Version_Casse);
  12.  
  13.    Ask_atout : Dialog_Type := Dialog(230,200,"Atout", 'A');
  14.    Ask_atout_label : Label_type := Label(Ask_atout, (10,10), 200, 230, "Quel est l'atout de la partie ?", center);
  15.    Valider : Button_Type := Button(Ask_atout, (10,100), 200, 60, "Valider", 'V');
  16.    My_Frame : Frame_Type  := Frame(230, 580, "Belote", 'Q');
  17.  
  18.    Carte1 : Label_type := Label(My_Frame, (10,10), 100, 400, "Carte 1" );
  19.    Coul1 : Combobox_type := Combobox(My_Frame, (10,30), 200, false);
  20.    Haut1 : Combobox_Type := Combobox(My_Frame, (10,60), 200, false);
  21.  
  22.    Carte2 : Label_type := Label(My_Frame, (10,100),100, 400, "Carte 2" );
  23.    Coul2 : Combobox_type := Combobox(My_Frame, (10,120), 200, false);
  24.    Haut2 : Combobox_Type := Combobox(My_Frame, (10,150), 200, False);
  25.  
  26.    Carte3 : Label_type := Label(My_Frame, (10,190), 100, 400, "Carte 3" );
  27.    Coul3 : Combobox_type := Combobox(My_Frame, (10,210), 200, false);
  28.    Haut3 : Combobox_Type := Combobox(My_Frame, (10,240), 200, False);
  29.  
  30.    Carte4 : Label_type := Label(My_Frame, (10,280), 100, 400, "Carte 4" );
  31.    Coul4 : Combobox_type := Combobox(My_Frame, (10,300), 200, false);
  32.    Haut4 : Combobox_Type := Combobox(My_Frame, (10,330), 200, False);
  33.  
  34.    Atout_label : Label_type := Label(My_Frame, (10,380), 100, 400, "Atout de la partie" );
  35.    Atout : Combobox_type := Combobox(My_Frame, (10,400), 200, false);
  36.  
  37.    Calculer : Button_Type := Button(My_Frame, (10,440), 200, 100, "Calculer les points", 'C');
  38.  
  39.    Points : Integer;
  40.  
  41. -- ------------------------------------------------- OK --
  42.    function Ok return Boolean is
  43.      
  44.       Pas_Double : Boolean:=true;
  45.    
  46.    begin
  47.       if (Get_Line(Coul1)=Get_Line(Coul2) and Get_Line(Haut1)=Get_Line(Haut2))
  48.             or (Get_Line(Coul1)=Get_Line(Coul3) and Get_Line(Haut1)=Get_Line(Haut3))
  49.             or (Get_Line(Coul1)=Get_Line(Coul4) and Get_Line(Haut1)=Get_Line(Haut4))
  50.             or (Get_Line(Coul2)=Get_Line(Coul3) and Get_Line(Haut2)=Get_Line(Haut3))
  51.             or (Get_Line(Coul2)=Get_Line(Coul4) and Get_Line(Haut2)=Get_Line(Haut4))
  52.             or (Get_Line(Coul3)=Get_Line(Coul4) and Get_Line(Haut3)=Get_Line(Haut4))
  53.                 then pas_double:=false; end if;
  54.       return Pas_double;
  55.    end;
  56. -- -------------------------------------------------------   
  57. -- ---------------------------------------------- REMPLI --
  58.    function Rempli return Boolean is
  59.      
  60.       rempli : Boolean:=true;
  61.    
  62.    begin
  63.       if Get_Line(Coul1)=0 or Get_Line(Coul2)=0 or Get_Line(Coul3)=0 or Get_Line(Coul4)=0
  64.          or get_line(Haut1)=0 or get_line(Haut2)=0 or get_line(Haut3)=0 or get_line(Haut4)=0 
  65.          then rempli:=false;
  66.       end if;
  67.       return Rempli;
  68.    end;
  69. -- ------------------------------------------------------- 
  70.    
  71. -- -------------------------------------------- CALCULE --
  72.    procedure Calcule is
  73.      
  74.    begin
  75.       Points:=0;
  76.      
  77.       case Get_line(Haut1) is
  78.          when 8 => points:=points+11;
  79.          when 7 => points:=points+4;
  80.          when 6 => points:=points+3;
  81.          when 5 => if Get_line(coul1)=Get_line(Atout) then points:=points+20; else points:=points+2; end if;
  82.          when 4 => points:=points+10;
  83.          when 3 => if Get_line(Coul1)=Get_line(Atout) then points:=points+14; else points:=points+0; end if;
  84.          when others => points:=points+0;
  85.       end case;
  86.      
  87.       case Get_line(Haut2) is
  88.          when 8 => points:=points+11;
  89.          when 7 => points:=points+4;
  90.          when 6 => points:=points+3;
  91.          when 5 => if Get_line(coul2)=Get_line(Atout) then points:=points+20; else points:=points+2; end if;
  92.          when 4 => points:=points+10;
  93.          when 3 => if Get_line(Coul2)=Get_line(Atout) then points:=points+14; else points:=points+0; end if;
  94.          when others => points:=points+0;
  95.       end case;
  96.      
  97.       case Get_line(Haut3) is
  98.          when 8 => points:=points+11;
  99.          when 7 => points:=points+4;
  100.          when 6 => points:=points+3;
  101.          when 5 => if Get_line(coul3)=Get_line(Atout) then points:=points+20; else points:=points+2; end if;
  102.          when 4 => points:=points+10;
  103.          when 3 => if Get_line(Coul3)=Get_line(Atout) then points:=points+14; else points:=points+0; end if;
  104.          when others => points:=points+0;
  105.       end case;
  106.      
  107.       case Get_line(Haut4) is
  108.          when 8 => points:=points+11;
  109.          when 7 => points:=points+4;
  110.          when 6 => points:=points+3;
  111.          when 5 => if Get_line(coul4)=Get_line(Atout) then points:=points+20; else points:=points+2; end if;
  112.          when 4 => points:=points+10;
  113.          when 3 => if Get_line(Coul4)=Get_line(Atout) then points:=points+14; else points:=points+0; end if;
  114.          when others => points:=points+0;
  115.       end case;
  116.      
  117.       Message("Cette main vaut un total de " &Points &" points." );
  118.    end;
  119. -- ------------------------------------------------------- 
  120. begin
  121.  
  122. -- ---------------------------------------- INITIALISATIONS --
  123.    Set_Text(Coul1, "Carreau" );
  124.    Set_Text(Coul1, "Coeur" );
  125.    Set_Text(Coul1, "Pique" );
  126.    Set_Text(Coul1, "Trèfle" );
  127.  
  128.    Set_Text(Haut1, "7" );
  129.    Set_Text(Haut1, "8" );
  130.    Set_Text(Haut1, "9" );
  131.    Set_Text(Haut1, "10" );
  132.    Set_Text(Haut1, "Valet" );
  133.    Set_Text(Haut1, "Dame" );
  134.    Set_Text(Haut1, "Roi" );
  135.    Set_Text(Haut1, "As" );
  136.  
  137.    Set_Text(Coul2, "Carreau" );
  138.    Set_Text(Coul2, "Coeur" );
  139.    Set_Text(Coul2, "Pique" );
  140.    Set_Text(Coul2, "Trèfle" );
  141.  
  142.    Set_Text(Haut2, "7" );
  143.    Set_Text(Haut2, "8" );
  144.    Set_Text(Haut2, "9" );
  145.    Set_Text(Haut2, "10" );
  146.    Set_Text(Haut2, "Valet" );
  147.    Set_Text(Haut2, "Dame" );
  148.    Set_Text(Haut2, "Roi" );
  149.    Set_Text(Haut2, "As" );
  150.  
  151.    Set_Text(Coul3, "Carreau" );
  152.    Set_Text(Coul3, "Coeur" );
  153.    Set_Text(Coul3, "Pique" );
  154.    Set_Text(Coul3, "Trèfle" );
  155.    Set_Text(Haut3, "7" );
  156.    Set_Text(Haut3, "8" );
  157.    Set_Text(Haut3, "9" );
  158.    Set_Text(Haut3, "10" );
  159.    Set_Text(Haut3, "Valet" );
  160.    Set_Text(Haut3, "Dame" );
  161.    Set_Text(Haut3, "Roi" );
  162.    Set_Text(Haut3, "As" );
  163.  
  164.    Set_Text(Coul4, "Carreau" );
  165.    Set_Text(Coul4, "Coeur" );
  166.    Set_Text(Coul4, "Pique" );
  167.    Set_Text(Coul4, "Trèfle" );
  168.  
  169.    Set_Text(Haut4, "7" );
  170.    Set_Text(Haut4, "8" );
  171.    Set_Text(Haut4, "9" );
  172.    Set_Text(Haut4, "10" );
  173.    Set_Text(Haut4, "Valet" );
  174.    Set_Text(Haut4, "Dame" );
  175.    Set_Text(Haut4, "Roi" );
  176.    Set_Text(Haut4, "As" );
  177.  
  178.    Set_Text(Atout, "Carreau" );
  179.    Set_Text(Atout, "Coeur" );
  180.    Set_Text(Atout, "Pique" );
  181.    Set_Text(Atout, "Trèfle" );
  182. -- --------------------------------------------------------- BIENVENUE --
  183.    Show(Bienvenue, true);
  184.    if next_command='S' then show(bienvenue, false); end if;
  185.    -- ---------------------------------------------------------
  186.  
  187.  
  188.    loop
  189.       case Next_Command is
  190.          when 'Q' => exit;
  191.          when 'C' => if Ok then
  192.                if Rempli then Calcule;
  193.                else Error("Vous n'avez pas rempli tous les champs !" );
  194.                end if;
  195.             else Error("Vous avez rentré deux fois la même carte !" );
  196.             end if;
  197.          when others => null;
  198.       end case;
  199.    end loop;
  200. end;

n°1291672
Fused
Posté le 25-01-2006 à 10:23:52  profilanswer
 

Euh si il ne s'execute pas àpres le message d'intro, modifie "true" par un "false" dans:
 
-- ----------------------------- BIENVENUE --
Show(Bienvenue, true);
if next_command='S' then show(bienvenue, false);
end if;
-- ------------------------------------------
 
   :hello:

n°1292201
Neodyme02
Posté le 25-01-2006 à 19:16:18  profilanswer
 

Ah ui merci!!! justement je cherchait des petits exemples pour comprendre un peu le truc.

n°1328352
bisbo
Posté le 19-03-2006 à 17:39:25  profilanswer
 

salut! Neodyme02
 
maintenant t'es dejà un pro pour l'utilisation de la bibliotheque graphique Jewl, veux tu me donner des explications
je viens de telecharger jewl que j'ai installé sur ma machine, Je voudrais programmer le sudoku sur Ada avec un bon graphisme.
 
dis moi .


Message édité par bisbo le 19-03-2006 à 19:38:01
n°1328367
Fused
Posté le 19-03-2006 à 18:12:35  profilanswer
 

lol bisbo tu me demande de l'aide et quand je te répond ça me met que tu m'as mis en ignore liste!


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Ada

  Interface graphique en ADA

 

Sujets relatifs
Une interface globale?[turbo pascal] readkey et mode graphique
Graphique inchangeantFiger un graphique un peu trop éphémère...(Résolu)
Accéder à un component graphique depuis un server .net remoting.[resolu] pb créer graphique
Librairie graphique pour jeu de voiture (linux)[Résolu]Interface marqueur
Projet open source d'un navigateur web en Ada+GtkAda+awsquestion interface graphique
Plus de sujets relatifs à : Interface graphique en ADA


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR