Bug in CLASS TComboBox?

Bug in CLASS TComboBox?

Postby byte-one » Wed Feb 08, 2017 9:01 am

Code: Select all  Expand view
  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
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Bug in CLASS TComboBox?

Postby Antonio Linares » Thu Feb 09, 2017 7:50 am

Günther,

Have you modified it and is it working fine ?
regards, saludos

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

Re: Bug in CLASS TComboBox?

Postby byte-one » Thu Feb 09, 2017 8: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
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Bug in CLASS TComboBox?

Postby Antonio Linares » Thu Feb 09, 2017 10:55 am

Please show me how you have modified it
regards, saludos

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

Re: Bug in CLASS TComboBox?

Postby byte-one » Thu Feb 09, 2017 1: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: Select all  Expand view
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
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Bug in CLASS TComboBox?

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 113 guests