FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour AUTOSORT en xBrowse con dolphin
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
AUTOSORT en xBrowse con dolphin
Posted: Sat Mar 23, 2013 05:52 PM
Hola gente:
Quiero incorporar la clausula de AUTOSORT en un xBrowse que defino desde recurso.
Algo hago mal, pero no se que es. Probé de varias formas y, o no me hace el sort, o me da error en tiempo de ejecución.
Asi defino el xbrowse
Code (fw): Select all Collapse
     DEFINE DIALOG oDlg RESOURCE "ABMS" OF oWnd1
     REDEFINE XBROWSE oBrw ;
              FIELDS oQry:codigo, oQry:nombre;
              HEADERS "Codigo","Nombre";
              SIZES 100,500;
              ID 111 OF oDlg AUTOSORT
     REDEFINE SAY oBrw:oSeek PROMPT "" ID 113 OF oDlg
     SetDolphin( oBrw, oQry, .F. )
     oQry:bOnChangePage := {|| oBrw:Refresh() }
     PintaBrw(oBrw) // Esto pone los colores del oBrw que deseo

El error que me da es el siguiente:
Code (fw): Select all Collapse
Application
===========
   Path and name: C:\FWH11\DIEMAR\fuentes\GESTION.exe (32 bits)
   Size: 2,302,464 bytes
   Compiler version: Harbour 3.1.0dev (Rev. 17114)
   FiveWin  Version: FWH 11.11
   Windows version: 5.1, Build 2600 Service Pack 2

   Time from start: 0 hours 0 mins 5 secs 
   Error occurred at: 23/03/2013, 14:46:40
   Error description: Error DBCMD/2001  Workarea not in use: ORDBAGNAME

Stack Calls
===========
   Called from:  => ORDBAGNAME( 0 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:SETORDER( 11344 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:HEADERLBUTTONUP( 10181 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:LBUTTONUP( 3300 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1689 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11627 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3169 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 990 )
   Called from: gestion.prg => MAIN( 55 )

System
======
   CPU type: AMD Duron(tm) Processor 1200 Mhz
   Hardware memory: 239 megs

   Free System resources: 90 %
        GDI    resources: 90 %
        User   resources: 90 %

   Windows total applications running: 9
      1 , C:\WINDOWS\Explorer.EXE
      2 , C:\WINDOWS\system32\explorer.exe
      3 , C:\WINDOWS\system32\spoolsv.exe
      4 CiceroUIWndFrame, C:\WINDOWS\system32\ctfmon.exe
      5 Hidden Main Window, C:\WINDOWS\system32\RunDll32.exe
      6 New PC Studio, C:\Archivos de programa\Samsung\Samsung New PC Studio\NPSAgent.exe
      7 Registry Monitor, C:\WINDOWS\PixArt\PAC7302\Monitor.exe
      8 Sistema de Gestion MARKET PLUS - , C:\FWH11\DIEMAR\fuentes\GESTION.exe
      9 Símbolo del sistema - 2, C:\WINDOWS\system32\cmd.exe

Variables in use
================
   Procedure     Type   Value
   ==========================
   ORDBAGNAME
     Param   1:    O    Class: ERROR
   TXBRWCOLUMN:SETORDER
     Local   1:    U    
     Local   2:    U    
   TXBRWCOLUMN:HEADERLBUTTONUP
     Local   1:    L    .F.
     Local   2:    U    
     Local   3:    U    
     Local   4:    U    
     Local   5:    U    
     Local   6:    U    
     Local   7:    U    
     Local   8:    U    
     Local   9:    N    1
   TXBROWSE:LBUTTONUP
     Param   1:    N    4
     Param   2:    N    279
     Param   3:    N    0
     Local   1:    U    
     Local   2:    U    
     Local   3:    L    .F.
   TCONTROL:HANDLEEVENT
     Param   1:    N    4
     Param   2:    N    279
     Param   3:    N    0
     Local   1:    N    1
     Local   2:    N    0
     Local   3:    N    0.02
     Local   4:    N    0
     Local   5:    U

Agradezco cualquier ayuda para orientarme!
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: AUTOSORT en xBrowse con dolphin (Solucionado)
Posted: Sat Mar 23, 2013 08:16 PM
Lo solucione de esta forma:
Code (fw): Select all Collapse
   DEFINE DIALOG oDlg RESOURCE "ABMS" OF oWnd1
     REDEFINE XBROWSE oBrw OBJECT oQry;
              ID 111 OF oDlg AUTOSORT AUTOCOLS
     REDEFINE SAY oBrw:oSeek PROMPT "" ID 113 OF oDlg
     SetTitulos(oBrw,{"Codigo","Nombre"}) // Esta función pone los títulos a las columnas, porque sino pone el nombre del campo
     oBrw:aCols[2]:nWidth := 500 // Le doy el ancho que deseo para mejorar la vista
     oQry:bOnChangePage := {|| oBrw:Refresh() }
     PintaBrw(oBrw)  // Esto pone los colores del oBrw que deseo
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: AUTOSORT en xBrowse con dolphin
Posted: Sun Mar 24, 2013 01:44 AM
Recommended way to define xbrowse:
Code (fw): Select all Collapse
     REDEFINE XBROWSE oBrw DATASOURCE oQry ;
              COLUMNS "Codigo","Nombre";
              HEADERS "Codigo","Nombre";  // optional
              SIZES 100,500;
              ID 111 OF oDlg AUTOSORT
     REDEFINE SAY oBrw:oSeek PROMPT oBrw:cSeek ID 113 OF oDlg
//     SetDolphin( oBrw, oQry, .F. ) // remove this line


Notes:
#1. Important "DATASOURCE oQry". If we specify this, xbrowse command itself calls oBrw:SetDolphin( oQry ... )
#2. HEADERS column is optional when column names are same as header names
Regards



G. N. Rao.

Hyderabad, India
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: AUTOSORT en xBrowse con dolphin
Posted: Sun Mar 24, 2013 01:58 AM

Muchas gracias nageswaragunupudi por la recomendacion!
Probare!!

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: AUTOSORT en xBrowse con dolphin
Posted: Sun Mar 24, 2013 02:07 AM

I have edited my post and modified the code.
Please use the revised code.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: AUTOSORT en xBrowse con dolphin
Posted: Sun Mar 24, 2013 01:47 PM
Probe como me dijiste y funciona perfecto.

Code (fw): Select all Collapse
DEFINE DIALOG oDlg RESOURCE "ABMS" OF oWnd1
     REDEFINE XBROWSE oBrw DATASOURCE oQry;
              COLUMNS "Codigo","Nombre";
              SIZES 100,500;
              ID 111 OF oDlg AUTOSORT ON DBLCLICK Formu( oServer, .f.)
     REDEFINE SAY oBrw:oSeek PROMPT "" ID 113 OF oDlg
     oQry:bOnChangePage := {|| oBrw:Refresh() }
     PintaBrw(oBrw)
     ACTIVATE DIALOG oDlg NOWAIT ON INIT oDlg:Move(0,0)

Ahora me pasa algo raro como explico en http://forums.fivetechsupport.com/viewtopic.php?f=6&t=25941, alguna idea?
Gracias por responder

Continue the discussion