jose_murugosa wrote:Thank you very much Mr. Rao!!
function PopupBrowse( aValue, oGet, bInit, nColumn, aHeaders ) //agregue aHeaders
//
local oDlg, oBrw
local bGetValid, uOrgl
local aPoint := { oGet:nTop + oGet:nHeight, oGet:nLeft }
local n //agregue la variable n
.......codigo popupbrowse.....
oBrw:AutoFit()
oBrw:lFastDraw := .t.
//codigo modificado
IF aHeaders != nil
FOR n = 1 to Len( aHeaders )
oBrw:aCols[n]:cHeader:= aHeaders[n]
NEXT n
ENDIF
//fin codigo modificado
.......codigo popupbrowse.....
return nil
function maindialog()
local oDlg, oGet, cVar, aItems, aHeaders
aItems:={ {"Vaca", "Va", "Hereford", 2}, ;
{"Novillo", "Nov", "Angus", 2}, ;
{"Vaquillona", "Vaq", "Holando", 2}, ;
{"Toro", "To", "Cruza", 2} }
aHeaders:= { "Categoria", "Abrevia", "Raza", "Dato" } //headers del browse
DEFINE DIALOG oDlg FROM 0,0 to 40, 70
@ 50, 50 GET oGet VAR cVar SIZE 200, 22 OF oDlg ACTION PopupBrowse( aItems, oGet, { || ASort( aItems, , , {|x,y| x[2] < y[2] } ) }, 3, aHeaders ) Pixel
oGet:bKeyDown := { | nKey | If( nKey == VK_F4, PopupBrowse( aItems, oGet, { || ASort( aItems, , , {|x,y| x[2] < y[2] } ) }, 3 ), aHeaders ) }
ACTIVATE DIALOG oDlg Center
return nil
aHeaders := { "Categoria", "Abrevia", "Raza", "Dato" } //headers del browse
bInit := { | o | o:aHeaders := aHeaders, ASort( aItems, , , {|x,y| x[2] < y[2] } ) }
DEFINE DIALOG oDlg FROM 0,0 to 40, 70
@ 50, 50 GET oGet VAR cVar SIZE 200, 22 OF oDlg ACTION PopupBrowse( aItems, oGet, bInit, 3 ) Pixel
#include "Fivewin.ch"
function main()
local oDlg, oGet, cVar, aItems, aHeaders, bInit
aItems:={ {"Vaca", "Va", "Hereford", 2}, ;
{"Novillo", "Nov", "Angus", 2}, ;
{"Vaquillona", "Vaq", "Holando", 2}, ;
{"Toro", "To", "Cruza", 2} }
aHeaders := { "Categoria", "Abrevia", "Raza", "Dato" } //headers del browse
bInit := { | o | MyInit( o, aHeaders ), ASort( aItems, , , {|x,y| x[2] < y[2] } ) }
DEFINE DIALOG oDlg FROM 0,0 to 40, 70
@ 50, 50 GET oGet VAR cVar SIZE 200, 22 OF oDlg ;
ACTION PopupBrowse( aItems, oGet, bInit, 3 ) Pixel
//ACTION PopupBrowse( aItems, oGet, { || ASort( aItemso, , , {|x,y| x[2] < y[2] } ) }, 3, aHeaders ) Pixel
// oGet:bKeyDown := { | nKey | If( nKey == VK_F4, PopupBrowse( aItems, oGet, { || ASort( aItems, , , {|x,y| x[2] < y[2] } ) }, 3 ), aHeaders ) }
ACTIVATE DIALOG oDlg Center
return nil
//----------------------------------------------------------------------------//
Function MyInit( oBrw, aHeaders )
local bInit
local n
For n = 1 to Len( oBrw:aCols )
oBrw:aCols[ n ]:cHeader := aHeaders[ n ]
Next n
Return nil
//----------------------------------------------------------------------------//
#include "Fivewin.ch"
function main()
local oDlg
local oGet
local cVar
local aItems
local aHeaders
local bInit
aItems:={ {"Vaca", "Va", "Hereford", 2}, ;
{"Novillo", "Nov", "Angus", 2}, ;
{"Vaquillona", "Vaq", "Holando", 2}, ;
{"Toro", "To", "Cruza", 2} }
aHeaders := { "Categoria", "Abrevia", "Raza", "Dato" } //headers del browse
bInit := < | oBrw |
local n
For n = 1 to Len( oBrw:aCols )
oBrw:aCols[ n ]:cHeader := aHeaders[ n ]
Next n
ASort( aItems, , , {|x,y| x[2] < y[2] } )
Return nil
>
DEFINE DIALOG oDlg FROM 0,0 to 40, 70
@ 50, 50 GET oGet VAR cVar SIZE 200, 22 OF oDlg ;
ACTION PopupBrowse( aItems, oGet, bInit, 3 ) Pixel
ACTIVATE DIALOG oDlg Center
return nil
//----------------------------------------------------------------------------//
cnavarro wrote:A mi me gusta mas hacerlo asi
- Code: Select all Expand view
#include "Fivewin.ch"
function main()
local oDlg
local oGet
local cVar
local aItems
local aHeaders
local bInit
aItems:={ {"Vaca", "Va", "Hereford", 2}, ;
{"Novillo", "Nov", "Angus", 2}, ;
{"Vaquillona", "Vaq", "Holando", 2}, ;
{"Toro", "To", "Cruza", 2} }
aHeaders := { "Categoria", "Abrevia", "Raza", "Dato" } //headers del browse
bInit := < | oBrw |
local n
For n = 1 to Len( oBrw:aCols )
oBrw:aCols[ n ]:cHeader := aHeaders[ n ]
Next n
ASort( aItems, , , {|x,y| x[2] < y[2] } )
Return nil
>
DEFINE DIALOG oDlg FROM 0,0 to 40, 70
@ 50, 50 GET oGet VAR cVar SIZE 200, 22 OF oDlg ;
ACTION PopupBrowse( aItems, oGet, bInit, 3 ) Pixel
ACTIVATE DIALOG oDlg Center
return nil
//----------------------------------------------------------------------------//
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 40 guests