while combobox run correclty.
I use customer.dbf
the test
- Code: Select all Expand view RUN
#include "fivewin.ch"
REQUEST DBFCDX
#define TXT_COLORE1 nRgb( 245,244,234)
#define TXT_COLORE2 nRgb(233,229,206)
#define TXT_COLORE3 RGB( 238,236,219 )
#define TXT_COLORE4 nRgb(218,214,179)
Static lToolbar
function Main()
local oWnd, oBar, oMenu
RddSetDefault( "DBFCDX" )
DEFINE WINDOW oWnd MDI TITLE "Test"
DEFINE BUTTONBAR oBar OF oWnd SIZE 100,32
DEFINE BUTTON OF oBar PROMPT "Customer" CENTER ACTION Customer()
ACTIVATE WINDOW oWnd
return nil
//-----------------------------------------------------------//
Function Customer()
local oTable
local oCust
local aBrowse
local ctitle :="Table of Customer"
oCust:=Tdatabase():Open( , "Customer", "DBFCDX", .T. )
oCust:SetOrder("FIRST")
oCust:Gotop()
aBrowse := { ;
{ "FIRST" , "Surname" ,, 140, },;
{ "LAST" , "Name" ,, 150, },;
{ "STREET" , "Address" ,, 150, },;
{ "CITY" , "City" ,, 150, },;
{ "STATE" , "State" ,, 150, },;
{ "ZIP" , "Zip" ,, 150, },;
{ "HIREDATE" , "Hiredate" ,, 150, },;
{ "MARRIED" , "Married" ,, 150, },;
{ "AGE" , "Years" ,, 150, },;
{ "SALARY" , "Salary" ,, 150, },;
{ "NOTES" , "Comment" ,, 150, }}
XBrowseTable(oCust,aBrowse,ctitle,,.t.)
return nil
//---------------------------------------------------------------------//
Function XBrowseTable(oDbf,aBrowse,ctitle,lShowRec,lselectMulti)
local oDlgLook,oToolBar,oFont,oBold
local oGetSearch,oSaySearch:=array(2)
local cSeek:=space(100)
local nHt := Int( ScreenHeight() * 0.4 )
local nWd := 750
local oBrwlook,oHand
DEFAULT lShowRec:=.f. ,;
lselectMulti:=.f.
lToolbar:=.t. //On off Toolbar
DEFINE CURSOR oHand HAND
DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-9
DEFINE FONT oBold NAME 'TAHOMA' SIZE 0,-9 BOLD
DEFINE DIALOG oDlgLook TITLE ctitle ;
SIZE nWd, nHt PIXEL ; //
STYLE nOr( WS_OVERLAPPEDWINDOW ) FONT oFont
IF lToolBar
DEFINE BUTTONBAR oToolBar OF oDlgLook SIZE 22,22 TOP 2015 NOBORDER
DEFINE BUTTON OF oToolBar RESOURCE FWBitmap( "top2" ) ;
ACTION oBrwlook:KeyDown(VK_HOME, 0) WHEN oDbf:OrdKeyCount() > 0
DEFINE BUTTON OF oToolBar RESOURCE FwBitmap( "previous2" ) ;
ACTION oBrwlook:KeyDown(VK_UP, 0) WHEN oDbf:OrdKeyCount() > 0
DEFINE BUTTON OF oToolBar RESOURCE FWBitmap( "next2" ) ;
ACTION oBrwlook:KeyDown(VK_DOWN, 0) WHEN oDbf:OrdKeyCount() > 0
DEFINE BUTTON OF oToolBar RESOURCE FWBitmap( "bottom2" ) ;
ACTION oBrwlook:KeyDown(VK_END, 0) WHEN oDbf:OrdKeyCount() > 0
DEFINE BUTTON OF oToolBar RESOURCE FWBitmap( "printer" );
ACTION oBrwlook:Report() WHEN oDbf:OrdKeyCount() > 0
oToolBar:bClrGrad = { | lInvert | If( ! lInvert,;
{ { 1, RGB( 244, 244, 245 ), RGB( 244, 244, 245 ) } },;
{ { 1, RGB( 145, 201, 247 ), RGB( 145, 201, 247 ) } } ) }
AEval( oToolBar:aControls, { | o | o:oCursor := oHand } )
ENDIF
IF lToolBar
@ 110,10 XBROWSE oBrwlook SIZE -2, -5 PIXEL OF oDlgLook ;
DATASOURCE oDbf COLUMNS aBrowse ;
AUTOSORT ;
NOBORDER CELL LINES
else
@ 0,0 XBROWSE oBrwlook SIZE -2, -5 PIXEL OF oDlgLook ;
DATASOURCE oDbf COLUMNS aBrowse ;
AUTOSORT ;
NOBORDER CELL LINES
Endif
WITH OBJECT oBrwlook
:lIncrFilter := .t.
:bOnSort := { |b,oCol| oBrwlook:Seek( "" ), ;
oBrwlook:cFilterFld := oCol:cExpr, ;
oBrwlook:SetFocus() }
:oSeek := oGetSearch
:CreateFromCode()
END
oBrwlook:bRClicked := {|nRow,nCol| MenuDisplay(nRow,nCol,@ltoolBar,oBrwlook,oDlgLook) }
oDlgLook:bResized := <||
local oRect := oDlgLook:GetCliRect()
IF lToolbar
oBrwlook:nTop := oRect:nTop+24
oBrwlook:nLeft := oRect:nLeft
oToolBar:Show()
ELSE
oBrwlook:nTop := oRect:nTop
oBrwlook:nLeft := oRect:nLeft
oToolBar:Hide()
ENDIF
oBrwlook:setfocus()
oBrwlook:refresh()
RETURN nil
>
Activate Dialog oDlgLook CENTER;
ON INIT (GetSearch(oToolBar,lToolbar,cSeek,oGetSearch,oBrwlook,oSaySearch,oFont,oBold),;
Eval(oDlgLook:bResized()) )
RETURN NIL
//---------------------------------------------------------------------------//
Function MenuDisplay(nRow,nCol,lToolbar,oBrwlook,oDlgLook)
local oMenu
local otoolBarCheck
MENU oMenu POPUP
MENUITEM " "
SEPARATOR
MENUITEM oToolBarCheck Prompt "Show ToolBar" ;
ACTION ( ltoolBar :=!ltoolBar,;
Eval( oDlgLook:bResized),;
oBrwLook:refresh(),;
oToolBarCheck:SetCheck( ltoolBar ))
SEPARATOR
ENDMENU
oToolBarCheck:SetCheck( ltoolBar )
ACTIVATE POPUP oMenu OF oDlgLook AT oBrwLook:nTop+nRow, oBrwLook:nLeft+nCol
RETURN (NIL)
//------------------------------------------------------------------------------//
Function GetSearch(oToolBar,lToolbar,cSeek,oGetSearch,oBrwlook,oSaySearch,oFont,oBold)
IF lToolBar
@ 5, 210 SAY oSaySearch[1] Prompt "Search:" SIZE 46,24 PIXEL OF oToolBar FONT oBold COLOR CLR_BLACK,RGB( 244, 244, 245 )
@ 0, 270 GET oGetSearch VAR cSeek SIZE 120,24 PIXEL OF oToolBar ;
BITMAP "ELIMINA" ACTION (cSeek := Space( 100 ),;
oBrwlook:Seek( "" ),oBrwLook:refresh(),oGetSearch:refresh())
oGetSearch:lBtnTransparent :=.t.
@ 5, 395 SAY oSaySearch[2] Prompt "Into" SIZE 40,24 PIXEL OF oToolBar FONT oBold COLOR CLR_BLACK,RGB( 244, 244, 245 )
@ 0, 420 COMBOBOX oBrwlook:oSortCbx VAR oBrwlook:cSortOrder;
SIZE 100,400 PIXEL OF oToolBar HEIGHTGET 14 STYLE CBS_DROPDOWN
Endif
return nil
//-----------------------------------------------------------------------------------//