#include "Fivewin.ch"
function Main()
field RadJed_ID, Naziv
local aStruct, oBrw, oCol, oDlgBrow, oFontBrw
aStruct := {{"RadJed_Id","C",3,0},;
{"Naziv","C",30,0}}
dbCreate( "TEMPODE", aStruct )
USE TEMPODE NEW
/*
nErr := oSql:exec("SELECT * FROM " + cRadJed,,.t.,,"TempOde.dbf")
if nErr != 0
MsgInfo("Greška pri upitu","Greška")
endif
*/
FW_ArrayToDbf( { { "123", "ABC" }, { "234", "" }, { "345", "GHI" }, { "456", "" } } )
GO TOP
DEFINE FONT oFontBrw NAME "ARIAL" SIZE 0,-14
DEFINE DIALOG oDlgBrow TITLE "SPISAK RADNIH JEDINICA" SIZE 460,300 PIXEL
@ 40,10 XBROWSE oBrw SIZE -10,-10 PIXEL ALIAS "TempOde" OF oDlgBrow NOBORDER
oCol := oBrw:AddCol()
oCol:AddBmpFile( "c:\fwh\bitmaps\off.bmp" )
oCol:AddBmpFile( "c:\fwh\bitmaps\on.bmp" )
oCol:cHeader := " "
oCol:bBmpData := { || iif( empty(TempOde->Naziv) ,1,2) }
oCol:oDataFont := oFontBrw
oCol := oBrw:AddCol()
oCol:bStrData := { || RadJed_Id}
oCol:cHeader := "Šifra"
oCol:nWidth := 40
oCol:bLClickHeader = { | nMRow, nMCol, nFlags, Self | If( ::nHeadBmpNo == 2, ::nHeadBmpNo := 1, ::nHeadBmpNo := 2 ),DBSelectArea("TempOde"),DBCREATEINDEX("TempOde","RadJed_Id",{|| RadJed_Id}), ::oBrw:Refresh() }
oCol:oDataFont := oFontBrw
oCol := oBrw:AddCol()
oCol:bStrData := { || Naziv}
oCol:cHeader := "Odeljenje"
oCol:bLClickHeader = { | nMRow, nMCol, nFlags, Self | If( ::nHeadBmpNo == 2, ::nHeadBmpNo := 1, ::nHeadBmpNo := 2 ),DBSelectArea("TempOde"),DBCREATEINDEX("TempOde","Naziv",{|| Naziv}), ::oBrw:Refresh() }
oCol:oDataFont := oFontBrw
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLWIN7
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:lColDividerComplete := .t.
oBrw:nHeaderLines := 1
oBrw:nFooterLines := 1
oBrw:nDataLines := 1
oBrw:lFooter := .t.
oBrw:SetRDD() // Remove this line. Superfluous and not desirable
oBrw:bRClicked := { | nRow, nCol | ShowPopup( nRow, nCol, oDlgBrow, oBrw ) }
oBrw:bLDblClick = { | nRow, nCol | TraRJ(TempOde->RadJed_Id),oDlgBrow:End() }
oBrw:bKeyChar = { | nKey, nFlags | if( nKey==VK_RETURN,(TraRJ(TempOde->RadJed_Id),oDlgBrow:End()),NIL) }
oBrw:CreateFromCode()
@ 10,10 BUTTON "Štampaj" SIZE 40,15 PIXEL OF oDlgBrow ACTION ( oBrw:Report( "SPISAK RNIH JEDINICA" ), oBrw:SetFocus() )
ACTIVATE DIALOG oDlgBrow CENTERED ON INIT oBrw:SetFocus()
RELEASE FONT oFontBrw
return nil
static function TraRJ();return nil
static function ShowPopup();return nil