FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour BUG: COMBOBOX with style CBS_DROPDOWN
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Fri Apr 05, 2013 01:15 PM

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
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Mon Apr 08, 2013 09:20 AM
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 2
Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Mon Apr 08, 2013 10:02 AM

Marco, has the Combobox clausula "UPDATE" ?

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Mon Apr 08, 2013 10:33 AM

Yes of course

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Mon Apr 08, 2013 11:54 AM

Can see no problems...!!??

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Tue Apr 09, 2013 02:20 PM

Marco,

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Wed Apr 10, 2013 09:03 PM

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

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 310
Joined: Mon Oct 10, 2005 05:10 AM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Wed Apr 10, 2013 10:31 PM
Hi Marco

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

Code (fw): Select all Collapse
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
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Thu Apr 11, 2013 08:59 AM

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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Thu Apr 11, 2013 10:10 AM
Colin, Marco,

I modified Colin's code this way:
Code (fw): Select all Collapse
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
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Thu Apr 11, 2013 07:37 PM
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 (fw): Select all Collapse
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 (fw): Select all Collapse
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 (fw): Select all Collapse
 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 (fw): Select all Collapse
 ::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
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Sun Apr 14, 2013 07:02 PM

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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Sun Apr 14, 2013 09:40 PM

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
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Mon Apr 15, 2013 09:15 AM

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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: BUG: COMBOBOX with style CBS_DROPDOWN
Posted: Mon Apr 15, 2013 10:09 AM

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