FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Bug in CLASS TComboBox?
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Bug in CLASS TComboBox?
Posted: Wed Feb 08, 2017 09:01 AM
Code (fw): Select all Collapse
   METHOD Select( nItem ) INLINE ::nAt := nItem,;
                                 ::SendMsg( CB_SETCURSEL, nItem - 1, 0 )

It seems, that the variable is not updated if i use ::select(). In method Select() should be added a ::change()!
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in CLASS TComboBox?
Posted: Thu Feb 09, 2017 07:50 AM

Günther,

Have you modified it and is it working fine ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Bug in CLASS TComboBox?
Posted: Thu Feb 09, 2017 08:46 AM

I have a long time tested as the variable after ::select() was NOT changed according to the new position. Then i checked also the code from Listbox and there on the same place ::change() is calling. The ::select() is a movement and also must be
updating the variable and eval(bChange) if exist.

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in CLASS TComboBox?
Posted: Thu Feb 09, 2017 10:55 AM

Please show me how you have modified it

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Bug in CLASS TComboBox?
Posted: Thu Feb 09, 2017 01:38 PM
Antonio, i made a new method to select a item. Now the variable is correct updated and the bChange are executed if present.

Code (fw): Select all Collapse
METHOD SelectItem( nItem ) CLASS TComboBox
   ::nAt := nItem
   ::SendMsg( CB_SETCURSEL, nItem - 1, 0 )

   if ::nAt == 0
      return nil
   endif

   if ::nAt <= Len( ::aItems )
      if ValType( Eval( ::bSetGet ) ) == "N"
         Eval( ::bSetGet, ::nAt )
      else
         Eval( ::bSetGet, ::aItems[ ::nAt ] )
      endif
   endif

   if ! Empty( ::oGet:hWnd )
      ::oGet:VarPut( Eval( ::bSetGet ) )
      ::oGet:Refresh()
   endif

   if ::bChange != nil
      Eval( ::bChange , self , ::GetText() )
   endif

return nil
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in CLASS TComboBox?
Posted: Sat Feb 25, 2017 06:37 AM

Günther,

Have you checked if bChange gets executed twice ?

Please call MsgInfo() from it and check if it gets called just once

thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion