sa doit être mon 1er post ici
voilà sa fait un moment que j'ai ça mais la sa deviens chiant :
je ne serais pas dire depuis quand mais depuis un moment quand je lance des ancien code avec purebasic genre sa :
Code : Tout sélectionner
;- Window Constants
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
Enumeration
#Frame3D_0
#Text_0
#String_0
#Button_0
#Text_1
#String_1
EndEnumeration
If OpenWindow(#Window_0, 0, 0, 270, 130, "Méga to Octet", #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
SetWindowColor(#Window_0, RGB($33, $00, $99))
If CreateGadgetList(WindowID(#Window_0))
Frame3DGadget(#Frame3D_0, 10, 5, 250, 115, "")
TextGadget(#Text_0, 20, 30, 75, 20, "chiffre en MO :")
SetGadgetColor(#Text_0, #PB_Gadget_BackColor, RGB($33, $00, $99))
SetGadgetColor(#Text_0, #PB_Gadget_FrontColor, RGB(255, 255, 255))
StringGadget(#String_0, 100, 25, 150, 20, "", #PB_String_Numeric)
SetGadgetColor(#String_0, #PB_Gadget_BackColor, RGB($33, $00, $99))
SetGadgetColor(#String_0, #PB_Gadget_FrontColor, RGB(255, 255, 255))
ButtonGadget(#Button_0, 20, 55, 230, 20, "calcul")
TextGadget(#Text_1, 20, 85, 75, 20, "resultat en KO :")
SetGadgetColor(#Text_1, #PB_Gadget_BackColor, RGB($33, $00, $99))
SetGadgetColor(#Text_1, #PB_Gadget_FrontColor, RGB(255, 255, 255))
StringGadget(#String_1, 100, 80, 150, 20, "", #PB_String_ReadOnly)
SetGadgetColor(#String_1, #PB_Gadget_BackColor, RGB($33, $00, $99))
SetGadgetColor(#String_1, #PB_Gadget_FrontColor, RGB(255, 255, 255))
EndIf
EndIf
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_Gadget
Select EventGadget()
Case #Button_0
TexteMO$ = GetGadgetText(#String_0) ; <--- on renvoie le nombre écrit dans le string_0 ( le chiffre en MO )
resultat = Val(TexteMO$) * 1024 ; <--- on multiplie le 1er chiffre par 1024
SetGadgetText(#String_1, Str(resultat)) ; <--- on renvoie le résultat total au string_1
EndSelect
EndIf
Until EventID = #PB_Event_CloseWindow
Constante déjà déclarée avec une autre valeur: #String_0
Donc au début je me suis amusé a changer certain ID genre : #String_00 mais a force c'est chiant
ceci viens de moi ou pas ?
ps: j'ai windows 7 et PureBasic 4.41 le tout en x64
Mais cela ne m'arrive pas sur tout les codes j'ai du mal a comprendre en faite.
Si ça vous est déjà arrivez
@++