Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ListBox show Elements but not .F. when nothing to be sho
Message
From
05/06/2018 02:44:32
 
 
To
05/06/2018 01:22:03
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Miscellaneous
Thread ID:
01660530
Message ID:
01660561
Views:
54
>>>
>>>I'd vote against that. It wil polute your datasessions with many cursors, one for each combobox. If by any chance you're repeating the alias you might end up with a situation that is difficult to debug
>>>In our case our comoboxes have the aSource[1,2] property and we set the rowsourcetype to 5-array and the rowsource to THIS.aSource.
>>>It also gives you and advangtage that you can fill the combobox from a datacache that is living in another datasession by passing the combobox to the caching manager.
>>>The ID you need is simply in the contols' value property, so no need to refer to an alias.fieldname.
>>>
>>>Walter,
>>
>>You are voting against without thinking IMHO. It is not realistic to think you would be polluting with many cursors. FWIW one would use private datasessions. Not using private data sessions cause more trouble than using a cursor for each combo\listbox you use. Even with a single data session for an entire application you can use cursor. I don't believe you would have combo\listboxes more than cursors allowed in a datasession.
>>You might overlook the advantages of using a cursor over an array for a combobox and do more work. It is your choice.
>
>Hi Cetin,
>
>You'd not reach the maximum number of datasessions which I believe if 64k. But that is not the point. In our case we have a patient file form which progressively would load folders with in total hundreds of comboboxes on there. This would mean hundreds of cursor and hundreds of potential collisions of cursor names, especially when you reuse classes (like dropdowns for physicians).
>
>And yes, we use private datasessions (see my datacache argument above) everywhere where applicable, Its just that some of our forms contain many, many comboboxes
>
>I have a hard time to see the advantages of cursor populated comboboxes: I do not want to do SQL on it, nor do I want to locate a record in there. The value property will do everything I need
>Listboxes are somewhat a different case as you might want to use it to navigate with it, but then you are using the cursor for more than just population of listboxes anyways
>..
>Btw, do you know what might happen in your case when having many cursors when you issue SYS(1104) with a virusscanner active? It took me many weeks to find the cause of massive delays at a clients site to come to that diagnosis.
>
>So, no I do not advise anyone to use cursors to populate comboxboxes. Do it clean and use array properties on comboboxes themselves.
>
>
>Walter,

I agree that there are cases where cursors may not be a good solution. As it is with many things, not always is one strategy the best solution for all situations.

Personally, I prefer to create a controller class, which in turn could encapsulate the cursor or array approach, or as I do often using a collection or enumeration. That means, you populate the Combobox with a generic class like loController.FillCombobox(THISFORM.cboPatients). The in and outs of the data handling should not be the concern of the combobox itself and even less of the form, because that is only a representation of the data for the user interface. For different scenarious you can subclass the controller and re-use most of its functionality.
Christian Isberner
Software Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform