BUG: COMBOBOX with style CBS_DROPDOWN

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby byte-one » Fri Apr 05, 2013 1: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
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby Marco Turco » Mon Apr 08, 2013 9: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
Image 2 Image
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby byte-one » Mon Apr 08, 2013 10:02 am

Marco, has the Combobox clausula "UPDATE" ?
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby Marco Turco » Mon Apr 08, 2013 10:33 am

Yes of course
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby byte-one » Mon Apr 08, 2013 11:54 am

Can see no problems...!!??
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby Antonio Linares » Tue Apr 09, 2013 2:20 pm

Marco,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby Marco Turco » Wed Apr 10, 2013 9: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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby Colin Haig » Wed Apr 10, 2013 10:31 pm

Hi Marco

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

Code: Select all  Expand view

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
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby Marco Turco » Thu Apr 11, 2013 8: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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby Antonio Linares » Thu Apr 11, 2013 10:10 am

Colin, Marco,

I modified Colin's code this way:
Code: Select all  Expand view
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
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby byte-one » Thu Apr 11, 2013 7: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: Select all  Expand view
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  Expand view
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  Expand view
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  Expand view
::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

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby byte-one » Sun Apr 14, 2013 7: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
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby Antonio Linares » Sun Apr 14, 2013 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby byte-one » Mon Apr 15, 2013 9: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
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: BUG: COMBOBOX with style CBS_DROPDOWN

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 40 guests

cron