When the Method Initiate() is invoked, the control already exists and ::hWnd should be valid too ![]()
When the Method Initiate() is invoked, the control already exists and ::hWnd should be valid too ![]()
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.

Rick,
If we take FWH/samples/combos.prg as a reference, there are three combos. Which combo behavior is the right for you ? thanks ![]()
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
Antonio ..
Just wanted to see if you had a chance to look at my results from the previous post?
Many Thanks!
Rick Lipkin
Rick,
I missed your previous post, don't know why, sorry ![]()
I am going to review your comments, thanks
// 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:GetText() ),;
// oCbx2:Add( oCbx2: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
//----------------------------------------------------------------------------//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 nKeyfunction 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 nKeyAntonio
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
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... ![]()
{ "one ", "two ", "three " }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
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