Page 1 sur 2

comment ça marche les variables numerique svp .

Publié : dim. 13/nov./2005 22:09
par bernard13
desoler personne ne m'aime , je posterai plus de code

tous le monde me deteste ici .

adieu

Publié : dim. 13/nov./2005 22:12
par Chris
Rien à cirer des variables numériques :twisted:

Publié : dim. 13/nov./2005 22:37
par bernard13
pourquoi ?

explique

Publié : dim. 13/nov./2005 22:38
par Backup
Chris a écrit :Rien à cirer des variables numériques :twisted:
:lol: :lol: :lol: :lol: :lol: :lol: :lol:

Publié : dim. 13/nov./2005 22:39
par Chris
T'as la mémoire courte, mon bonhomme.

Vas donc faire un tour dans tes derniers posts en "Hors Sujet", histoire de te rafraichir la mémoire.

Publié : dim. 13/nov./2005 22:43
par bernard13
et alors je dis que ce que je pense

Publié : dim. 13/nov./2005 22:45
par Chris
Ouais...
Et ben moi aussi :x

Publié : dim. 13/nov./2005 22:47
par bernard13
arrete un peu
aide moi svp chris

Publié : dim. 13/nov./2005 22:48
par Chris
Un jour....
peut-être....

Publié : dim. 13/nov./2005 23:14
par bernard13
tu es pas sympas #cul

Publié : lun. 14/nov./2005 5:56
par Anonyme2
Bernard13, je ne comprend pas ta question

tu veux savoir quoi ?

Publié : lun. 14/nov./2005 8:34
par bernard13
je veux savoir comment ca marche les variables numerique

Publié : lun. 14/nov./2005 10:10
par lionel_om
cad ? explain !!!
Pose une vraie question !

Publié : lun. 14/nov./2005 10:35
par bernard13
MON problemes est :

si je calcule carte bleu+carte rouge le programme me marque 18
exemple si je rentre 1 + 1 ca marque 18

qui peux m'aider a resoudre le probleme
svp merci

Code : Tout sélectionner


;exemple d'un bon de commande 

; constante de la fenetre et des gadgets 
;
Enumeration
  #Window_0
EndEnumeration
Enumeration
  #Text_titre
  #Text_nom
  #String_nom
  #Text_adresse
  #String_adresse
  #Text_ville
  #String_ville
  #Text_carteB
  #String_cb
  #Text_carteR
  #String_cr
  #Text_prixU
  #String_prixU
  #Text_totalc
  #String_totalc
  #Text_Total
  #String_7
  #Button_Calcule
  #Button_Effacer
  #Button_Quit
