I wish when I click on first column ( SetMultiSelectCol) call the function btnbar() ( change the buttonbar) and refreshtitle() ( change dialog title)
I tried with
- Code: Select all Expand view
WITH OBJECT oBrw:aCols[1]
:bLClicked := { |r,c,f,oBrw| If( ( f := AScan( oBrw:aSelected, oBrw:BookMark ) ) == 0, ;
(AAdd( oBrw:aSelected, oBrw:BookMark ),Btnbar(2,oDlg:oBar,oDlg,oDbf,oBrw)), ;
(ADel( oBrw:aSelected, f, .t. ),IiF(LEN(oBrw:aSelected)==0,Btnbar(1,oDlg:oBar,oDlg,oDbf,oBrw),)) ), ;
Refresh_title(oBrw,oDlg,oDbf,cTitle),;
oBrw:RefreshCurrent() }
END
but not work and make error give me error on :bLClicked
this is a small sample
- Code: Select all Expand view
- // sample with SetMultiSelectCol
#include 'fivewin.ch'
#include 'xbrowse.ch'
#DEFINE TXT_DISPLAY_ITEMS " displayed items)"
#DEFINE TXT_ITEM_SELECTED " item selected on "
#DEFINE TXT_ITEMS_SELECTED " items selected on "
#DEFINE TXT_SEARCH " search "
function Main()
local oDlg, oBrw, oFont,oBar,oDbf
local cTitle := "Customers"
oDbf :=TDatabase():Open( , "Customer", "DBFCDX", .T. )
oDbf:setorder(1)
oDbf:Gotop()
DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14
DEFINE DIALOG oDlg SIZE 640,440 PIXEL ;
FONT oFont
@ 40, 2 XBROWSE oBrw OF oDlg SIZE -5,-2 PIXEL ;
AUTOCOLS DATASOURCE oDbf NOBORDER
MyStyleBrowse(oBrw)
WITH OBJECT oBrw
:SetMultiSelectCol()
/* WITH OBJECT oBrw:aCols[1]
:bLClicked := { |r,c,f,oBrw| If( ( f := AScan( oBrw:aSelected, oBrw:BookMark ) ) == 0, ;
(AAdd( oBrw:aSelected, oBrw:BookMark ),Btnbar(2,oDlg:oBar,oDlg,oDbf,oBrw)), ;
(ADel( oBrw:aSelected, f, .t. ),IiF(LEN(oBrw:aSelected)==0,Btnbar(1,oDlg:oBar,oDlg,oDbf,oBrw),)) ), ;
Refresh_title(oBrw,oDlg,oDbf,cTitle),;
oBrw:RefreshCurrent() }
END
*/
:lHScroll := .f.
:CreateFromCode()
END
FOR i := 2 TO Len( oBrw:aCols )
oCol := oBrw:aCols[ i ]
oCol:bLDClickData := {|| oBrw:edit() }
NEXT
ACTIVATE DIALOG oDlg CENTERED;
ON INIT ( Btnbar(0,oBar,oDlg,oDbf,oBrw) ,;
Btnbar(1,oDlg:oBar,oDlg,oDbf,oBrw) ,;
Refresh_title(oBrw,oDlg,oDbf,cTitle))
RELEASE FONT oFont
return nil
//-----------------------------------------------------------------------------------------//
Function Btnbar(nBar,oBar,oDlg,oDbf,oBrw) // ,aBtnBar
local aBtnBar
local x
if Valtype( oBar ) = "O"
For x := Len( oBar:aControls ) to 1 step - 1
oBar:Del( x )
Next x
endif
Do case
case nbar = 0
DEFINE BUTTONBAR oBar OF oDlg SIZE 80,70 TOP NOBORDER 2015
case nbar = 1
aBtnBar := array(6)
DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New" ;
ACTION NIL
DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify" ;
ACTION NIL GROUP WHEN oDbf:OrdKeyCount() > 0
DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplicate" ;
ACTION NIL WHEN oDbf:OrdKeyCount() > 0
DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Del" ;
ACTION NIL WHEN oDbf:OrdKeyCount() > 0
DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print" ;
ACTION oBrw:Report() GROUP WHEN oDbf:OrdKeyCount() > 0
DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help" RESOURCE "HLP_DLG" ;
ACTION NIL BTNRIGHT
case nbar = 2
aBtnBar := array(3)
DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "Del" ;
ACTION NIL WHEN oDbf:OrdKeyCount() > 0
DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Print" ;
ACTION oBrw:Report() GROUP WHEN oDbf:OrdKeyCount() > 0
DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Help" ;
ACTION NIL BTNRIGHT
endcase
return oBar
//--------------------------------------------------------------------------//
Function Refresh_title(oBrw,oDlg,oDbf,cTitle)
local nCounter
local cString
IF Len(oBrw:aSelected) >=1
If Len(oBrw:aSelected) = 1
cString := " ( " +ltrim(Str( Len(oBrw:aSelected)))+ TXT_ITEM_SELECTED +lTrim(str(oDbf:KeyCount()))+TXT_DISPLAY_ITEMS
else
cString := " ( " +ltrim(Str( Len(oBrw:aSelected)))+TXT_ITEMS_SELECTED +lTrim(str(oDbf:KeyCount()))+TXT_DISPLAY_ITEMS
Endif
else
cString :=" ( "+lTrim(str(oDbf:KeyCount()))+TXT_DISPLAY_ITEMS
Endif
oDlg:SetText( cTitle+cString)
return Nil
//--------------------------------------------------------------------------//
Function MyStyleBrowse(oBrw)
local nColorPigiama := RGB(243,243,238)
WITH OBJECT oBrw
:nRowHeight := 25
:l2007 := .F.
:l2015 := .T.
:lRecordSelector := .F.
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:nStretchCol := STRETCHCOL_WIDEST
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:lAllowRowSizing := .F.
:lAllowColSwapping := .F.
:lAllowColHiding := .F.
:lAllowSizings := .F.
:lDrawBorder := .t.
:nClrBorder := Rgb(195,195,185)
:bRecSelHeader := ""
:bClrStd := { || { CLR_BLACK, If( oBrw:KeyNo % 2 == 0, CLR_WHITE,nColorPigiama ) } }
END
return nil