none
vfp 9.0 combo box select list problem

    Question

  • I have a vfp 9.0 combo box that has a rowsourcetype as fields and data with 50 records that displays one of the table fields as a selection list. the problem is when i select an item by clicking it. after it's clicked, the display value will be blank. this may take 2-3 times clicking the data before it selects it. the record pointer on the table point to the right record in the background but displays blank. it's inconsistent and i cant find a pattern for me to be able to fix it.
    Wednesday, December 26, 2007 2:38 PM

Answers

  •  Chikiboy wrote:
    I have a vfp 9.0 combo box that has a rowsourcetype as fields and data with 50 records that displays one of the table fields as a selection list. the problem is when i select an item by clicking it. after it's clicked, the display value will be blank. this may take 2-3 times clicking the data before it selects it. the record pointer on the table point to the right record in the background but displays blank. it's inconsistent and i cant find a pattern for me to be able to fix it.

     

    I am sorry, but my crystal ball appears to e malfunctioning today . Would you mind telling me how your combo box is set up? Specifically:

     

    RowSourceType = 6 - Fields ( I know because you already told be this )

    RowSource

    ControlSource

    BoundTo

    BoundColumn

     

    Is there any code in any of the methods of the combo box?

     

    I can tell you that when they are set up correctly, they do not exhibit the behavior that you are describing unless it is a combo in a grid. If your combo is in a grid, you can get around this ( Known ) issue by changing the RowSOurcetype to 3-SQL Statement.

     

    You may also find it helpful to download the sample chapters from 1001 Things You Wanted to Know About Visual FoxPro at http://www.hentzenwerke.com/samplechapters/zsamplechapters.htm. One of the sample chapter is

    Chapter 5: Combos and Lists

    Combo and list box basics
    List and ListItem collections
    When do the events fire?
    How do I bind my combo and list boxes?
    How do I refer to the items in my combo and list boxes?
    What is the difference between DisplayValue and Value?
    What's the difference between RowSourceTypes "alias" and "fields"?
    How do I make my combo and list boxes point to a particular item?
    Quickfill combos
    How do I add new items to my combo and list boxes?
    How do I filter the items displayed in a second combo or list box based on the selection made in the first?
    A word about lookup tables
    Generic lookup combos and lists
    So what if I want to bind my combo to a value that isn't in the list?
    How do I disable individual items in a combo or list?
    How do I create a list box with check boxes like the one displayed by Visual FoxPro when I select "View Toolbars" from the menu?
    A mover list class
    What if I need to display hundreds of items in my combo box?

    Friday, December 28, 2007 3:44 PM

All replies

  • The record pointer on the table will move with the combo selection so the only thing that could mess it up is code in a method or event.

     

    Is there any code in these areas?

     

    What is the control source?

     

     

    Wednesday, December 26, 2007 6:26 PM
  • That was my first guess, that it's something with the code. I made it plain and simple form with combo box with no control source and it still doing it. try it and you will see what i'm talking about.. i could send you copy of the program if you want. let me know.

    here's how i set my combo box. real simple..

    RowSourceType = 6
    RowSource = "instru"

    Wednesday, December 26, 2007 8:58 PM
  • your RowSource must contain the DBF and the field name.  Example; instru.lname

     

    You really should be using a List Box instead.

     

     

    Thursday, December 27, 2007 4:21 AM
  • yes it is a dbf and it list the information fine. it's more like a foxpro 9.0 problem. i did not have this problem with previous versions of foxpro. did you test it yet?
    Thursday, December 27, 2007 2:01 PM
  • Test what?

     

    I have hundreds of forms with list and combo boxes on them without any problems.  They all seem to work the same from 5.0 to 9.0 for me.

     

     

    Thursday, December 27, 2007 7:57 PM
  • I also use combo box in our programs. just this ones that have fields from a database. Can i send you a copy? it's really simple.. i wish someone could help me with this one.

    Can i report this problem to microsoft?? would you be able to advise how? i have some other issues about converting to 9.0
    Thursday, December 27, 2007 9:16 PM
  •  Chikiboy wrote:
    I have a vfp 9.0 combo box that has a rowsourcetype as fields and data with 50 records that displays one of the table fields as a selection list. the problem is when i select an item by clicking it. after it's clicked, the display value will be blank. this may take 2-3 times clicking the data before it selects it. the record pointer on the table point to the right record in the background but displays blank. it's inconsistent and i cant find a pattern for me to be able to fix it.

     

    I am sorry, but my crystal ball appears to e malfunctioning today . Would you mind telling me how your combo box is set up? Specifically:

     

    RowSourceType = 6 - Fields ( I know because you already told be this )

    RowSource

    ControlSource

    BoundTo

    BoundColumn

     

    Is there any code in any of the methods of the combo box?

     

    I can tell you that when they are set up correctly, they do not exhibit the behavior that you are describing unless it is a combo in a grid. If your combo is in a grid, you can get around this ( Known ) issue by changing the RowSOurcetype to 3-SQL Statement.

     

    You may also find it helpful to download the sample chapters from 1001 Things You Wanted to Know About Visual FoxPro at http://www.hentzenwerke.com/samplechapters/zsamplechapters.htm. One of the sample chapter is

    Chapter 5: Combos and Lists

    Combo and list box basics
    List and ListItem collections
    When do the events fire?
    How do I bind my combo and list boxes?
    How do I refer to the items in my combo and list boxes?
    What is the difference between DisplayValue and Value?
    What's the difference between RowSourceTypes "alias" and "fields"?
    How do I make my combo and list boxes point to a particular item?
    Quickfill combos
    How do I add new items to my combo and list boxes?
    How do I filter the items displayed in a second combo or list box based on the selection made in the first?
    A word about lookup tables
    Generic lookup combos and lists
    So what if I want to bind my combo to a value that isn't in the list?
    How do I disable individual items in a combo or list?
    How do I create a list box with check boxes like the one displayed by Visual FoxPro when I select "View Toolbars" from the menu?
    A mover list class
    What if I need to display hundreds of items in my combo box?

    Friday, December 28, 2007 3:44 PM
  • rowsource is one of the fields of my table. controlsource is where i save the value. I have 3 locations using the same program. this one specific location have more than 50 items in combo box selection and thats where the problem happens.
    Thursday, January 03, 2008 2:01 PM
  •  Chikiboy wrote:
    rowsource is one of the fields of my table. controlsource is where i save the value. I have 3 locations using the same program. this one specific location have more than 50 items in combo box selection and thats where the problem happens.

     

    Is the ControlSource in the same trable that you are using as the RowSource?

    If so, this is what is causing you problems.

    Thursday, January 03, 2008 4:50 PM
  • The answer is no. controlsource is where i want to save the value of the rowsource.
    Thursday, January 03, 2008 6:54 PM
  • I have this problem (with blank value) with the comboboxes when I pull the scroll too fast down and the mouse leave the control before releasing the left mouse button (primary one).

    I had been trying for 6 months to debug it before I figured it out. This was becouse I never succeeded in doing it twice in a row. One day I sow colleague trying to select something from a combo box 10 times in a row with 0 success (I didn't want to torture him, but I wanted to see how he is doing it ) .

    I've tested this wil different types of RowSource and tested it now, to be sure once again...
    Tuesday, February 05, 2008 3:45 PM
  • were you able to fix the problem? let me know.. thank you!
    Tuesday, February 05, 2008 4:59 PM
  • I have this same problem with ComboBox DropDown List style, and not only with blank/null value.

    In my case RowSourceType is 0, controlsource is set to (None) so it's not a problem with control source/record source. I fill a combobox object with AddListItem method with about 100 unique values, 20 - 100 characters long. There is no need to have cristal ball working to reproduce it.

    Sometimes after selecting with mouse click, a row from drop down list it works, sometimes not (list must be scrolled with list slider, there is no bug using up and down buttons).

    But every time when it works, Click and Valid events of combobox are fired after selecting a row with mouse click, otherwise not.

    After mouse click fail on the list, second mouse click on a parent form object fire Click and Valid events for the combobox object (displayvalue is correct).

    If a combo box list items are short, problem don't appear.

    Sunday, January 02, 2011 5:48 PM
  • I am having the same issue. We upgraded a VFP8 application to VFP9 just a few weeks ago and are having the exact same issue. I placed a wait window in the Click() event and it displays the DisplayValue of the combobox. When the issue occurs there is NO Click() event but the dropdown list goes away when the mouse is clicked and the Control DisplayValue or Value is not updated!

    This occurs when there seems to be 20 or so items in the list dropdown and the user clicks the downarrow to get the dropdown list. The user then immediately scrolls the list to the bottom and selects the last item.

    The combobox RowSource = cursor name plus the 2 fields from the cursor for the displayvalue and the value. For example "cursorname.cName, iid". The cName is the single display column value and the iid is the boundcolumn. The cursor bound to the combo is a readonly cursor that just lists the items as the RowSourceType = 6. The combobox Value is not bound for the ControlSource is blank.

    This must be a VFP9 issue since recompiling in VFP8 with no code changes does not have the problem.

    Help!

     

    Tuesday, May 24, 2011 7:56 PM
  • I can't replicate your problem. Can you use the Class Browser to generate code for the form (ideally, a form with just the combo on it) and post that here, along with a little code to create and populate the table you're using in the combo.

    Tamar

    Tuesday, May 24, 2011 8:33 PM
    Answerer
  • Thank you Tamar for responding!! I have since replicated this and know exactly how to recreate it.

    It occurs if the dropdown has a scroll bar (more items than the ColumnCount property. And the dropdown list is wider than the original combobox control width.

    The user then clicks the down arrow, to display the dropdown, the mouse clicks the scrollbar and moves down the list (do not let go of the mouse button) then move the mouse outside the width of the dropdown list. Then let go of the mouse button, the list is still there. Then select an item! the combo is not updated. I can recreate this over and over. It does not happen in VFP8

    The combo dropdown list can have a single column or multiple coluns it does not matter.


    Johnny Wild
     Opps I meant DisplayCount instead of ColumnCount above...
    • Proposed as answer by JBWild Wednesday, May 25, 2011 7:17 PM
    • Unproposed as answer by JBWild Wednesday, May 25, 2011 7:17 PM
    Tuesday, May 24, 2011 9:37 PM
  • Tamar, here is the complete standalone code to reproduce the VFP9 BUG
    LOCAL frmcboTest AS form
    
    IF USED('cbotest')
    	USE IN ('cboTest')
    ENDIF
    
    CREATE CURSOR cbotest (iid I, cid C(15))
    * Add some sample data
    FOR x = 1 TO 200
    	a = 'Testing ' + LTRIM(STR(x))
    	INSERT INTO cboTest (iid, cid) VALUES (x, a)
    ENDFOR
    SELECT ('cboTest')
    
    frmcboTest = CREATEOBJECT('form1')
    frmcboTest.Show()
    READ EVENTS
    
    RELEASE ALL
    CLOSE ALL
    
    **************************************************
    *
    DEFINE CLASS form1 AS form
    	Height = 138
    	Width = 276
    	DoCreate = .T.
    	AutoCenter = .T.
    	Caption = "cboTest"
    	Name = "Form1"
    
    	ADD OBJECT combo1 AS combobox WITH ;
    		ColumnWidths = "150", ;
    		RowSource = "cboTest", ;
    		Height = 24, ;
    		Left = 72, ;
    		Top = 36, ;
    		Width = 63, ;
    		BoundTo = .T., ;
    		DisplayCount = 10, ;
    		Name = "Combo1"
    
    	ADD OBJECT label1 AS label WITH ;
    		AutoSize = .T., ;
    		BackStyle = 0, ;
    		Caption = "Test", ;
    		Height = 17, ;
    		Left = 42, ;
    		Top = 38, ;
    		Width = 26, ;
    		Name = "Label1"
    	
    	PROCEDURE Unload
    		CLEAR EVENTS
    		this.Release
    	ENDPROC
    		
    	PROCEDURE combo1.Init
    		this.RowSource = "cboTest.cid, iid"
    		this.RowSourceType = 6
    
    		this.BoundColumn = 2
    		this.ColumnCount = 1
    
    		This.Value = 0
    	ENDPROC
    	
    ENDDEFINE
    *
    *-- EndDefine: form1
    **************************************************
    
    Steps to reproduce is:
    This issue will occur when the following attributes are present for
    a Combo Box
     i. The width of the actual Combo Box is less than the width of the
    Drop Down list and the Drop Down List contains enough rows to
    cause the right-hand scroll bars to appear so the user may scroll
    down the list.
     ii. To create the issue the user must click the down-arrow of the 
    Combo Box to produce the Drop Down list, the user then scrolls the 
    list holding the left mouse button while dragging the scroll bar 
    downward, the user then moves the cursor outside the Drop Down 
    list without releasing the mouse button. The Drop Down list may 
    stop scrolling at that point. The user then releases the mouse 
    button and the scrolling will stop but the Drop Down list remains. 
    The user then clicks on a selection within the Drop Down list. The 
    selection is highlighted but the mouse click to select it does not 
    update the value within the Combo Box.
     iii. This anomaly was mainly experienced in choosing a selection 
    from the Drop Down list if it was toward the end of the list. It is 
    easy for the user to scroll down the list and actually leave the list 
    with the mouse before letting go of the mouse button, then move 
    the mouse back into the list to click the selection. 
    
    Thanks

    Johnny Wild

    Johnny Wild
    Wednesday, May 25, 2011 7:42 PM
  • With your code, I can replicate the problem. I'm not sure how serious it is, given the weird series of steps it takes to make it happen. But if you want to solve it, try using Event Tracking to see exactly which events are firing and see if you can add some code to work around it.

    Tamar

    Friday, May 27, 2011 9:04 PM
    Answerer
  • How serious ? It's very funny. It's very serious problem. Using combo box with this bug has no sense. "Hello, Helpdesk ? Yes, what can I do for You ? I can't select item from combobox list. What can I do ? Keep trying, keep trying ..." I checked events VFP fire in case of problems with selecting item from the combobox list. And as I wrote in January, in case of 'missclick', Valid and Click events are not fired after you made a phisical mouse click on item, but after second click on a form. Click event don't recognize selection made, because click sender is a form, not a combobox control. We can't do anything more. It's a need to release SP or patch for this BUG Microsoft. VFP is still supported by you !!! There are more bugs to be solved, but why VFP developers are not importand for MS ?
    Wednesday, June 01, 2011 9:22 PM
  • You are correct. when this bug occurs, there are no events to monitor. The Click, Valid and others do not fire! As far as being serious, it depends on the application. This occurs in a "mission critical" application in a banking industry. Users can make ciritcal mistakes when selections are not what they expect.

    I tried to log this as a bug to Microsoft but I get an error when I sent in and completed the requirements to report this. I sent this to: vfpfeed@microsoft.com but it bounced back. How do I send this as a BUG to microsoft and really, who would listen...

    Help




    Johnny Wild
    Thursday, June 02, 2011 2:22 PM
  • I doubt very much we can get another hotfix for VFP :( In any case, try again posting the problem on MS Connect website and post a link here, so we can vote it up. But don't get high hopes on having it ever fixed.
    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog
    Thursday, June 02, 2011 2:57 PM
    Moderator
  • Hello Naomi,

    Very good idea, but, VFP or Visual Studio 2005 is not supported by MS Connect.
    The mainstream support has ended 2010/01/12, but there is still extended support and I don't have an idea how I can post this problem to MS, by mail ?
    Is anybody from MS reading sended mails or this forum owned by MS ?

    And by the way, it's so common problem, so MS must know about it. I don't think it's a need for voting to remove BUGS, this is not improvement or a president elections.
    They have so much problems to solve with new wondefull software / systems (no Outlook synchronization on Win7 mobile, people are writing about this missing feature over a year - by design ?, Apple, Adroid, Symbian has it by better design or better programing skill), so they don't realy support products like VFP.

    I have no hope to get a next SP/hot fix, but I know for sure, next developer tools must be choosen wise.

    There are a few possibilities to solve this problem oneself:
    1. use third party Active X combobox (You can pack it in your own class and rewrite methods used in application to minimize changes in existing code) - solution like using  BMW gear box in Honda car - work sometimes but looking strange.
    2. don't use combobox control at all - having a car but without one wheel.
    3. write own container class based on textbox, commadbutton and list box

     




    Thursday, June 02, 2011 9:08 PM
  • Does using a different RowSourceType solve the problem?

    Tamar

    Thursday, June 02, 2011 9:09 PM
    Answerer
  • No, I checked 0-None, 1-Value, 2-Alias. JBWild posted code with 6-Field,  (in 2008 a few posts up) wrote he checked different RowSourceTypes.

    Thursday, June 02, 2011 9:21 PM
  • Try it with an array. I just created a form using an array RowSource and didn't see the problem. Maybe I didn't get one of the other factors involved, but it's worth a try.

     

    Tamar

    Friday, June 03, 2011 8:29 PM
    Answerer
  • I changed to 5 - Array, and this same result.
    A row from combobox list is not selected with mouse click, sometimes.

    But, try make mouse click after this "missclick" anywhere on active form (only on a Form object, not on another control). What happen ?

    After this second mouse click, Combobox made selection, WOW.
    But don't ask me, to tell user to click a Form every time selection is not made.

    For a test purpose, I added a timer control to Form ( Timer: thisform.click() ), but it don't work like real mouse click.

    Next I had found.
    I in JBWild example increasing combobox widht minimize the probability of "missclick". With width 110, combobox is responding well.
    If I made a longer item text, or increase font size at 110 combobox width, the problem is back again.

    Some more ideas to solve this problem (bug) - GDI+ depending problem ?


    Sunday, June 05, 2011 11:02 AM
  • I added this code to the Click event and it solved the problem for me:

    This.RightClick()

     

    Tuesday, January 31, 2012 7:57 PM
  • If you tried my example, you would find this does not work, since when it happens the actual Click() event does not occur. So how would the RightClick() be even called...

    The only way I have found around this is to make the width of the dropdown part of the combo (the list) to be wider than the text that it contains.

     


    Johnny Wild
    Tuesday, January 31, 2012 8:16 PM