oCbx:oGet:SetFont( oFont )
function test()
local oDlg , oCombo1
dbcreate("testdb.dbf",{{"feld1","C",10,0}})
USE
USE ("testdb.dbf") ALIAS "testdb" NEW EXCLUSIVE
testdb->(dbappend())
testdb->feld1 := "ABCDEFGHIJ"
testdb->(dbappend())
testdb->feld1 := replicate("B",len(testdb->feld1))
testdb->(dbgotop())
DEFINE DIALOG oDlg TITLE "Combobox CBS_DROPDOWN Test" FROM 0,0 TO 300,300 PIXEL
@ 2, 2 COMBOBOX oCombo1 VAR testdb->feld1 PROMPTS {replicate("A",len(testdb->feld1)),replicate("B",len(testdb->feld1))} OF oDlg SIZE 80,10 STYLE CBS_DROPDOWN UPDATE
@ 4, 1 BUTTON "<" OF oDlg ACTION if(testdb->(recno())>1,(testdb->(dbskip(-1)),oDlg:update()),msginfo("Begin of DB"))
@ 4, 10 BUTTON ">" OF oDlg ACTION if(testdb->(recno())<2,(testdb->(dbskip(1)),oDlg:update()),msginfo("End of DB"))
@ 6,1 SAY "1. Go with > to the second record."+CRLF+"2. Go with < return to the first record"+CRLF+"3. Open the Combobox with the arrow"+CRLF+CRLF+;
"Now you see, that the first record also is 'BBBBBBBBBB'" SIZE 200,50
ACTIVATE DIALOG oDlg
USE
return nil
#include "FiveWin.ch"
function Main()
local oDlg , oCombo1
dbcreate("testdb.dbf",{{"feld1","C",10,0}})
USE
USE ("testdb.dbf") ALIAS "testdb" NEW EXCLUSIVE
testdb->(dbappend())
testdb->feld1 := replicate( "A", len( testdb->feld1 ) ) // "ABCDEFGHIJ"
testdb->(dbappend())
testdb->feld1 := replicate( "B", len( testdb->feld1 ) )
testdb->(dbgotop())
DEFINE DIALOG oDlg TITLE "Combobox CBS_DROPDOWN Test" FROM 0,0 TO 300,300 PIXEL
@ 2, 2 COMBOBOX oCombo1 VAR testdb->feld1 ;
PROMPTS {replicate("A",len(testdb->feld1)),replicate("B",len(testdb->feld1))} ;
OF oDlg SIZE 80, 40 STYLE CBS_DROPDOWN UPDATE
@ 4, 1 BUTTON "<" OF oDlg ;
ACTION if(testdb->(recno())>1,(testdb->(dbskip(-1)),oDlg:update()),msginfo("Begin of DB"))
@ 4, 10 BUTTON ">" OF oDlg ;
ACTION if(testdb->(recno())<2,(testdb->(dbskip(1)),oDlg:update()),msginfo("End of DB"))
@ 6,1 SAY "1. Go with > to the second record." + CRLF + ;
"2. Go with < return to the first record" + CRLF + ;
"3. Open the Combobox with the arrow" + CRLF + CRLF + ;
"Now you see, that the first record also is 'BBBBBBBBBB'" SIZE 200, 50
ACTIVATE DIALOG oDlg CENTERED
USE
return nil
function test()
local oDlg , oCombo1
dbcreate("testdb.dbf",{{"feld1","C",10,0}})
USE
USE ("testdb.dbf") ALIAS "testdb" NEW EXCLUSIVE
testdb->(dbappend())
testdb->feld1 := replicate("A",len(testdb->feld1))
testdb->(dbappend())
testdb->feld1 := "ABCDEFGHIJ"
testdb->(dbappend())
testdb->feld1 := replicate("B",len(testdb->feld1))
testdb->(dbgotop())
SetGetColorFocus()
DEFINE DIALOG oDlg TITLE "Combobox CBS_DROPDOWN Test" FROM 0,0 TO 300,350 PIXEL
@ 1,2 SAY "Recno: "+alltrim(str(testdb->(recno()))) UPDATE
@ 2, 2 COMBOBOX oCombo1 VAR testdb->feld1 PROMPTS {replicate("A",len(testdb->feld1)),replicate("B",len(testdb->feld1))} OF oDlg SIZE 80,10 STYLE CBS_DROPDOWN UPDATE
@ 4, 1 BUTTON "<" OF oDlg ACTION if(testdb->(recno())>1,(testdb->(dbskip(-1)),oDlg:update()),msginfo("Begin of DB"))
@ 4, 10 BUTTON ">" OF oDlg ACTION if(testdb->(recno())<3,(testdb->(dbskip(1)),oDlg:update()),msginfo("End of DB"))
@ 6,1 SAY "1. Go with > to the second record."+CRLF+"2. Go with > to the third record"+CRLF+"3. Go with < return to the second record"+CRLF+"4. Open the Combobox with the arrow"+CRLF+CRLF+;
"Now you see, that the second record also is 'AAAAAAAAAA'" SIZE 200,50
ACTIVATE DIALOG oDlg
USE
return nil
METHOD LostFocus( hWndGetFocus ) CLASS TComboBox
local nAt := ::SendMsg( CB_GETCURSEL )
::Super:LostFocus( hWndGetFocus )
if nAt != CB_ERR
::nAt = nAt + 1
if ValType( Eval( ::bSetGet ) ) == "N"
Eval( ::bSetGet, nAt + 1 )
else
Eval( ::bSetGet, If( ::oGet == nil, ::aItems[ nAt + 1 ], ::oGet:GetText() ) )
endif
else
Eval( ::bSetGet, GetWindowText( ::hWnd ) )
endif
return nil
METHOD VarGet() CLASS TComboBox
local cRet, nAt := ::SendMsg( CB_GETCURSEL )
if nAt != CB_ERR
::nAt = nAt + 1
//cRet := ::aItems[ nAt + 1 ]
cRet := If( ::oGet == nil, ::aItems[ nAt + 1 ], ::oGet:GetText() )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 81 guests