EndEnumeration 
 
 
; Fonts
Global FontID1
FontID1 = LoadFont(1, "Times New Roman", 24, #PB_Font_Bold)
Global FontID2
FontID2 = LoadFont(2, "Times New Roman", 12)



Global cb
Global cr


 Procedure effacer()
 If CreateGadgetList(WindowID())
   SetGadgetText(#String_nom,"")
   SetGadgetText(#String_adresse,"")
   SetGadgetText(#String_ville,"")
   SetGadgetText(#String_cb,"")
   SetGadgetText(#String_cr,"")
   SetGadgetText(#String_totalc,"")
   SetGadgetText(#String_7,"")
   ActivateGadget(#String_nom)
 
 EndIf
 
 EndProcedure
 Procedure calculer()
 ;Total=#String_cb + #String_cr
 cb=#String_cb
 cr=#String_cr
 Total=cb+cr
 
 SetGadgetText(#String_totalc,""+Total)

 
 
 
 EndProcedure
 
 
 Procedure main()
 
  If OpenWindow(#window_0,0,0,642,482,#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered,"Bon de commande")                                  
  If CreateGadgetList(WindowID())
      TextGadget(#Text_titre, 60, 25, 525, 40,"Bon de commande de magic-shop", #PB_Text_Center)
      SetGadgetFont(#Text_titre, FontID1)
      TextGadget(#Text_nom, 10, 105, 65, 20," Nom :", #PB_Text_Center)
      SetGadgetFont(#Text_nom, FontID2)
      StringGadget(#String_nom, 85, 105, 230, 25, "")
      TextGadget(#Text_adresse, 15, 150, 65, 25, "Adresse :", #PB_Text_Center)
      SetGadgetFont(#Text_adresse, FontID2)
      StringGadget(#String_adresse, 85, 150, 230, 25, "")
      TextGadget(#Text_ville, 5, 195, 60, 25, "Ville :", #PB_Text_Center)
      SetGadgetFont(#Text_ville, FontID2)
      StringGadget(#String_ville, 85, 200, 230, 25, "")
      TextGadget(#Text_carteB, 10, 270, 95, 20, "Carte bleue :", #PB_Text_Center)
      SetGadgetFont(#Text_carteB, FontID2)
      StringGadget(#String_cb, 115, 270, 45, 25, "",#PB_String_Numeric)
      TextGadget(#Text_carteR, 20, 320, 80, 25, "Carte rouge :", #PB_Text_Center)
      SetGadgetFont(#Text_carteR, FontID2)
      StringGadget(#String_cr, 115, 320, 45, 25, "",#PB_String_Numeric)
      TextGadget(#Text_prixU, 370, 100, 90, 20, "prix unitaire :",#PB_Text_Center)
      SetGadgetFont(#Text_prixU, FontID2)
      StringGadget(#String_prixU, 495, 100, 55, 30, "",#PB_String_Numeric)
      TextGadget(#Text_totalc, 365, 170, 115, 20, "Total des cartes :", #PB_Text_Center)
      SetGadgetFont(#Text_totalc, FontID2)
      StringGadget(#String_totalc, 495, 165, 55, 30, "", #PB_String_ReadOnly|#PB_String_Numeric)
      TextGadget(#Text_Total, 360, 225, 65, 25, "Total :", #PB_Text_Center)
      SetGadgetFont(#Text_Total, FontID2)
      StringGadget(#String_7, 495, 220, 55, 30, "", #PB_String_ReadOnly|#PB_String_Numeric)
      ButtonGadget(#Button_Calcule, 30, 395, 135, 40, "Calculer")
      GadgetToolTip(#Button_Calcule, "Calculer la commande ")
      SetGadgetFont(#Button_Calcule, FontID2)
      ButtonGadget(#Button_Effacer, 240, 395, 135, 40, "Effacer")
      GadgetToolTip(#Button_Effacer, " effacer les champs")
      SetGadgetFont(#Button_Effacer, FontID2)
      ButtonGadget(#Button_Quit, 450, 395, 135, 40, "Quitter")
      SetGadgetFont(#Button_Quit, FontID2)
       
  EndIf
  EndIf
  EndProcedure
  
 
 main()
 
 Repeat
   event=WaitWindowEvent()
    Select event
    Case #PB_Event_Gadget
     Select EventGadgetID()
      Case #Button_Calcule:calculer()
      Case #Button_Effacer:effacer()
      Case #Button_Quit:
      fermer=1
      EndSelect
    
    
    Case #PB_Event_CloseWindow
    fermer=1
    EndSelect
   Until fermer=1
   End
   
  

Publié : lun. 14/nov./2005 10:44
par olivier

Code : Tout sélectionner

;exemple d'un bon de commande

; constante de la fenetre et des gadgets
;
Enumeration
    #Window_0
EndEnumeration
Enumeration
    #Text_titre
    #Text_nom
    #String_nom
    #Text_adresse
    #String_adresse
    #Text_ville
    #String_ville
    #Text_carteB
    #String_cb
    #Text_carteR
    #String_cr
    #Text_prixU
    #String_prixU
    #Text_totalc
    #String_totalc
    #Text_Total
    #String_7
    #Button_Calcule
    #Button_Effacer
    #Button_Quit
EndEnumeration
 
 
; Fonts
Global FontID1
FontID1 = LoadFont(1, "Times New Roman", 24, #PB_Font_Bold)
Global FontID2
FontID2 = LoadFont(2, "Times New Roman", 12)



Global cb
Global cr


Procedure effacer()
    If CreateGadgetList(WindowID())
        SetGadgetText(#String_nom,"")
        SetGadgetText(#String_adresse,"")
        SetGadgetText(#String_ville,"")
        SetGadgetText(#String_cb,"")
        SetGadgetText(#String_cr,"")
        SetGadgetText(#String_totalc,"")
        SetGadgetText(#String_7,"")
        ActivateGadget(#String_nom)
        
    EndIf
    
EndProcedure
Procedure calculer() ;***************************changement ici
    ;Total=#String_cb + #String_cr
    cb=Val(GetGadgetText(#String_cb)) ; val converti du texte en chiffre ; Getgadgettext récupere le texte du gadget. #String_cb n'est que le numéro du gadget ! (son nom) 
    cr=Val(GetGadgetText(#String_cr))
    Total=cb+cr
    
    SetGadgetText(#String_totalc,""+Str(Total)) ; str convertie total (numerique) en text pour pouvoir l'afficher dans le gadget
    
    
    
    
EndProcedure
 
 
Procedure main()
    
    If OpenWindow(#Window_0,0,0,642,482,#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered,"Bon de commande")                                 
        If CreateGadgetList(WindowID())
            TextGadget(#Text_titre, 60, 25, 525, 40,"Bon de commande de magic-shop", #PB_Text_Center)
            SetGadgetFont(#Text_titre, FontID1)
            TextGadget(#Text_nom, 10, 105, 65, 20," Nom :", #PB_Text_Center)
            SetGadgetFont(#Text_nom, FontID2)
            StringGadget(#String_nom, 85, 105, 230, 25, "")
            TextGadget(#Text_adresse, 15, 150, 65, 25, "Adresse :", #PB_Text_Center)
            SetGadgetFont(#Text_adresse, FontID2)
            StringGadget(#String_adresse, 85, 150, 230, 25, "")
            TextGadget(#Text_ville, 5, 195, 60, 25, "Ville :", #PB_Text_Center)
            SetGadgetFont(#Text_ville, FontID2)
            StringGadget(#String_ville, 85, 200, 230, 25, "")
            TextGadget(#Text_carteB, 10, 270, 95, 20, "Carte bleue :", #PB_Text_Center)
            SetGadgetFont(#Text_carteB, FontID2)
            StringGadget(#String_cb, 115, 270, 45, 25, "",#PB_String_Numeric)
            TextGadget(#Text_carteR, 20, 320, 80, 25, "Carte rouge :", #PB_Text_Center)
            SetGadgetFont(#Text_carteR, FontID2)
            StringGadget(#String_cr, 115, 320, 45, 25, "",#PB_String_Numeric)
            TextGadget(#Text_prixU, 370, 100, 90, 20, "prix unitaire :",#PB_Text_Center)
            SetGadgetFont(#Text_prixU, FontID2)
            StringGadget(#String_prixU, 495, 100, 55, 30, "",#PB_String_Numeric)
            TextGadget(#Text_totalc, 365, 170, 115, 20, "Total des cartes :", #PB_Text_Center)
            SetGadgetFont(#Text_totalc, FontID2)
            StringGadget(#String_totalc, 495, 165, 55, 30, "", #PB_String_ReadOnly|#PB_String_Numeric)
            TextGadget(#Text_Total, 360, 225, 65, 25, "Total :", #PB_Text_Center)
            SetGadgetFont(#Text_Total, FontID2)
            StringGadget(#String_7, 495, 220, 55, 30, "", #PB_String_ReadOnly|#PB_String_Numeric)
            ButtonGadget(#Button_Calcule, 30, 395, 135, 40, "Calculer")
            GadgetToolTip(#Button_Calcule, "Calculer la commande ")
            SetGadgetFont(#Button_Calcule, FontID2)
            ButtonGadget(#Button_Effacer, 240, 395, 135, 40, "Effacer")
            GadgetToolTip(#Button_Effacer, " effacer les champs")
            SetGadgetFont(#Button_Effacer, FontID2)
            ButtonGadget(#Button_Quit, 450, 395, 135, 40, "Quitter")
            SetGadgetFont(#Button_Quit, FontID2)
            
        EndIf
    EndIf
EndProcedure
 
 
main()
 
Repeat
    event=WaitWindowEvent()
    Select event
        Case #PB_Event_Gadget
            Select EventGadgetID()
                Case #Button_Calcule:calculer()
                Case #Button_Effacer:effacer()
                Case #Button_Quit:
                    fermer=1
            EndSelect
            
            
        Case #PB_Event_CloseWindow
            fermer=1
    EndSelect
Until fermer=1
End 
Voilà ca devrai marcher, regarde les commentaire pour comprendre.