Page 1 sur 1

Problème avec ScrollAreaGadget

Publié : mer. 15/juin/2016 12:06
par Jeanmarc
Bonjour à tous,

J'ai un problème avec ScrollAreaGadget.
Au début tout va bien, je scroll le canvas ave un graphique simple.
Je modifie en copiant du code d'un Panel vers un autre et depuis les Scrollbar ne fonctionnent plus.

Aller sur le TabItem: Schéma

Code : Tout sélectionner

;
; ------------------------------------------------------------
;		TRUC EDITEUR 
;   PureBasic - (c) Fantaisie Software
; ------------------------------------------------------------
Global Cou_JaunePale=$efffff
Global Cou_BleuFoce=$820000
Global Cou_Blanc=$FFFFFF
Global h_lab_titre=30
Global h_lab_simple=25
Global h_txt_simple=25 
Global POSY.i=0:InterY.i=50
 
UseJPEGImageDecoder():UsePNGImageDecoder():UseTGAImageDecoder():UseTIFFImageDecoder()
#Windowpara = #PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget| #PB_Window_Maximize  

; #PB_Font_Bold       : La police de caractères sera en gras
; #PB_Font_Italic     : La police de caractères sera en italique
; #PB_Font_Underline  : La police de caractères sera soulignée (Windows seulement)
; #PB_Font_StrikeOut  : La police de caractères sera barrée (Windows seulement)
; #PB_Font_HighQuality: La police de caractères sera en qualité supérieure (plus lent)(Windows seulement)

 		
Enumeration ; Containers
	#numWIN =200
	#MENU
	#TB_Gene
	#STATUBAR
	
	#SPLITGAUCHE
	#SPLITDROIT
	#SPLITER

	#Tab_DROIT
	#Tab_Gauche
	
	#Tab_Parametres	;**************
	
	#Tab_Schema	;*******************
	#CO_Schema
	#CO_tbSchema
	#TB_Schema
	#CO_RHSchema
	#CO_RVSchema
	#sca_Schema
	#can_Schema

	#Tab_Planche	;******************
	#CO_Planche
	#CO_tbPlanche
	#TB_Planche
	#CO_RHPlanche
	#CO_RVPlanche
 	#sca_Planche
	#can_Planche

	#Tab_Notice	;************************
	
EndEnumeration

Enumeration Menu
  #MENU_Open
  #MENU_Close
  #MENU_CloseAll
  #MENU_Quit
  
  #MENU_TileV
  #MENU_TileH
  #MENU_Cascade
  #MENU_Arrange
  #MENU_Previous
  #MENU_Next
EndEnumeration

Enumeration LabTxtContainerOptionCheckBox
	;label titre frontcolor=blanc backcolor=bleu fontsize=14
	#lab_GENERALITES=0
	#lab_PLANCHES
	;#lab_Platine
	#end1
	;label simple frontcolor=noir backcolor=blanc fontsize=10
	#lab_Nom_Montage=20
	#lab_Auteur_Montage
	#lab_Date_Montage
	#lab_Description_Montage
	#lab_SetComposants
	#lab_Nombre_Planche
	#lab_Nom_Planche
	#lab_Description_Planche
	#lab_Nombre_Platine
	#lab_Orientation
  #lab_Horizontale
  #lab_Verticale
	#lab_cb3
	#lab_Modeles
	#lab_G	
	#lab_MG			
	#lab_SG		
	#end2
	;texte simple frontcolor=noir backcolor=blanc fontsize=10 border=1
	#txt_Nom_Montage=60
	#txt_Auteur_Montage
	#txt_Date_Montage
	#txt_Description_Montage
	#txt_Nom_Planche
	#txt_Description_Planche
	#end3
	;container	
	#co_Parametres=90
; 	#co_Schemas
; 	#co_Notice
	#end4
	;option	
	#op_Horizontale=100
  #op_Verticale
	#end5
	;checkbox
	#cb_MontageG=120
	#cb_SchemaG
	#cb_3
	#end6
	;spin
	#sp_1=140
	#sp_Nombre_Platine
	#end7
	;listbox
	#lb_Set_Composant=150
	#lb_Modeles
	#lb_Planches
	#end8
	;bouton
	#bt_VoirSet=170
	#bt_En_Modele
	#end9

EndEnumeration

Enumeration PosVerticale 0 Step 30
#PY1=10
#PY2
#PY3
#PY4
#PY5
#PY6
#PY7
#PY8
#PY9
#PY10
#PY11
#PY12
#PY13
#PY14
#PY15
#PY16
#PY17
#PY18
#PY19
#PY20
EndEnumeration
Enumeration PosHorisontale 0 Step 25
#PX1=10
#PX2
#PX3
#PX4
#PX5
#PX6
#PX7
#PX8
#PX9
#PX10
#PX11
#PX12	
#PX13
#PX14
#PX15
#PX16
#PX17
#PX18
#PX19
#PX20
#PX21
#PX22	
#PX23
#PX24
#PX25
#PX26
#PX27
#PX28
#PX29
#PX30

