Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Load Order of records in the .SCX
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00085824
Message ID:
00085848
Views:
27
Leighton,

You will be happier in the long run if you make a custom method for your container class. A good polymorphic name for it would be Requery() because you use the Requery() method of a Listbox to cause it to reread it's RowSource. Having this as a method of the container will allow you to call it at other times when the control might need updating.

You can call the method from the Container Init:

* Requery
* Your select code goes here

*Container.Init()
DoDefault()
this.Requery()

You might also want to look at creating a parameterized view for this select code.

>I know that this was terrible design and wasn't going to leave it like that. I just wanted to see if it was going to work and stumbled across the fact that controls are not loaded in the order they are listed in the table.
>
>I tried bringing the control I wanted loaded first to the front with no change in behavior. What I really need is a LOAD event for the class but there isn't one.
>
>Here is what I'm trying to do. I have a basic two column picklist class: two list boxes, Available and Selected, and four buttons, add one, add all ... The list boxes display records from the same table, but are filtered based on the contents of the SELECTED field. In the INIT method of each listbox I have the following code:
>
>
>local cAlias
>cAlias = substr(sys(2015), 3, 10)
>
>use (this.parent.TableAlias) again in 0 alias (cAlias)
>this.rowsource = cAlias
>
>select (this.rowsource)
>set filter to ! SELECTED
>
>
>In the INIT of the container on the form I have:
>
>
>local cAlias
>cAlias = substr(sys(2015), 3, 10)
>
>select ;
> LASTNAME, ;
> FIRSTNAME, ;
> MIDDLENAME, ;
> PROVIDERID, ;
> .f. as SELECTED ;
> from PROVIDER ;
> order by 1, 2, 3 ;
> into table (cAlias)
>
>this.TableAlias = cAlias
>
>
>The problem is the INIT in the controls are executed before the INIT in the container.
>
>The only two solutions (virtually the same) I can think of are:
>
>1. Move the listbox INIT code into the INIT event of the container in the class definition and execute a DODEFAULT() after running the INIT code above.
>
>2. Add a custom method to the class which sets the listbox rowsource after the INIT code above runs.
>
>I was hoping the keep the code more segmented.
>
>Any help you can give is much appreciated.
>
>Thanks, Leighton
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform