probleme de panelgadget et rafrachissement

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
supercdfr
Messages : 105
Inscription : sam. 21/juil./2007 15:16

probleme de panelgadget et rafrachissement

Message par supercdfr »

Bonjour,

voici mon code :

Code : Tout sélectionner

Enumeration
  #Window_0
  #String_numero_resto
  #Panel_1
  
  #Frame3D_heure = 990
  
  #Text_heure_lundi = 1000
  #Text_heure_mardi = 1010
  #Text_heure_mercredi = 1020
  #Text_heure_jeudi = 1030
  #Text_heure_vendredi = 1040
  #Text_heure_samedi = 1050
  #Text_heure_dimanche = 1060
  
  #String_heure_debut_lundi = 1070
  #String_heure_debut_mardi = 1080
  #String_heure_debut_merecredi = 1090
  #String_heure_debut_jeudi = 1100
  #String_heure_debut_vendredi = 1110
  #String_heure_debut_samedi = 1120
  #String_heure_debut_dimanche = 1130
  
  #String_heure_fin_lundi = 1140
  #String_heure_fin_mardi = 1150
  #String_heure_fin_mercredi = 1160
  #String_heure_fin_jeudi = 1170
  #String_heure_fin_vendredi = 1180
  #String_heure_fin_samedi = 1190
  #String_heure_fin_dimanche = 1200
  
  #CheckBox_heure_enable = 1210
EndEnumeration

; heures
Global rajout_x.l
Global rajout_y.l
Global Dim heures_param.s(20)
; heures


