BUG: COMBOBOX with style CBS_DROPDOWN
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
When the Method Initiate() is invoked, the control already exists and ::hWnd should be valid too
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Antonio, i had sent to your private email the Combobox.prg with all my changes. Additional please note this points:
1.) SetFocusColor() is not activ
2.) Picture-clausula should also represented on the Combobox, not only while editing.
1.) SetFocusColor() is not activ
2.) Picture-clausula should also represented on the Combobox, not only while editing.
Last edited by byte-one on Mon Apr 15, 2013 9:20 pm, edited 1 time in total.
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Antonio
I have been watching this thread with interest .. One behavior that I have not seen discussed with CBS_DROPDOWN is the incremental search.
I like the fact that you can enter any text into the CBS_DROPDOWN and and the field accepts that text .. however ( as in my screenshot ) the incremental search does not activate like CBS_DROPDOWNLIST. ( fwh1203 )
I was hoping while you were looking at the Combobox code you might have a look at making the CBS_DROPDOWN behavior match the CBS_DROPDOWNLIST when you begin typing activating the incremental search.... I did not see that addressed in this thread and that feature may have been fixed since FWH1203 ?
Thanks
Rick Lipkin
I have been watching this thread with interest .. One behavior that I have not seen discussed with CBS_DROPDOWN is the incremental search.
I like the fact that you can enter any text into the CBS_DROPDOWN and and the field accepts that text .. however ( as in my screenshot ) the incremental search does not activate like CBS_DROPDOWNLIST. ( fwh1203 )
I was hoping while you were looking at the Combobox code you might have a look at making the CBS_DROPDOWN behavior match the CBS_DROPDOWNLIST when you begin typing activating the incremental search.... I did not see that addressed in this thread and that feature may have been fixed since FWH1203 ?
Thanks
Rick Lipkin
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Rick,
If we take FWH/samples/combos.prg as a reference, there are three combos. Which combo behavior is the right for you ? thanks
If we take FWH/samples/combos.prg as a reference, there are three combos. Which combo behavior is the right for you ? thanks
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Antonio
Combobox 2 ( cbs_dropdown ) does not search the array when you type in a value. In the screenshot .. I typed in the letter "T" into the CBS_Dropdown and T in the third combobox ( cbs_DropdownList) .. as you can see .. the behavior is quite different.
If the second combobox can incrementally seek the typed value .. I would be most pleased. It appears this code fails in my example.
Thanks
Rick Lipkin
Combobox 2 ( cbs_dropdown ) does not search the array when you type in a value. In the screenshot .. I typed in the letter "T" into the CBS_Dropdown and T in the third combobox ( cbs_DropdownList) .. as you can see .. the behavior is quite different.
If the second combobox can incrementally seek the typed value .. I would be most pleased. It appears this code fails in my example.
Thanks
Rick Lipkin
Code: Select all
REDEFINE COMBOBOX oCbx2 VAR cItem2 ITEMS { "One", "Two", "Three" } ;
ID ID_DROPDOWN OF oDlg ;
STYLE CBS_DROPDOWN ;
ON CHANGE ( cItem4 := cItem2, oSay:Refresh() ) ;
VALID ( If( ! oCbx2:Find( oCbx2:oGet:GetText() ),;
oCbx2:Add( oCbx2:oGet:GetText() ),), .t. )
oCbx2:oGet:bKeyDown = { | nKey | SearchItem( nKey, oCbx2 ) } // fails to find
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Antonio ..
Just wanted to see if you had a chance to look at my results from the previous post?
Many Thanks!
Rick Lipkin
Just wanted to see if you had a chance to look at my results from the previous post?
Many Thanks!
Rick Lipkin
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Rick,
I missed your previous post, don't know why, sorry
I am going to review your comments, thanks
I missed your previous post, don't know why, sorry
I am going to review your comments, thanks
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Rick,
I have been doing some quick tests on combos.prg to see whats going on. I have not finished it yet, but this example helps to trace whats going on:
modified combos.prg
I have been doing some quick tests on combos.prg to see whats going on. I have not finished it yet, but this example helps to trace whats going on:
modified combos.prg
Code: Select all
// Showing the use of different styles of ComboBoxes controls
#include "FiveWin.ch"
#include "Combos.ch"
//----------------------------------------------------------------------------//
function Main()
local oDlg, oSay
local oCbx1, oCbx2, oCbx3
local cItem1, cItem2 := "One", cItem3, cItem4 := "None"
SET _3DLOOK ON
// SkinButtons()
DEFINE DIALOG oDlg RESOURCE "Combos"
REDEFINE COMBOBOX oCbx1 VAR cItem1 ITEMS { "One", "Two", "Three" } ;
ID ID_SIMPLE OF oDlg ;
ON CHANGE ( cItem4 := cItem1, oSay:Refresh() ) ;
VALID ( cItem4 := cItem1, oSay:Refresh(), .t. )
REDEFINE COMBOBOX oCbx2 VAR cItem2 ITEMS { "One", "Two", "Three" } ;
ID ID_DROPDOWN OF oDlg ;
STYLE CBS_DROPDOWN ;
ON CHANGE ( cItem4 := cItem2, oSay:Refresh() ) ;
// VALID ( If( ! oCbx2:Find( oCbx2:oGet:GetText() ),;
// oCbx2:Add( oCbx2:oGet:GetText() ),), .t. )
oCbx2:oGet:bKeyChar = { | nKey | SearchItem( nKey, oCbx2 ) }
REDEFINE COMBOBOX oCbx3 VAR cItem3 ITEMS { "One", "Two", "Three" } ;
ID ID_DROPDOWNLIST OF oDlg ;
ON CHANGE ( cItem4 := cItem3, oSay:Refresh() ) ;
VALID ( cItem4 := cItem3, oSay:Refresh(), .t. )
REDEFINE SAY oSay PROMPT cItem4 ID ID_SELECTION OF oDlg COLOR "R+/W"
ACTIVATE DIALOG oDlg CENTERED
return nil
//----------------------------------------------------------------------------//
function SearchItem( nKey, oCbx )
local nAt, cText
if ! Empty( oCbx:oGet:GetText() )
oCbx:oGet:oGet:Insert( Chr( nKey ) )
cText = AllTrim( oCbx:oGet:oGet:buffer )
if ( nAt := AScan( oCbx:aItems, { | c | Upper( Left( c, Len( cText ) ) ) == ;
Upper( cText ) } ) ) != 0
MsgBeep()
oCbx:oGet:SetText( oCbx:aItems[ nAt ] )
return 0
endif
endif
return nKey
//----------------------------------------------------------------------------//
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
This version behaves better:
Code: Select all
function SearchItem( nKey, oCbx )
local nAt, cText
if nKey >= Asc( "a" ) .and. nKey >= Asc( "Z" )
oCbx:oGet:oGet:Insert( Chr( nKey ) )
cText = AllTrim( oCbx:oGet:oGet:buffer )
if ( nAt := AScan( oCbx:aItems, { | c | Upper( Left( c, Len( cText ) ) ) == ;
Upper( cText ) } ) ) != 0
MsgBeep()
oCbx:oGet:SetText( oCbx:aItems[ nAt ] )
return 0
endif
endif
return nKey
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
An enhanced version:
Code: Select all
function SearchItem( nKey, oCbx )
local nAt, cText
if nKey >= Asc( "a" ) .and. nKey >= Asc( "Z" )
oCbx:oGet:oGet:Insert( Chr( nKey ) )
cText = AllTrim( oCbx:oGet:oGet:buffer )
if ( nAt := AScan( oCbx:aItems, { | c | Upper( Left( c, Len( cText ) ) ) == ;
Upper( cText ) } ) ) != 0
MsgBeep()
oCbx:oGet:SetText( oCbx:aItems[ nAt ] )
oCbx:oGet:SetPos( oCbx:oGet:oGet:pos )
return 0
endif
endif
return nKey
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Antonio
It appears to be working .. however, now that it incrementally finds "One", "Two" or "Three" .. if the search finds a match, it does not allow you to keep adding letters for a user defined entry.
I think you are VERY CLOSE!!
Rick Lipkin
It appears to be working .. however, now that it incrementally finds "One", "Two" or "Three" .. if the search finds a match, it does not allow you to keep adding letters for a user defined entry.
I think you are VERY CLOSE!!
Rick Lipkin
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
If we find a way to increase the size (of the internal buffer) of a Clipper's GET then we may be able to have it too...
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
A quick workaround would be to use wider items:
I am trying to change the size of the Clipper GET without success yet...
Code: Select all
{ "one ", "two ", "three " }
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Antonio
Thats fine .. generally I build my arrays on the length of the field anyway .. Do I need to include the SearchItem function in my code or is that something that can be added to your FWH Libs?
Thanks
Rick Lipkin
Thats fine .. generally I build my arrays on the length of the field anyway .. Do I need to include the SearchItem function in my code or is that something that can be added to your FWH Libs?
Thanks
Rick Lipkin
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Rick,
We should place it inside Class TComboBox so there is no need to modify your sources
::oGet:bKeyChar is already used from the Class, so we need to implement a new method:
and in the two places where bKeyChar is used in the class, change them to this:
::oGet:bKeyChar = { | nKey | ::GetKeyChar( nKey ) }
We should place it inside Class TComboBox so there is no need to modify your sources
::oGet:bKeyChar is already used from the Class, so we need to implement a new method:
Code: Select all
METHOD GetKeyChar( nKey ) CLASS TComboBox
local nAt, cText
if ( nKey == VK_TAB .and. ! GetKeyState( VK_SHIFT ) ) .or. nKey == VK_RETURN
::oWnd:GoNextCtrl( ::hWnd )
return 0
else
if nKey == VK_TAB .and. GetKeyState( VK_SHIFT )
::oWnd:GoPrevCtrl( ::hWnd )
return 0
endif
endif
if nKey >= Asc( "a" ) .and. nKey >= Asc( "Z" )
::oGet:oGet:Insert( Chr( nKey ) )
cText = AllTrim( ::oGet:oGet:buffer )
if ( nAt := AScan( ::aItems, { | c | Upper( Left( c, Len( cText ) ) ) == ;
Upper( cText ) } ) ) != 0
MsgBeep()
::oGet:SetText( ::aItems[ nAt ] )
::oGet:SetPos( ::oGet:oGet:pos )
return 0
endif
endif
return nKey
::oGet:bKeyChar = { | nKey | ::GetKeyChar( nKey ) }