DelItem en TFolderEx (Solucionado)

DelItem en TFolderEx (Solucionado)

Postby cnavarro » Wed May 29, 2013 5:39 pm

Buenas tardes
Al suprimir las Tabs de un FolderEx y llegar al ultimo elemento me da el siguiente error:
Aclarar que antes de suprimir añado un item (AddItem)
He mirado la clase que tengo y la linea en la que aparece el error es:
Code: Select all  Expand view

METHOD PaintTB() CLASS TFolderEx
   LOCAL aRect   := GetClientRect( ::hWnd )
   LOCAL n, j
   LOCAL nLen    := Len( ::aPrompts )
   LOCAL hBmpPaint
   LOCAL nLastRow
Linea 1358   LOCAL hBrush, hDlgBrush := ::aDialogs[ ::nOption ]:oBrush:hBrush//CreateSolidBrush( CLR_WHITE )//  
 


Code: Select all  Expand view

   Compiler version: Harbour 3.2.0dev (Rev. 17516)
   FiveWin  Version: FWH 12.02
   Windows version: 6.2, Build 9200

   Time from start: 0 hours 0 mins 35 secs
   Error occurred at: 29/05/2013, 19:23:00
   Error description: Error BASE/1132  Bound error: array access
   Args:
     [   1] = A   { ... }
     [   2] = N   2

Stack Calls
===========
   Called from: .\source\classes\TFOLDEX.PRG => TFOLDEREX:PAINTTB( 1358 )
   Called from: .\source\classes\TFOLDEX.PRG => TFOLDEREX:PAINT( 1130 )
   Called from: .\source\classes\TFOLDEX.PRG => (b)TFOLDEREX( 117 )
   Called from: .\source\classes\TFOLDEX.PRG => TFOLDEREX:DISPLAY( 0 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1666 )
   Called from: .\source\classes\TFOLDEX.PRG => TFOLDEREX:HANDLEEVENT( 925 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
   Called from:  => DIALOGBOXINDIRECT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 270 )
   Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 426 )
   Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 31 )
   Called from: .\source\classes\TFOLDEX.PRG => TFOLDEREX:CHANGEORDER( 651 )
   Called from: .\source\classes\TFOLDEX.PRG => TFOLDEREX:RESIZE( 1550 )
   Called from: .\source\classes\TFOLDEX.PRG => TFOLDEREX:DEFAULT( 791 )
   Called from: .\source\classes\TFOLDEX.PRG => TFOLDEREX:DELITEM( 725 )
   Called from: vmh.prg => CIERRA( 1946 )
   Called from: vmh.prg => (b)BARFLDS( 1917 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 465 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 656 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1690 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 1407 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 980 )
   Called from: vmh.prg => MAIN( 774 )
 


La funcion en la que se produce el error

Code: Select all  Expand view

Function Cierra()
Local nOpt     := oFldUtiles:nOption    //aDialogs[ 7 ]
Local nLenD    := Len( oFldUtiles:aDialogs )
Local nPosD    := 0

   if nLenD = 1
      oFldUtiles:AddItem( "NONE", , , )
      oFldUtiles:SetOption( 2 )      
      nPosD   := 1
     
   else
      if nLenD = 2
         nPosD := 1
      else
         nPosD := nOpt - 1
      endif
   endif
   //if nLenD > 1
   ? Len( oFldUtiles:aDialogs ), nOpt
   oFldUtiles:DelItem( nOpt )                   // Linea 1946

.../...
 


Y los valores:

Len( oFldUtiles:aDialogs ) -> 2 (Ya que he añadido antes de borrar)
nOpt -> 1 (Posicion actual)

No encuentro el problema
He intentado, asignando Brush a todos los Dialogs que voy creando por si acaso sin ningun resultado
He buscado por el foro y no encuentro ninguna referencia sobre el tema.
Gracias
Last edited by cnavarro on Wed May 29, 2013 7:43 pm, edited 1 time in total.
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: DelItem en TFolderEx

Postby Pedro » Wed May 29, 2013 6:47 pm

Hola
Lo mismo digo una burrada, pero....por qué no eliminas
Code: Select all  Expand view
  if nLenD = 1
      oFldUtiles:AddItem( "NONE", , , )
      oFldUtiles:SetOption( 2 )     <-----------Esta línea
      nPosD   := 1


lo digo porque estas forzando al Folder a la pestaña 2 y luego eliminas la uno
Linea 1358 LOCAL hBrush, hDlgBrush := ::aDialogs[ ::nOption ]:oBrush:hBrush//CreateSolidBrush( CLR_WHITE )// Lo más probable es que aquí ::nOption sea 2
Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO
User avatar
Pedro
 
Posts: 464
Joined: Tue Mar 21, 2006 7:30 pm
Location: Córdoba (España)

Re: DelItem en TFolderEx

Postby cnavarro » Wed May 29, 2013 7:17 pm

Pedro, muchas gracias

Me has dado el hilo para solucionarlo

Esa linea que comentas no la tenía, pero lo puse en una de las muchas pruebas que hacia
Daba igual que lo pusiera o no, ya que el ADDItem, ya lo hace por defecto, por lo que la circunstancia que comentas, que era efectivamente el problema, seguía apareciendo
Solucion:

Code: Select all  Expand view

   oFldUtiles:SetOption( 1 )      --> Actualizar la posición en la que voy a borrar
   oFldUtiles:DelItem( nOpt )
 


Hay veces que llevas un monton de horas y no ves lo que es evidente.
Lo suyo es parar y tomar una cerveza. (Otra para ti)

Muchas gracias y un saludo
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: DelItem en TFolderEx (Solucionado)

Postby Pedro » Wed May 29, 2013 7:45 pm

Me la tomo a tu salud
Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO
User avatar
Pedro
 
Posts: 464
Joined: Tue Mar 21, 2006 7:30 pm
Location: Córdoba (España)


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 95 guests