Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Refreshing cursoradapter after changing 'order by' claus
Message
 
À
17/09/2003 03:50:27
Dorin Vasilescu
ALL Trans Romania
Arad, Roumanie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00829310
Message ID:
00829763
Vues:
19
Hi Dorin !
Unfortunatly Tag property I use in other purposes.
So I created a method in my grid base class with code like the below. I used it in a conjunction with your proposal - it seems to work. The method with "backup" parameter is called in init of the grid, with "restore" parameter is called after cursorfill that uses changed (order by..) selectcmd property . Thanks for your help. Have a nice day !

*- code of grid init method
...
this.ManageColumnsSources("BACKUP")
...

*- code of the cursor refreshing method in my form
WITH {grid}
.RecordSource = ""
*change SelectCmd and call CursorFill method code
.ManageColumnsSources("RESTORE")
.Refresh()
ENDWITH

*- code of ManageColumnsSources method
LPARAMETERS tcAction
LOCAL loColumn as column
IF PCOUNT() = 0
tcAction = ""
ENDIF
DO CASE
CASE tcAction == "BACKUP"
This.addproperty("cInitialRecordSource", this.RecordSource )
FOR EACH loColumn IN this.Columns
loColumn.addproperty("cInitialControlSource",loColumn.controlsource )
ENDFOR
CASE tcAction == "RESTORE"
this.RecordSource = this.cInitialRecordSource
FOR EACH loColumn IN this.Columns
loColumn.controlsource = loColumn.cInitialControlSource
ENDFOR
OTHERWISE
ASSERT .f.
ENDCASE
*-


>Hi!
>Maybe you can handle this at grid object level.
>I don't use CursorAdapter (because I don't use VFP8, because I don't have it :-) but I have many grids that change content dinamically.
>What I do is to save column ControlSource property to Tag property, in design time.
>Then set RecordSource property to "", run the query, and then set back ControlSource for grid columns to cursor adapter fields.
>Something like:
>
>WITH {grid}
>    ThisForm.LockScreen = .T.
>    .RecordSource = ""
>    *change SelectCmd and call CursorFill method code
>    .RecordSource = {cursor adapter alias}
>    FOR i = 1 TO .ColumnCount
>        .Columns(i).ControlSource = .Columns(i).Tag
>    ENDFOR
>    .Refresh()
>    ThisForm.LockScreen = .F.
>ENDWITH
>
>
>Must work, I think.
>
>
>>Hi !
>>1.I want to change "order by ..." clause - included in cursoradapter SelectCmd property - based on a selection made by user. After making such change how should I refresh underlaying cursor ? CursorRefresh method seems not work in such case ( cursorFill works but it close the cursor and destroy grid layout).
>>2. I wonder why it is not possible to make such things using parameters like it is in case of 'where ...' clause. Does anybody knows the reason.
>>'Order by' clause look simpler than 'where ...' clause
>>
>>Thanks in advance.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform