Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Form's DataSession
Message
 
 
À
04/12/1997 12:14:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00063803
Message ID:
00063850
Vues:
77
Jim:

I found the problem to be that the menu (unless explicitly changed) is always "looking" at the _screen.datasession which is the Default(1) DS. I created a UDF() that the menu bar item (Print...) SKIP FOR calls to enable or disable the option. The UDF() gets the DSID of the active form (if at least 1 form exists, otherwise it returns a DSID of 1), and sets the DS to that ID. If the remaining conditions are .t., the UDF returns .t. to the SKIP FOR condition which enables the "Print..." option. Works great.

>Mark,
>
>My reading suggests that DataSession can be "1" or "2" and I infer that DataSessionID can be whatever might be called-for.
>
>I also read it that the DataSessionID property can be SET as well as obtained.
>
>It seems that you really need to issue
>ThisForm.DataSessionID = ????
>
>As usual, though, the documentation is not clear at all as to what DataSessionID does/refers to and just WHY one would need to change it. I take it to mean that it is the way to move between DataSessions (but I wouldn't bet on it).
>
>Good luck,
>Jim N
>
>>>>I have a menu system that has some choices that are only available if a certain condition exists in a private datasession of a form [e.g., !eof("MainTable")]. However, when the form is instantiated and the table is opened and displayed in a grid, the choice does not activate because the menu is still "looking" at the Default DS instead of the private DS established by the form (according to the VFP3 View window). If I manually switch to the Private DS in the View window, the menu item is now active.
>>>>
>>>>I know I can explicitly SET DS TO the DSID of the form, but it seems that with everything else VFP handles so elegantly (and automatically), this would have been handled as well. Or am I missing something?
>>>
>>>I guess, it's better to 'link' your menu with some oApp properties/methods, i.e. opening a form you run a method evaluating e.g. private datasession record pointers and resetting appropriate 'menu-control' properties.
>>
>>In my Form subclass I have:
>>if ThisForm.DataSession=2
>> Set DataSession to ThisForm.DataSessionID
>>endif
>>
>>This code does fire when I run the app (I put a wait window nowait before EndIf). However, the DS "of record" does not change in the VF3 View Window and, consequently, the menu item is still disabled. I manually change to the private DS, and the item enables. Debugging shows the DSID to be 2 and the SET DS TO 2 fires without error but nothing changes.
>>
>>Any ideas on what I have done wrong?
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform