Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing object status in midstream?
Message
 
 
To
16/10/2000 15:40:04
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00429884
Message ID:
00429991
Views:
18
>>Well, if you use pessimistic locking in your application, there are functions in VFP that allow to check if record is locked by another user. Than you can do this in timer event and refresh status of controls on form accordingly.
>
>Even without a timer, if he employs a button which specifically starts an edit, he can run the checking from the button's click.
>Another way would be to have some common code to be called from any control's .InteractiveChange event, which would check for a property... mmm, let's say ThisForm.WeGotItLocked, and another one, ThisForm.SomeoneLockedIt. So if both are .f. (as they should initially be), we'd try to lock. Succeeding or failing, we'd set one of them, and allow or disable further editing accordingly.

Just to expand a little your idea and others ideas:
You may want to add a new property to your form lIsLocked. After record was successfully locked, you would say:
thisform.lIsLocked=.t.
In lIsLocked_Assign you may put thisform.Refresh()
In Grid.Init you may play with DynamicBackColor to use thisform.lIsLocked and show records accordingly. If you don't use grid, put in thisform.Refresh() something like:
if this.lIsLocked
  this.SetAll('backcolor',rgb(128,128,128)) 
  this.SetAll('ReadOnly',.t.) 
else
   this.SetAll('backcolor',rgb(255,255,255)) endif
   this.SetAll('ReadOnly',.f.) 
Better use enabled property and DisabledBackColor would do it automatically.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform