You are here:

FoxPro/Foxpro 9 ComboBox Properties

Advertisement


Question
Hi Fred
I wonder if you might be able to help with a query?

I have a combo box that is populated with the contents of a table and is presented as a dropdown list. When the user selects the field for the first time I want the dropdown list presented to always display from the top of the list.  However sometimes the display might start halfway down the list meaning you have to use its scroll-bar to navigate your way back to the top of the list. Is there a property to ensure the presented dropdown list always displays from the top? I cannot find (any obvious) one. Any suggestions much appreciated as always.
Best regards
Dave

Answer
HI Dave,

Sorry for the delay.  With the limited information available, I'm guessing that the starting location in the dropdown is determined by the current location of the record pointer.  So, my best advice would be to force the table to the top of the file before the dropdown is activated.  

While there are many places to enter the command, I would recommend using the "WHEN" method because it is always executed at the time access to the object is attempted.  If the WHEN method returns TRUE, the object is available and if the method returns FALSE, the object cannot be accessed.  In this case you would always want to RETURN TRUE so the method would contain only two lines:

      GO TOP
      RETURN .T.

If this does not have the desired effect, please post a follow-up question and I'll try to find an alternative solution.  However, in order to do so, I will likely need more information regarding the various code segments within the form to determine if any of them are interfering with the record pointer.

Good Luck,

Fred

FoxPro

All Answers


Answers by Expert:


Ask Experts

Volunteer


Fred Frase

Expertise

Questions about development only. No installation or hardware specific questions, please. Your first step in requesting assistance should be to identify the version of FoxPro you are using. I can write short functions but, PLEASE do not ask me to write programs for you.

Experience

Nearly 30 years professional programming experience using FoxPro (FoxBase through VFP 9) or other xbase language, primarily in Windows environments.

Education/Credentials
Completed a 1,000 hour diploma course in programming at International Academy of Ohio (subsequently merged with Southern Ohio College).

©2016 About.com. All rights reserved.