BUG: COMBOBOX with style CBS_DROPDOWN
BUG: COMBOBOX with style CBS_DROPDOWN
If using such Combobox and skip on a database, a userdefined field-text from a record are changed to the last selected text from the combobox in another record if the Combobox becomes Focus or clicking on the arrow. Also the colors from SetGetColorFocus() not using.
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Gunther
Hope this thread helps some ..
http://forums.fivetechsupport.com/viewt ... ox#p135522
As far as the appearance .. the answer is in the thread above.
Rick Lipkin
Hope this thread helps some ..
http://forums.fivetechsupport.com/viewt ... ox#p135522
As far as the appearance .. the answer is in the thread above.
Code: Select all
oCbx:oGet:SetFont( oFont )
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Thanks Rick, but not the font becomes different, just the free text (as CBS-DROPDOWN made possible to write free text) in this record becomes (if i open the Combobox) the same value, in another record was selected from the combobox-list and the free-text is erased.
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Here is a little test-program to show the Situation.
Code: Select all
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
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Antonio, this is very important to me. But i found no solution for this.
Antonio, i had sent to you a privat E-Mail for updating my FWH but no answer!?
Antonio, i had sent to you a privat E-Mail for updating my FWH but no answer!?
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Günther,
I have just seen your example and I am going to test it.
I have not received any emails from you, unless gmail move it to the spam folder... (edited: nothing in the spam folder also)
Please resend it, thanks
I have just seen your example and I am going to test it.
I have not received any emails from you, unless gmail move it to the spam folder... (edited: nothing in the spam folder also)
Please resend it, thanks
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Thanks!
Antonio, i have sent it to alinares@fivetechsoft.com! I resend it.
Antonio, i have sent it to alinares@fivetechsoft.com! I resend it.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Günther,
Please resend me your email, as I have not received it.
Your example fails because the first value you place in the field does not match any of the values in the combobox.
Please try your example with some little modifications from me and you will see that it works fine
Please resend me your email, as I have not received it.
Your example fails because the first value you place in the field does not match any of the values in the combobox.
Please try your example with some little modifications from me and you will see that it works fine
Code: Select all
#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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Antonio, i think, style CBS_DROPDOWN lets me also another text to input (as it have a oGet-object), not only text from the list?
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Günther,
Yes, good observation
With this little change in combobox.prg, your original example works fine:
METHOD Set( cNewItem ) CLASS TComboBox
...
if ValType( cNewItem ) == "N" .or. nAt != 0 .and. ::oGet == nil
...
Included for next FWH build
Yes, good observation
With this little change in combobox.prg, your original example works fine:
METHOD Set( cNewItem ) CLASS TComboBox
...
if ValType( cNewItem ) == "N" .or. nAt != 0 .and. ::oGet == nil
...
Included for next FWH build
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Antonio, this solution is unperfected. Please test this new code with more the 2 records. This shows the problem more exact. And please show that SetGetColorFocus() not functioning on this ::oGet.
Code: Select all
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Günther,
Please try this change:
Please try this change:
Code: Select all
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
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Antonio, now all is OK!!! Thanks.
Only a second place in Combobox.prg is also to update:
Only a second place in Combobox.prg is also to update:
Code: Select all
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() )
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Günther,
Already included for the next FWH build, many thanks
Great feedback from you, thanks
Already included for the next FWH build, many thanks
Great feedback from you, thanks