EndEnumeration


Procedure  ReglesSchema()		; REGLES***************************************************************************
;Regle Horizontale	
  			ContainerGadget(#CO_RHSchema, 25,30,300,20, #PB_Container_Flat)
  				SetGadgetColor(#CO_RHSchema,#PB_Gadget_BackColor, Cou_JaunePale   )
				CloseGadgetList()
; ;Regle Verticale	
  			ContainerGadget(#CO_RVSchema, 0,55,20,200, #PB_Container_Flat)
  			  SetGadgetColor(#CO_RVSchema,#PB_Gadget_BackColor, Cou_JaunePale   )
				CloseGadgetList()
 ; 			ButtonGadget(#PB_Any, 0, 30, 20, 20, ">")
EndProcedure
Procedure  ReglesPlanche()		; REGLES***************************************************************************
;Regle Horizontale	
  			ContainerGadget(#CO_RHPlanche, 25,30,300,20, #PB_Container_Flat)
  				SetGadgetColor(#CO_RHPlanche,#PB_Gadget_BackColor, Cou_JaunePale   )
				CloseGadgetList()
; ;Regle Verticale	
  			ContainerGadget(#CO_RVPlanche, 0,55,20,200, #PB_Container_Flat)
  			  SetGadgetColor(#CO_RVPlanche,#PB_Gadget_BackColor, Cou_JaunePale   )
				CloseGadgetList()
 ; 			ButtonGadget(#PB_Any, 0, 30, 20, 20, ">")
EndProcedure

Procedure IniGadgets()
		    If LoadFont(1,"Arial",10 )
    		EndIf
    		 If LoadFont(2,"Arial",12, #PB_Font_Italic )
    		EndIf
    		 If LoadFont(3,"Arial",20, #PB_Font_Bold )
    		EndIf
    		 If LoadFont(4,"Arial",14, #PB_Font_Bold )
    		EndIf
		    
	For nGadget=0 To #end1-1		;label titre frontcolor=blanc backcolor=bleu fontsize=14
				SetGadgetFont (nGadget, FontID(3))
				SetGadgetColor(nGadget, #PB_Gadget_BackColor, Cou_BleuFoce)
      	SetGadgetColor(nGadget, #PB_Gadget_FrontColor, Cou_Blanc)
	Next
			    
	For nGadget=20 To #end2-1	;label simple frontcolor=noir backcolor=blanc fontsize=10
		    SetGadgetFont (nGadget, FontID(4))
				SetGadgetColor(nGadget, #PB_Gadget_BackColor, Cou_JaunePale)
      	SetGadgetColor(ngadget, #PB_Gadget_FrontColor, RGB(0, 0, 0))
	Next
			    
	For nGadget=60 To #end3-1		;texte simple frontcolor=noir backcolor=blanc fontsize=10 border=1
		    SetGadgetFont (nGadget, FontID(2))
				SetGadgetColor(nGadget, #PB_Gadget_BackColor, Cou_Blanc)
      	SetGadgetColor(ngadget, #PB_Gadget_FrontColor, RGB(0, 0, 0))
	Next
	
	For nGadget=90 To #end4-1		; container  backcolor=jaune
		    SetGadgetColor(nGadget,#PB_Gadget_BackColor, Cou_JaunePale   )

	Next
	
	For nGadget=100 To #end5-1		;option frontcolor=noir backcolor=blanc fontsize=10 border=1
		    SetGadgetFont (nGadget, FontID(4))
	Next
	For nGadget=120 To #end6-1		;checkbox frontcolor=noir backcolor=blanc fontsize=10 border=1
		    SetGadgetFont (nGadget, FontID(4))
	Next
	
	For nGadget=140 To #end7-1		;spin
		    SetGadgetFont (nGadget, FontID(2))
				SetGadgetColor(nGadget, #PB_Gadget_BackColor, Cou_Blanc)
      	SetGadgetColor(ngadget, #PB_Gadget_FrontColor, RGB(0, 0, 0))
	Next
	
	For nGadget=150 To #end8-1		;listbox
		    SetGadgetFont (nGadget, FontID(2))
				SetGadgetColor(nGadget, #PB_Gadget_BackColor, Cou_BleuFoce)
      	SetGadgetColor(ngadget, #PB_Gadget_FrontColor, Cou_Blanc)
	Next
	For nGadget=170 To #end9-1		;bouton
		    SetGadgetFont (nGadget, FontID(2))
				SetGadgetColor(nGadget, #PB_Gadget_BackColor, Cou_BleuFoce)
      	SetGadgetColor(ngadget, #PB_Gadget_FrontColor, Cou_Blanc)
	Next

EndProcedure

Procedure Resize()
	ResizeGadget(#Tab_DROIT, 0, 0, GadgetWidth(#SPLITDROIT),GadgetHeight(#SPLITDROIT) )
	
	ResizeGadget(#CO_Parametres, 0, 0, GadgetWidth(#SPLITDROIT),GadgetHeight(#SPLITDROIT) )
 	ResizeGadget(#CO_Schema, 0, 0, GadgetWidth(#SPLITDROIT),GadgetHeight(#SPLITDROIT) )
 	ResizeGadget(#CO_Planche, 0, 0, GadgetWidth(#SPLITDROIT),GadgetHeight(#SPLITDROIT) )

	ResizeGadget(#CO_RHSchema, #PB_Ignore, #PB_Ignore, GadgetWidth(#Tab_DROIT)-40,#PB_Ignore )
	ResizeGadget(#CO_RVSchema, #PB_Ignore, #PB_Ignore,#PB_Ignore,GadgetHeight(#Tab_DROIT)-85 )
	
	ResizeGadget(#CO_RHPlanche, #PB_Ignore, #PB_Ignore, GadgetWidth(#Tab_DROIT)-40,#PB_Ignore )
	ResizeGadget(#CO_RVPlanche, #PB_Ignore, #PB_Ignore,#PB_Ignore,GadgetHeight(#Tab_DROIT)-85 )

	ResizeGadget(#CO_tbSchema, 	0,0,GadgetWidth(#SPLITDROIT),GadgetHeight(#Tab_DROIT) )
	ResizeGadget(#CO_tbPlanche, 0,0,GadgetWidth(#SPLITDROIT),GadgetHeight(#Tab_DROIT) )

	ResizeGadget(#sca_Schema, #PB_Ignore, #PB_Ignore, GadgetWidth(#Tab_DROIT)-40,GadgetHeight(#Tab_DROIT)-85 )
	ResizeGadget(#sca_Planche, #PB_Ignore, #PB_Ignore, GadgetWidth(#Tab_DROIT)-40,GadgetHeight(#Tab_DROIT)-85 )

EndProcedure


If OpenWindow(#numWIN, 0, 0, 800, 600, "TRUC EDITEUR", #Windowpara      )
WinLarg=WindowWidth (#numWIN,   #PB_Window_InnerCoordinate) 
WinHaut=WindowHeight(#numWIN,   #PB_Window_InnerCoordinate)-80 
InterY=40
POSY=POSY+InterY

;MENU*************************************************************************************************************************
  If CreateMenu(#MENU, WindowID(#numWIN))
    MenuTitle("File")
      MenuItem(#MENU_Open, "Open")
      MenuItem(#MENU_Close, "Close")
      MenuItem(#MENU_CloseAll, "Close All")
      MenuBar()
      MenuItem(#MENU_QUit, "Quit")      
    MenuTitle("Windows")
      MenuItem(#MENU_TileV, "Tile vertically")
      MenuItem(#MENU_TileH, "Tile horizontally")
      MenuItem(#MENU_Cascade, "Cascade")
      MenuItem(#MENU_Previous, "Previous")
      MenuItem(#MENU_Next, "Next")
      
  EndIf
  
;TOOLBAR*********************************************************************************************************************
  If CreateToolBar(#TB_Gene, WindowID(#numWIN))
    ToolBarStandardButton(#MENU_Open, #PB_ToolBarIcon_Open)
    ToolBarStandardButton(#MENU_Close, #PB_ToolBarIcon_Delete)
    ToolBarSeparator()
    ToolBarStandardButton(#MENU_Previous, #PB_ToolBarIcon_Undo)
    ToolBarStandardButton(#MENU_Next, #PB_ToolBarIcon_Redo)
  EndIf
  
;STATUBAR********************************************************************************************************************
  If CreateStatusBar(#STATUBAR, WindowID(#numWIN))
    AddStatusBarField(100)
    AddStatusBarField(50)
    AddStatusBarField(100)
  
  StatusBarText(#STATUBAR, 0, "Area 1")
  StatusBarText(#STATUBAR, 1, "Area 2", #PB_StatusBar_BorderLess)
  StatusBarText(#STATUBAR, 2, "Area 3", #PB_StatusBar_Right | #PB_StatusBar_Raised)  
  EndIf

;SPLIT GAUCHE*****************************************************************************************************************
  ContainerGadget(#SPLITGAUCHE, 0,0,0,0, #PB_Container_Double) 
       ButtonGadget(#PB_Any, 10, 10, 50, 20, "Bouton 1") ; Inutile de préciser la taille ou les coordonnées 
  CloseGadgetList()

;SPLIT DROIT*******************************************************************************************************************   	
  ContainerGadget(#SPLITDROIT, 0,0,100,200, #PB_Container_Flat)  
    PanelGadget    (#Tab_DROIT, 0, 0, 400, 503)

;{ ONGLET PARAMETRES*******************************************************************
      AddGadgetItem (#Tab_DROIT, -1, "PARAMETRES")  
        ContainerGadget(#CO_Parametres, 0,0,100,500, #PB_Container_Flat)
        
;{ GENERALITES////////////////////////////////////////////////////////////////////////////////////////////
      	TextGadget(#lab_GENERALITES, 				#PX1, POSY,	750,	h_lab_titre,	" GENERALITEES")

      	  POSY=POSY+InterY+10
      	  TextGadget(#lab_Nom_Montage, 			#PX2,	POSY,	250,	h_lab_simple,	"Nom du Montage")
      	  StringGadget(#txt_Nom_Montage,		#PX12,POSY,	350, 	h_txt_simple, "CLIGNOTEUR")

					POSY=POSY+InterY
					TextGadget(#lab_Auteur_Montage,		#PX2, POSY,	250,	h_lab_simple,	"Auteur")
					StringGadget(#txt_Auteur_Montage,	#PX12,POSY, 350, 	h_txt_simple, "JMB")

					POSY=POSY+InterY
					TextGadget(#lab_Date_Montage, 		#PX2, POSY,	250,	h_lab_simple,	"Date")
					StringGadget(#txt_Date_Montage, 	#PX12,POSY, 350, 	h_txt_simple, "08/06/2016")

					POSY=POSY+InterY
      		TextGadget(#lab_Description_Montage, 		#PX2,	POSY,	250,	h_lab_simple,	"Description")
					StringGadget(#txt_Description_Montage, 	#PX12,POSY, 350, 	h_txt_simple, "Fait Clignoter une LED")

      	  POSY=POSY+InterY
      		TextGadget(#lab_SetComposants,			 		#PX2,	POSY,	250,	h_lab_simple,	"Set Composants")
      		ComboBoxGadget(#lb_Set_Composant, 			#px12,POSY+3, 350, h_lab_simple)
	      		AddGadgetItem(#lb_Set_Composant, -1, "Pas de restriction")
	      		AddGadgetItem(#lb_Set_Composant, -1, "Set 1 2016")
	      		AddGadgetItem(#lb_Set_Composant, -1, "Set 2 2016")
	      	ButtonGadget(#bt_VoirSet, 							#PX27,	POSY+5,	100,	h_lab_simple,	"Voir...")
						SetGadgetState(#lb_Set_Composant, 0)

	      	POSY=POSY+InterY
      		TextGadget(#lab_Modeles,			 		#PX2,		POSY,	250,	h_lab_simple,	"Modèles")
      		ComboBoxGadget(#lb_Modeles, 			#px12, 	POSY+3, 350, h_lab_simple)
	      		AddGadgetItem(#lb_Modeles, -1, "Pas de Modèle")
	      		AddGadgetItem(#lb_Modeles, -1, "Modèle 1")
	      		AddGadgetItem(#lb_Modeles, -1, "Modèle 2")
	      			SetGadgetState(#lb_Modeles, 0)

      	  POSY=POSY+InterY
      	  TextGadget(#lab_Nombre_Planche, 	#PX2, POSY,	250,	h_lab_simple,	"Nombre de Planche")
      	  SpinGadget     (#sp_1, 						#PX12,POSY, 100, 	h_txt_simple, 0, 10)
						GadgetToolTip(#sp_1, "Nombre de Planche:   Ex: Un Montage avec un Emmeteur et un Récepteur à besoin de deux Planches car il s'agit de deux circuits différents")
					
					POSY=POSY+InterY
					TextGadget(#lab_G,#PX2, 	POSY,	300,h_lab_simple,	"Présentation Générale")
					
					POSY=POSY+InterY-10
      	 		CheckBoxGadget(#cb_MontageG,	#PX2,  	POSY, 15, h_txt_simple, "") 
      	 	  	TextGadget(#lab_MG,#PX3, 	POSY,	100,h_lab_simple,	"Montage")
    		 		CheckBoxGadget(#cb_SchemaG, #px9,  	POSY, 15, h_txt_simple, "") 
    		 	  	TextGadget(#lab_SG,#PX10, 	POSY,	100,h_lab_simple,	"Schéma")
    				CheckBoxGadget(#cb_3, #px16, 	POSY, 15, h_txt_simple, "")
							TextGadget(#lab_cb3,#PX17, 	POSY,	100,h_lab_simple,	"CheckBox 3")
						;SetGadgetState(#cb_1, #PB_Checkbox_Unchecked)
						;SetGadgetState(#cb_2, #PB_Checkbox_Inbetween)
;}						
;{ PLANCHES////////////////////////////////////////////////////////////////////////////////////////////
      	
      	POSY=POSY+InterY+20
      	TextGadget(#lab_PLANCHES, #PX1, POSY,750,h_lab_titre+5," PLANCHES")
      		ComboBoxGadget(#lb_Planches, 	#px12, POSY+3, 350, h_lab_simple, #PB_ComboBox_Editable)
	      		AddGadgetItem(#lb_Planches, -1, "PLANCHE N° 1")
	      		AddGadgetItem(#lb_Planches, -1, "PLANCHE N° 2")
	      		AddGadgetItem(#lb_Planches, -1, "PLANCHE N° 3")
	      			SetGadgetState(#lb_Planches, 0)

					POSY=POSY+InterY+10
      	  TextGadget(#lab_Nom_Planche, 			#PX2,		POSY,	250,	h_lab_simple,	"Nom de la Planche")
      	  StringGadget(#txt_Nom_Planche,		#PX12,  POSY, 350, 	h_txt_simple, "EMETEUR")

					POSY=POSY+InterY
      		TextGadget(#lab_Description_Planche, 		#PX2, 	POSY,	250,	h_lab_simple,	"Description")
					StringGadget(#txt_Description_Planche, 	#PX12,  POSY, 350, 	h_txt_simple, "Fait Clignoter une LED")

      	  POSY=POSY+InterY
      	  TextGadget(#lab_Nombre_Platine, 				#PX2, 	POSY,	250,	h_lab_simple,	"Nombre de Platine")
      	  SpinGadget     (#sp_Nombre_Platine, 		#PX12, 	POSY, 100, 	h_txt_simple, 0, 10)

					POSY=POSY+InterY
      		TextGadget(#lab_Orientation, 						#PX2, 	POSY,	250,	h_lab_simple,	"Orientation")
	      		OptionGadget(#op_Horizontale, 				#PX7,	 	POSY, 15, 	h_txt_simple, "")
  	    		OptionGadget(#op_Verticale, 					#PX13,	POSY, 15, 	h_txt_simple, "")
  					TextGadget(#lab_Horizontale, 					#PX8, 	POSY,	120,	h_lab_simple,	"Horizontale")
  					TextGadget(#lab_Verticale, 						#PX14, 	POSY,	120,	h_lab_simple,	"Verticale")
						SetGadgetState(#op_Horizontale, 1)   ; sélectionne 
      	        	  
      	  POSY=POSY+InterY+250
      	  ButtonGadget(#bt_En_Modele, 			#PX2,	POSY,	270,	h_lab_simple+10,	"Enregistrer comme Modèle")

			CloseGadgetList();#CO_Parametres
;}
;}

larSch=290*10:hauSch=210*10		;Dimensions du document Graphique final  290/210 mm * 10 pixels (format A4)

;{ ONGLET SCHEMAS*******************************************************************      
      AddGadgetItem (#Tab_DROIT, -1,"SCHEMA")
        ContainerGadget(#CO_Schema, 0,0,1000,500, #PB_Container_BorderLess)
        
;{	ToolBar Schémas
        ContainerGadget(#CO_tbSchema, 0, 0, 472, 30, #PB_Container_BorderLess)
	  			If	CreateToolBar(#TB_Schema, GadgetID(#CO_tbSchema))
	 				ToolBarStandardButton(100, 0)
	 				ToolBarStandardButton(101, 1)
	 				ToolBarStandardButton(102, 3)
	 				ToolBarStandardButton(103, 2)
	 				EndIf
			 	CloseGadgetList()	;#CO_tbSchema
;}       
 				ReglesSchema()
 				
				ScrollAreaGadget(#sca_Schema, 25, 55, 700,500, larSch, hauSch, 30,#PB_ScrollArea_Flat)
					CanvasGadget(#can_Schema, 0, 0, larSch, hauSch, #PB_Canvas_ClipMouse)
				    If StartDrawing(CanvasOutput(#can_Schema))
		    		  Box(0, 0, larSch, hauSch, Cou_JaunePale )
		    		  BackColor(Cou_JaunePale)
		    		  FrontColor(Cou_BleuFoce)
		
		    		  LineXY(0,0,580,0)
		    		  LineXY(580,0,580,580)
		    		  LineXY(580,580,0,580)
		    		  LineXY(0,580,0,0)
		    		  LineXY(0,0,580,580)
		
		      		StopDrawing()
		    		EndIf
				CloseGadgetList();#sca_Schema
			CloseGadgetList();#CO_Schema
;}	
;{ ONGLET PLANCHES*******************************************************************      
      AddGadgetItem (#Tab_DROIT, -1,"PLANCHES")
        ContainerGadget(#CO_Planche, 0,0,1000,500, #PB_Container_BorderLess)
;{ 	ToolBar Planches
         ContainerGadget(#CO_tbPlanche, 0, 0, 472, 30, #PB_Container_BorderLess)
	  			If	CreateToolBar(#TB_Planche, GadgetID(#CO_tbPlanche))
		 				ToolBarStandardButton(100, 0)
		 				ToolBarStandardButton(101, 1)
		 				ToolBarStandardButton(102, 3)
		 				ToolBarStandardButton(103, 2)
	 				EndIf
			 	 CloseGadgetList();#CO_tbPlanche
;}
				ReglesPlanche()
				
				ScrollAreaGadget(#sca_Planche, 25, 55, 700,500, larSch, hauSch, 30,#PB_ScrollArea_Flat)
					CanvasGadget(#can_Planche, 0, 0, larSch, hauSch, #PB_Canvas_ClipMouse)
; 				    If StartDrawing(CanvasOutput(#can_Planche))
; 		    		  Box(0, 0, larSch, hauSch, Cou_JaunePale )
; 		    		  BackColor(Cou_JaunePale)
; 		    		  FrontColor(Cou_BleuFoce) 		
; 		    		  LineXY(0,0,580,0)
; 		    		  LineXY(580,0,580,580)
; 		    		  LineXY(580,580,0,580)
; 		    		  LineXY(0,580,0,0)
; 		    		  LineXY(0,0,580,580)	
; 		      		StopDrawing()
;     				EndIf
					CloseGadgetList();#sca_Planche
			CloseGadgetList();#CO_Planche

; ONGLET NOTICES*******************************************************************   
      AddGadgetItem (#Tab_DROIT, -1,"NOTICES")
        ButtonGadget(#PB_Any, 95, 15, 80, 24,"Bouton 2") 
;     	CloseGadgetList()

		CloseGadgetList();#Tab_DROIT
   CloseGadgetList()	;#SPLITDROIT
     
    SplitterGadget(#SPLITER, 5,30,WinLarg,WinHaut, #SPLITGAUCHE,#SPLITDROIT,  #PB_Splitter_Vertical| #PB_Splitter_Separator)     
    SetGadgetState(#SPLITER,300)  
    IniGadgets()
		Resize()

  Quit = 0
   
  Repeat
    Event = WaitWindowEvent()
    
    If Event= #PB_Event_Gadget   
         Select EventGadget()
           Case #SPLITER     ; Le Spliter est déplacé
           Resize()
 ;          Case 2
         EndSelect
		EndIf

    If Event = #PB_Event_CloseWindow
      Window = EventWindow()
      If Window = #numWIN ; Out main window is closed, just quit
        Quit = 1
      EndIf
    
    ElseIf Event = #PB_Event_Menu
      Select EventMenu()
        Case #MENU_Open
        
        Case #MENU_Close
              
        Case #MENU_Quit
          Quit = 1     
  
      EndSelect    
      
    ElseIf Event = #PB_Event_SizeWindow
      
      Window = EventWindow()
      
    EndIf
 
  Until Quit = 1  
  
EndIf
Cela ne pas être compliqué pour certain, mais je ne vois pas comment copier un code qui marche fait que cela ne fonctionne plus.
N'hésiter pas à critiquer le reste si votre temps et envie le permet.

Merci par avance,
JM

Re: Problème avec ScrollAreaGadget

Publié : mer. 15/juin/2016 14:06
par microdevweb
A mon avis un container mal fermé, je ne saurais trop te conseillé avec autant de container, panel, et area pour t'y retrouvé de découpé ton code en procédures pour mieux visualisé l'ouverture et la fermeture des container, panel, SroolArea
Exemple:

Code : Tout sélectionner

Porcedure MakeContainer
  PanelGadget(
  MakePanel()
  closeGadgetList()
endProcedure
Container (#MainContainer)
  MakeMainContainer()
  closeGadgetList()

Re: Problème avec ScrollAreaGadget

Publié : mer. 15/juin/2016 14:36
par Zorro
tu imbriques les containers !! et meme un Areagadget dedans en plus !??
c'est pas des boucles For-next ou une serie de IF-Endif ....

reste simple dans ta conception , perso j'ai jamais eu besoin d'imbriquer des containers, dans un container

et encore moins un AreaGadget dans un container, lui même imbriqué dans un container... comme tu le fais !!

a mon avis respecte la hiérarchie naturelle

dans un AreaGadget, tu peut mettre un ou plusieurs Containers
mais en évitant de les imbriquer ...


je ne suis même pas sur que ça marche, des containers imbriqués comme tu le fais !??

par contre tu peux avoir plusieurs container (contenant un ou des gadgets ) mais l'un a coté de l'autre !!
le tout dans un AreaGaget ....


ps: le container represente un avantage c'est de pouvoir rendre visible ou invisible une portion des gadgets contenu en lui
il suffit de cacher le container pour du coup cacher les enfants du container (les gadgets)
(interface dynamique )

il faut que tu vois les containers comme des "parents"
il me semble difficile d'inclure des parents, dans un parent ...
et vois l'AreaGadget comme un Grand parent ...
et un panel_Gadget comme un Arriere Grand parent .

donc :
La fenetre ...

Panel_gadget() ; l'arriere grand parent
....AreaGadet() ; le grand parent
.......Container1 ; un parent
.....................Gadget_enfant1
.....................Gadget_enfant2
.....................Gadget_enfant3

.......fin_container1
.......Container2 ; un autre parent
.....................Gadget_enfant4
.....................Gadget_enfant5
.....................Gadget_enfant6

.......fin_container2
....Fin_AreaGadget

fin_panelGadget

fin_fenetre ......

Re: Problème avec ScrollAreaGadget

Publié : mer. 15/juin/2016 15:24
par Marc56
Comme l'a dit Zorro, reste simple pour commencer 8O :P
(le splitter, c'est un peu la zone à gérer) :?

Sinon, avoir le rendu et la fonction que tu souhaites, c'est possible, mais difficile à la main
alors j'ai fait ce truc avec le Form designer (si!) 8)
(il faut pas mal jouer sur l'ordre des gadgets)
J'ai supprimé le container droit qui ne sert à rien puisque tous les gadgets sont dans un panel

Code : Tout sélectionner

;
; This code is automatically generated by the FormDesigner.
; and then copy/paste in one with main loop coded by myself :-)

Enumeration FormWindow
  #Window_0
EndEnumeration

Enumeration FormGadget
  #Container_Gauche
  #Button_0
  #Panel_0
  #ScrollArea_2
  #ScrollArea_3
  #Button_4
  #Splitter
EndEnumeration

Enumeration FormMenu
  #Mnu_Quit
EndEnumeration

Declare ResizeGadgetsWindow_0()


Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
  OpenWindow(#Window_0, x, y, width, height, "", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
  CreateStatusBar(0, WindowID(#Window_0))
  AddStatusBarField(#PB_Ignore)
  StatusBarText(0, 0, "Hello World!")
  CreateMenu(0, WindowID(#Window_0))
  MenuTitle("Fichier")
  MenuItem(#Mnu_Quit, "Quitter")
  ContainerGadget(#Container_Gauche, 5, 5, 172, 345)
  SetGadgetColor(#Container_Gauche, #PB_Gadget_BackColor,RGB(255,255,221))
  ButtonGadget(#Button_0, 30, 20, 100, 25, "Coucou 1")
  CloseGadgetList()
  PanelGadget(#Panel_0, 186, 5, 409, 345)
  AddGadgetItem(#Panel_0, -1, "Tab 1")
  AddGadgetItem(#Panel_0, -1, "Tab 2")
  ScrollAreaGadget(#ScrollArea_2, 15, 20, 380, 285, 1000, 1000, 1, #PB_ScrollArea_Flat | #PB_ScrollArea_Raised)
  CloseGadgetList()
  AddGadgetItem(#Panel_0, -1, "Tab 3")
  ScrollAreaGadget(#ScrollArea_3, 20, 80, 375, 225, 1000, 1000, 1, #PB_ScrollArea_Flat | #PB_ScrollArea_Raised)
  CloseGadgetList()
  AddGadgetItem(#Panel_0, -1, "Tab 4")
  ButtonGadget(#Button_4, 290, 15, 100, 25, "Coucou 2")
  CloseGadgetList()
  SplitterGadget(#Splitter, 5, 5, 590, 345, #Container_Gauche, #Panel_0, #PB_Splitter_Vertical | #PB_Splitter_Separator | #PB_Splitter_FirstFixed)
  SetGadgetState(#Splitter, 172)
EndProcedure

Procedure ResizeGadgetsWindow_0()
  Protected FormWindowWidth, FormWindowHeight
  FormWindowWidth = WindowWidth(#Window_0)
  FormWindowHeight = WindowHeight(#Window_0)
  ResizeGadget(#Container_Gauche, 5, 5, 172, FormWindowHeight - MenuHeight() - StatusBarHeight(0) - 10)
  ResizeGadget(#Panel_0, 186, 5, FormWindowWidth - 191, FormWindowHeight - MenuHeight() - StatusBarHeight(0) - 10)
  ResizeGadget(#ScrollArea_2, 15, 20, GetGadgetAttribute(#Panel_0,#PB_Panel_ItemWidth) - 29, GetGadgetAttribute(#Panel_0,#PB_Panel_ItemHeight) - 38)
  ResizeGadget(#ScrollArea_3, 20, 80, GetGadgetAttribute(#Panel_0,#PB_Panel_ItemWidth) - 34, GetGadgetAttribute(#Panel_0,#PB_Panel_ItemHeight) - 98)
  ResizeGadget(#Button_4, GetGadgetAttribute(#Panel_0,#PB_Panel_ItemWidth) - 119, 15, 100, 25)
  ResizeGadget(#Splitter, 5, 5, FormWindowWidth - 10, FormWindowHeight - MenuHeight() - StatusBarHeight(0) - 10)
EndProcedure


OpenWindow_0()

Repeat
    Select WaitWindowEvent(50)
        Case #PB_Event_CloseWindow
            End
        Case #PB_Event_SizeWindow
            ResizeGadgetsWindow_0()
        Case #PB_Event_Menu
            Select EventMenu()
                Case #Mnu_Quit
                    End
            EndSelect      
    EndSelect
ForEver
Ça illustre en même temps comment le FD se débrouille pour gérer la taille et la position de chaque gadget
du moment qu'on a défini les points d'ancrage.
Le ResizeGadgetsWindow_0(), c'est lui qui le fait dès qu'on a changé au moins 1 point d'ancrage par défaut d'au moins 1 gadget

Ce n'est pas parfait, car si on bouge le splitter, le ScrollAreaGadget ne change pas de taille, sauf si on redimensionne la fenêtre ensuite 8)

Tu avais mis la fenêtre en 800x600 mais mis aussi un #PB_Window_Maximize ce qui faisait ouvrir en plein écran.

Ta boucle principale est assez confuse.
Comme l'a précisé Zorro dans un topic récent, les if/elsif ne sont intéressant que si on remet une nouvelle formule à chaque nouvelle condition.
Si on teste sur un résultat unique, Select est plus lisible

Ta boucle principale peut alors s'écrire comme ça

Code : Tout sélectionner

Repeat
    Select WaitWindowEvent(10)
            
        Case #PB_Event_Gadget
            Select EventGadget()
                Case #SPLITER
                    Resize()
            EndSelect
            
        Case #PB_Event_CloseWindow
            Quit = 1
            
        Case #PB_Event_Menu
            Select EventMenu()
                Case #MENU_Open
                    Debug "Menu open"
                Case #MENU_Close
                    Debug "Menu Close"                     
                Case #MENU_Quit
                    Quit = 1   
            EndSelect
            
    EndSelect
Until Quit = 1
Ou même:

Code : Tout sélectionner

 Repeat
    Select WaitWindowEvent(10)
           
        Case #PB_Event_Gadget
            Select EventGadget()
                Case #SPLITER
                    Resize()
            EndSelect
           
        Case #PB_Event_CloseWindow
            End
           
        Case #PB_Event_Menu
            Select EventMenu()
                Case #MENU_Open
                    Debug "Menu open"
                Case #MENU_Close
                    Debug "Menu Close"                     
                Case #MENU_Quit
                    End   
            EndSelect
           
    EndSelect
ForEver
:wink:

Problème avec ScrollAreaGadget

Publié : mer. 15/juin/2016 17:55
par Jeanmarc
Bonjour à tous,

Cela fait plaisir de rentrer chez soit et voire plusieurs réponses à mon problème.
Je viens de clarifier le code avec des procédures.

En usant de ; pour éliminer du code je fini par trouver que le Resize du Container de la ToolBar bloque les Scrollbar. Pas son existence mais son resize. Bon bien sur je ne comprend pas mais bon cela marche parfaitement, comme au début d'ailleurs.

Merci encore, je vais vite revenir,
JM

Re: Problème avec ScrollAreaGadget

Publié : mer. 15/juin/2016 17:59
par Jeanmarc
Bonjour à tous,

Cela fait plaisir de rentrer chez soit et voire plusieurs réponses à mon problème.
Je viens de clarifier le code avec des procédures.

En usant de ; pour éliminer du code je fini par trouver que le Resize du Container de la ToolBar bloque les Scrollbar. Pas son existence mais son resize. Bon bien sur je ne comprend pas mais bon cela marche parfaitement, comme au début d'ailleurs.

Merci encore, je vais vite revenir,
JM