Procedure OpenWindow_Window_0()
  If OpenWindow(#Window_0, 511, 91, 765, 639, "test", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
    If UseGadgetList(WindowID(#Window_0))
      StringGadget(#String_numero_resto, 325, 0, 100, 45, "")
      PanelGadget(#Panel_1, 5, 55, 750, 580)
        ; Tab #1
        AddGadgetItem(#Panel_1, 0, "horaire")
      CloseGadgetList()
    EndIf
  EndIf
EndProcedure

Procedure rajoute_horaire(a_rajouter.l , nom_frame.s)
  Protected a_rajouter_i = a_rajouter
  
  If a_rajouter = 4
    rajout_x = 0
    rajout_y = 1
  Else
    rajout_x + 1
  EndIf
  If a_rajouter = 0
    rajout_x - 1
  EndIf
  
  OpenGadgetList(#Panel_1,0)
  FrameGadget(#Frame3D_heure + a_rajouter_i                 , 5   + 170*rajout_x, 5 + rajout_y*200  , 160, 190, "Heures " + nom_frame)
  TextGadget(#Text_heure_lundi + a_rajouter_i               , 15  + 170*rajout_x, 30 + rajout_y*200  , 50, 20, "Lundi", #PB_Text_Right)
  TextGadget(#Text_heure_mardi + a_rajouter_i               , 15  + 170*rajout_x, 50 + rajout_y*200  , 50, 20, "mardi", #PB_Text_Right)
  TextGadget(#Text_heure_mercredi + a_rajouter_i            , 15  + 170*rajout_x, 70 + rajout_y*200  , 50, 20, "Mercredi", #PB_Text_Right)
  TextGadget(#Text_heure_jeudi + a_rajouter_i               , 15  + 170*rajout_x, 90 + rajout_y*200  , 50, 20, "Jeudi", #PB_Text_Right)
  TextGadget(#Text_heure_vendredi + a_rajouter_i            , 15  + 170*rajout_x, 110 + rajout_y*200 , 50, 20, "Vendredi", #PB_Text_Right)
  TextGadget(#Text_heure_samedi + a_rajouter_i              , 15  + 170*rajout_x, 130 + rajout_y*200 , 50, 20, "Samedi", #PB_Text_Right)
  TextGadget(#Text_heure_dimanche + a_rajouter_i            , 15  + 170*rajout_x, 150 + rajout_y*200 , 50, 20, "Dimanche", #PB_Text_Right)
  StringGadget(#String_heure_debut_lundi + a_rajouter_i     , 70  + 170*rajout_x, 25 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_debut_mardi + a_rajouter_i     , 70  + 170*rajout_x, 45 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_debut_merecredi + a_rajouter_i , 70  + 170*rajout_x, 65 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_debut_jeudi + a_rajouter_i     , 70  + 170*rajout_x, 85 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_debut_vendredi + a_rajouter_i  , 70  + 170*rajout_x, 105 + rajout_y*200 , 40, 20, "00:00")
  StringGadget(#String_heure_debut_samedi  + a_rajouter_i   , 70  + 170*rajout_x, 125 + rajout_y*200 , 40, 20, "00:00")
  StringGadget(#String_heure_debut_dimanche + a_rajouter_i  , 70  + 170*rajout_x, 145 + rajout_y*200 , 40, 20, "00:00")
  StringGadget(#String_heure_fin_dimanche + a_rajouter_i    , 115 + 170*rajout_x, 145 + rajout_y*200 , 40, 20, "00:00")
  StringGadget(#String_heure_fin_lundi + a_rajouter_i       , 115 + 170*rajout_x, 25 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_fin_mardi + a_rajouter_i       , 115 + 170*rajout_x, 45 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_fin_mercredi + a_rajouter_i    , 115 + 170*rajout_x, 65 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_fin_jeudi + a_rajouter_i       , 115 + 170*rajout_x, 85 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_fin_vendredi + a_rajouter_i    , 115 + 170*rajout_x, 105 + rajout_y*200 , 40, 20, "00:00")
  StringGadget(#String_heure_fin_samedi + a_rajouter_i      , 115 + 170*rajout_x, 125 + rajout_y*200 , 40, 20, "00:00")
  CheckBoxGadget(#CheckBox_heure_enable + a_rajouter_i      , 55  + 170*rajout_x, 170 + rajout_y*200 , 65, 21, "IsEnable")
  CloseGadgetList()
EndProcedure

OpenWindow_Window_0()

rajoute_horaire(1,"test")

Repeat
  Event = WaitWindowEvent()
  Select Event
    ; ///////////////////
    Case #PB_Event_Gadget
      EventGadget = EventGadget()
      EventType = EventType()
      If EventGadget = #String_numero_resto

      EndIf
    ; ////////////////////////
    Case #PB_Event_CloseWindow
      EventWindow = EventWindow()
      If EventWindow = #Window_0
        CloseWindow(#Window_0)
        Break
      EndIf
  EndSelect
ForEver
Si vous l’exécuter, vous verrez qu'au bout de quelques secondes, l'intitulé du panel gadget disparait totalement, et j'aimerais comprendre d'ou cela provient.

Cdlt.
Avatar de l’utilisateur
MLD
Messages : 1124
Inscription : jeu. 05/févr./2009 17:58
Localisation : Bretagne

Re: probleme de panelgadget et rafrachissement

Message par MLD »

Bonjour
Chez moi rien ne bouge. (PB5.21)Mais regarde comme cela.

Code : Tout sélectionner

EndEnumeration

; heures
Global rajout_x.l
Global rajout_y.l
Global Dim heures_param.s(20)
; heures


Procedure OpenWindow_Window_0()
  If OpenWindow(#Window_0, 511, 91, 765, 639, "test", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
    ;If UseGadgetList(WindowID(#Window_0))**************************
      StringGadget(#String_numero_resto, 325, 0, 100, 45, "")
      PanelGadget(#Panel_1, 5, 55, 750, 580)
        ; Tab #1
        AddGadgetItem(#Panel_1, 0, "horaire")
      ;CloseGadgetList()**********************************************
    ;EndIf **********************************************************
  EndIf
EndProcedure

Procedure rajoute_horaire(a_rajouter.l , nom_frame.s)
  Protected a_rajouter_i = a_rajouter
  
  If a_rajouter = 4
    rajout_x = 0
    rajout_y = 1
  Else
    rajout_x + 1
  EndIf
  If a_rajouter = 0
    rajout_x - 1
  EndIf
  
  ;OpenGadgetList(#Panel_1,0) **************************
  FrameGadget(#Frame3D_heure + a_rajouter_i                 , 5   + 170*rajout_x, 5 + rajout_y*200  , 160, 190, "Heures " + nom_frame)
  TextGadget(#Text_heure_lundi + a_rajouter_i               , 15  + 170*rajout_x, 30 + rajout_y*200  , 50, 20, "Lundi", #PB_Text_Right)
  TextGadget(#Text_heure_mardi + a_rajouter_i               , 15  + 170*rajout_x, 50 + rajout_y*200  , 50, 20, "mardi", #PB_Text_Right)
  TextGadget(#Text_heure_mercredi + a_rajouter_i            , 15  + 170*rajout_x, 70 + rajout_y*200  , 50, 20, "Mercredi", #PB_Text_Right)
  TextGadget(#Text_heure_jeudi + a_rajouter_i               , 15  + 170*rajout_x, 90 + rajout_y*200  , 50, 20, "Jeudi", #PB_Text_Right)
  TextGadget(#Text_heure_vendredi + a_rajouter_i            , 15  + 170*rajout_x, 110 + rajout_y*200 , 50, 20, "Vendredi", #PB_Text_Right)
  TextGadget(#Text_heure_samedi + a_rajouter_i              , 15  + 170*rajout_x, 130 + rajout_y*200 , 50, 20, "Samedi", #PB_Text_Right)
  TextGadget(#Text_heure_dimanche + a_rajouter_i            , 15  + 170*rajout_x, 150 + rajout_y*200 , 50, 20, "Dimanche", #PB_Text_Right)
  StringGadget(#String_heure_debut_lundi + a_rajouter_i     , 70  + 170*rajout_x, 25 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_debut_mardi + a_rajouter_i     , 70  + 170*rajout_x, 45 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_debut_merecredi + a_rajouter_i , 70  + 170*rajout_x, 65 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_debut_jeudi + a_rajouter_i     , 70  + 170*rajout_x, 85 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_debut_vendredi + a_rajouter_i  , 70  + 170*rajout_x, 105 + rajout_y*200 , 40, 20, "00:00")
  StringGadget(#String_heure_debut_samedi  + a_rajouter_i   , 70  + 170*rajout_x, 125 + rajout_y*200 , 40, 20, "00:00")
  StringGadget(#String_heure_debut_dimanche + a_rajouter_i  , 70  + 170*rajout_x, 145 + rajout_y*200 , 40, 20, "00:00")
  StringGadget(#String_heure_fin_dimanche + a_rajouter_i    , 115 + 170*rajout_x, 145 + rajout_y*200 , 40, 20, "00:00")
  StringGadget(#String_heure_fin_lundi + a_rajouter_i       , 115 + 170*rajout_x, 25 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_fin_mardi + a_rajouter_i       , 115 + 170*rajout_x, 45 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_fin_mercredi + a_rajouter_i    , 115 + 170*rajout_x, 65 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_fin_jeudi + a_rajouter_i       , 115 + 170*rajout_x, 85 + rajout_y*200  , 40, 20, "00:00")
  StringGadget(#String_heure_fin_vendredi + a_rajouter_i    , 115 + 170*rajout_x, 105 + rajout_y*200 , 40, 20, "00:00")
  StringGadget(#String_heure_fin_samedi + a_rajouter_i      , 115 + 170*rajout_x, 125 + rajout_y*200 , 40, 20, "00:00")
  CheckBoxGadget(#CheckBox_heure_enable + a_rajouter_i      , 55  + 170*rajout_x, 170 + rajout_y*200 , 65, 21, "IsEnable")
  CloseGadgetList()
EndProcedure

OpenWindow_Window_0()

rajoute_horaire(1,"test")

Repeat
  Event = WaitWindowEvent()
  Select Event
    ; ///////////////////
    Case #PB_Event_Gadget
      EventGadget = EventGadget()
      EventType = EventType()
      If EventGadget = #String_numero_resto

      EndIf
    ; ////////////////////////
    Case #PB_Event_CloseWindow
      EventWindow = EventWindow()
      If EventWindow = #Window_0
        CloseWindow(#Window_0)
        Break
      EndIf
  EndSelect
ForEver

supercdfr
Messages : 105
Inscription : sam. 21/juil./2007 15:16

Re: probleme de panelgadget et rafrachissement

Message par supercdfr »

idem.
Avatar de l’utilisateur
Fig
Messages : 1176
Inscription : jeu. 14/oct./2004 19:48

Re: probleme de panelgadget et rafrachissement

Message par Fig »

Pas de problème non plus sur les 2 codes... :|
Il y a deux méthodes pour écrire des programmes sans erreurs. Mais il n’y a que la troisième qui marche.
Version de PB : 6.00LTS - 64 bits
Répondre