BUG: COMBOBOX with style CBS_DROPDOWN

User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by byte-one »

Antonio, all FW-users profit from the team!

And at least: Please show that SetGetColorFocus() not functioning on this ::oGet.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by Marco Turco »

Hi Antonio,
there are still problem with dropdown combobox.

When the dropdown combo hasn't the focus the values displayed is incorrect. See image 1
Only if I press the mouse button on the combo the right value appears. See image 2

Any ideas ?

Image 1 Image
Image 2 Image
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by byte-one »

Marco, has the Combobox clausula "UPDATE" ?
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by Marco Turco »

Yes of course
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by byte-one »

Can see no problems...!!??
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by Antonio Linares »

Marco,

have you applied the combobox fixes that I have published on this thread ? thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by Marco Turco »

Yes, I'll try to prepare a self-contained sample to show you the problem asap. Thanks
Best Regards,

Marco Turco
SOFTWARE XP LLP
Colin Haig
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by Colin Haig »

Hi Marco

I had the same problem with comboboxes - not showing the correct value

Code: Select all

METHOD Set( cNewItem ) CLASS TComboBox

   local nAt
      
   if ValType( cNewItem ) == "N"
      nAt = cNewItem
      if nAt == 0
         nAt = 1
      endif
   else
      nAt = AScan( ::aItems,;
                   { | cItem | Upper( AllTrim( cItem ) ) == ;
                               Upper( AllTrim( cNewItem ) ) } )
   endif
   if ValType( cNewItem ) == "N" .or. nAt != 0
      ::Select( nAt )
      Eval( ::bSetGet, cNewItem )
      SetWindowText( ::hWnd , cNewItem )  // added this line 
   else
      cNewItem := cValToChar( cNewItem )
      Eval( ::bSetGet, cNewItem )
      SetWindowText( ::hWnd , cNewItem )
   endif

return nil
 
Hope this helps

Cheers

Colin
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by Marco Turco »

Hi Colin,
solved with your code. Thank you very much.

Antonio, could you pls.add the Colin's fix to the next FWH release ? Thank you.
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by Antonio Linares »

Colin, Marco,

I modified Colin's code this way:

Code: Select all

METHOD Set( cNewItem ) CLASS TComboBox

   local nAt

   if ValType( cNewItem ) == "N"
      nAt = cNewItem
      if nAt == 0
         nAt = 1
      endif
   else
      nAt = AScan( ::aItems,;
                   { | cItem | Upper( AllTrim( cItem ) ) == ;
                               Upper( AllTrim( cNewItem ) ) } )
   endif

   if ValType( cNewItem ) == "N" .or. nAt != 0 .and. ::oGet == nil
      ::Select( nAt )
   else
      cNewItem := cValToChar( cNewItem )
   endif

   Eval( ::bSetGet, cNewItem )
   SetWindowText( ::hWnd , cNewItem )
   
return nil
 
Included for the next FWH build, thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by byte-one »

Antonio, with the last changes "COMBOBOX from code" is now ok but on "REDEFINE COMBOBOX" the ::oGet is created in all cases (tested with a characterlist) also on pure CBS_DROPDOWNLIST.
I found the

Code: Select all

if lAnd( ::nStyle, CBS_DROPDOWN )
is not correct!?
lAnd(2,3) == .T.
lAnd(3,2) == .T.
What function can i use to gain the information from the RC-file that a Combobox is style CBS_DROPDOWN or CBS_DROPDOWNLIST ???
I have tested

Code: Select all

if !lAnd( ::nStyle, CBS_DROPDOWNLIST )
and it seems functioning. But sideeffects must check Antonio.

This block of code in ::new is to transfer in ::init (parts are already in ::init)

Code: Select all

 if ::oGet != nil
      ::oGet:hWnd = GetWindow( ::hWnd, GW_CHILD )
      ::oGet:Link()
      ::oGet:bLostFocus = ;
      {| hCtlFocus, nAt, cItem| cItem := GetWindowText( ::hWnd ), ;
      nAt := ::SendMsg( CB_FINDSTRING, 0, Trim( cItem )) + 1,;
      Eval( ::bSetGet, cItem ),;
      ::Select( nAt ),;
      SetWindowText( ::hWnd, cItem ),;
      If( ::bValid != nil .and. ;
      GetParent( hCtlFocus ) == GetParent( ::hWnd ),;
      If( ! Eval( ::bValid, ::oGet, Self ),;
      ::PostMsg( WM_SETFOCUS ),),) }
      ::oGet:SetFont( ::oFont )
      ::oGet:bKeyChar = { | nKey | If( ( nKey == VK_TAB .and. ! GetKeyState( VK_SHIFT ) ) .or. ;
                                         nKey == VK_RETURN,;
                                       ( ::oWnd:GoNextCtrl( ::hWnd ), 0 ),;
                                       If( nKey == VK_TAB .and. GetKeyState( VK_SHIFT ),;
                                       ( ::oWnd:GoPrevCtrl( ::hWnd ), 0 ),) ) }
   endif
This code from ::redefine is in this case not required

Code: Select all

 ::oGet:bKeyChar = { | nKey | If( ( nKey == VK_TAB .and. ! GetKeyState( VK_SHIFT ) ) .or. ;
                                         nKey == VK_RETURN,;
                                       ( ::oWnd:GoNextCtrl( ::hWnd ), 0 ),;
                                       If( nKey == VK_TAB .and. GetKeyState( VK_SHIFT ),;
                                       ( ::oWnd:GoPrevCtrl( ::hWnd ), 0 ),) ) }
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by byte-one »

Antonio, please check my last post.
What function can i (we) use to gain the information from the RC-file that a Combobox has a decidedly style ???
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by Antonio Linares »

Günther,

See these defines:

#define CBS_DROPDOWN 0x0002
#define CBS_DROPDOWNLIST 0x0003

So you could use:

nAnd( GetWindowLong( ::hWnd, GWL_STYLE ), CBS_DROPDOWNLIST ) == CBS_DROPDOWNLIST

Don't use CBS_DROPDOWN in the above line, because CBS_DROPDOWN is contained in CBS_DROPDOWNLIST:

CBS_DROPDOWN ==> 0000 0010
CBS_DROPDOWNLIST ==> 000 0011
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by byte-one »

From what moment on i can use GetWindowLong( ::hWnd, GWL_STYLE )->(::hWnd is existent)? Can we transfer the definition from the ::oGet in method init()?
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Post by Antonio Linares »

Günther,

From this moment on:

::Create( "COMBOBOX" ) // Method New()

the control has been created and ::hWnd should be valid.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply