Home > Archive > Programming with dBASE > June 2005 > override In Use message









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author override In Use message
Bob Buchanan

2005-06-20, 11:23 am

Have a situtation that I want to override the valid Retrying Lock message
and allow the user options vs. just waiting for the in use file to close or
canceling what they are doing. I see IsSetLocked() is only good within a
session so assume that is not the test to present my own dialog. I then play
around with using lockSet() but need suggestions on the best way to do that.

There are other times I would just like to change the wording on the
Retrying Lock message -- as the user hasn't a clue as what the xyx file
locked means. How do you do that?

Thanks.

Regards, Bob
RLB & Associates
dB2K 0.2 b1623
www.rvspacemanager.com


Ken Mayer [dBVIPS]

2005-06-20, 1:23 pm

Bob Buchanan wrote:
> Have a situtation that I want to override the valid Retrying Lock message
> and allow the user options vs. just waiting for the in use file to close or
> canceling what they are doing. I see IsSetLocked() is only good within a
> session so assume that is not the test to present my own dialog. I then play
> around with using lockSet() but need suggestions on the best way to do that.
>
> There are other times I would just like to change the wording on the
> Retrying Lock message -- as the user hasn't a clue as what the xyx file
> locked means. How do you do that?


The basics for this are:

_app.session.lockRetryInterval := 1 // one second between attempts
q = new query()
q.sql := "select * from mytable"
q.active := true

if q.rowset.lockRow()
// success - we got a lock!
q.rowset.beginEdit()
else
// tell the user ...
msgbox( "The row is locked, try again later!",;
"Cannot lock row." )
endif

This allows you to modify the error, and not see the default dialog.

If you were using a lock field (using CONVERT) on the table (not
necessary, but useful):

_app.session.lockRetryInterval := 1 // one second between attempts
if queryname.rowset.lockRow()
// success - we got a lock!
queryname.rowset.beginEdit()
else
// tell the user ...
cUser = queryname.rowset.fields["_DBASELOCK"].user
cDateTime = queryname.rowset.fields["_DBASELOCK"].lock
msgbox( "The row is locked by '"+cUser+"' who locked "+;
"it at: "+cDateTime+"! Try again later!",;
"Cannot lock row." )
endif

Ken

--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
Bob Buchanan

2005-06-20, 8:23 pm

Ken:

I must be doing something wrong -- the default message still appears (though
very slowly). When I click the Cancel button on the default message, my
MsgBox appears -- then my user can RETURN back to their session of the form.
Have used your code exactly as written . . .

Thanks,
Regards, Bob
RLB & Associates
dB2K 0.2 b1623
www.rvspacemanager.com

"Ken Mayer [dBVIPS]" < dbase@_nospam_golden
stag.net> wrote in message
news:Z3f1v4bdFHA.1756@news-server...
> Bob Buchanan wrote:
>
> The basics for this are:
>
> _app.session.lockRetryInterval := 1 // one second between attempts
> q = new query()
> q.sql := "select * from mytable"
> q.active := true
>
> if q.rowset.lockRow()
> // success - we got a lock!
> q.rowset.beginEdit()
> else
> // tell the user ...
> msgbox( "The row is locked, try again later!",;
> "Cannot lock row." )
> endif
>
> This allows you to modify the error, and not see the default dialog.
>
> If you were using a lock field (using CONVERT) on the table (not
> necessary, but useful):
>
> _app.session.lockRetryInterval := 1 // one second between attempts
> if queryname.rowset.lockRow()
> // success - we got a lock!
> queryname.rowset.beginEdit()
> else
> // tell the user ...
> cUser = queryname.rowset.fields["_DBASELOCK"].user
> cDateTime = queryname.rowset.fields["_DBASELOCK"].lock
> msgbox( "The row is locked by '"+cUser+"' who locked "+;
> "it at: "+cDateTime+"! Try again later!",;
> "Cannot lock row." )
> endif
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase



Ken Mayer [dBVIPS]

2005-06-20, 8:23 pm

Bob Buchanan wrote:
> Ken:
>
> I must be doing something wrong -- the default message still appears (though
> very slowly). When I click the Cancel button on the default message, my
> MsgBox appears -- then my user can RETURN back to their session of the form.
> Have used your code exactly as written . . .


Make sure localShare is set to true in the BDE Administrator on all
machines on the network.

Ken

--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
Bob Buchanan

2005-06-20, 8:23 pm

Yep, that is set correctly. Other than the default message coming up, using
my own dialog is very nice and will let the user know what is going on.
Wonder if I have an other settings too high or low or whatever? Right now,
the three machines I use to network test are average to upper average in
size and speed. Seems I recall a doc somewhere that discussed each setting
in more depth than OLH in the BDE admin.

Regards, Bob
RLB & Associates
dB2K 0.2 b1623
www.rvspacemanager.com

"Ken Mayer [dBVIPS]" < dbase@_nospam_golden
stag.net> wrote in message
news:TpcVAdedFHA.1760@news-server...
> Bob Buchanan wrote:
>
> Make sure localShare is set to true in the BDE Administrator on all
> machines on the network.
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase



Todd Kreuter [dBVIPS]

2005-06-20, 8:23 pm

"Ken Mayer [dBVIPS]" < dbase@_nospam_golden
stag.net> wrote in message
>
> The basics for this are:
>
> _app.session.lockRetryInterval := 1 // one second between attempts


_app.session.lockRetryCount needs to be set to something other than zero
(I've always used 1), and it needs to be set before the query opens. I've
never changed the lockRetryInterval, other than for testing purposes I
suppose.

Todd Kreuter [dBVIPS]


Ken Mayer [dBVIPS]

2005-06-21, 11:23 am

Todd Kreuter [dBVIPS] wrote:
> "Ken Mayer [dBVIPS]" < dbase@_nospam_golden
stag.net> wrote in message
>
>
>
> _app.session.lockRetryCount needs to be set to something other than zero
> (I've always used 1), and it needs to be set before the query opens. I've
> never changed the lockRetryInterval, other than for testing purposes I
> suppose.


Good point on it needing to be set before the query opens ...

Ken

--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
Bob Buchanan

2005-06-22, 3:23 am

Thanks Todd and Ken, that seems to have done the trick. My own dialog now
comes up instead of the default.

How does that impact other querys. It looks like now when I want to use the
default dialog for another table during a lock, there is no dialog at all.

Regards, Bob
RLB & Associates
dB2K 0.2 b1623
www.rvspacemanager.com

"Todd Kreuter [dBVIPS]" <tkreuter@dbellsouth.net> wrote in message
news:FWfEYgfdFHA.432@news-server...
> "Ken Mayer [dBVIPS]" < dbase@_nospam_golden
stag.net> wrote in message
>
> _app.session.lockRetryCount needs to be set to something other than zero
> (I've always used 1), and it needs to be set before the query opens. I've
> never changed the lockRetryInterval, other than for testing purposes I
> suppose.
>
> Todd Kreuter [dBVIPS]
>
>



Todd Kreuter [dBVIPS]

2005-06-22, 3:23 am

"Bob Buchanan" <rlbuch@compuserve.com> wrote in message
news:wcG8ijtdFHA.1756@news-server...
> Thanks Todd and Ken, that seems to have done the trick. My own dialog now
> comes up instead of the default.
>
> How does that impact other querys. It looks like now when I want to use

the
> default dialog for another table during a lock, there is no dialog at all.


You would have to restore the original settings. For any query where you
want your own dialog, try using the query canOpen and onOpen events to
change and restore the settings.

function query_canOpen
_app.session.lockRetryCount = 1
return true

function query_onOpen
_app.session.lockRetryCount = 0
return

Todd Kreuter [dBVIPS]


Bob Buchanan

2005-06-24, 8:23 pm

>> You would have to restore the original settings. For any query where you
> want your own dialog, try using the query canOpen and onOpen events to
> change and restore the settings.

====
That doesn't seem to do it for me. I must be using the functions in the
wrong way. My table is called resTemp. Whenever it is in use, I want other
users to do something else or wait for it to unlock as instructed in my own
dialog.

I don't understand your onOpen function. Seems I would want the onClose
event to turn my dialog off and revert to the default.

this.RESTEMP1 = new QUERY()
this.RESTEMP1.parent = this
with (this.RESTEMP1)
left = 54.5
top = 14.7895
sql = 'select * from "restemp.DBF"'
active = false
endwith

with (this.RESTEMP1.rowset)
canOpen = class::resTemp_canOp
en
onClose = class::resTemp_onClo
se
autoEdit = true
endwith

** Lock restemp
form.resTemp1.active = true
IF form.restemp1.rowSet.lockSet()
** Do stuff.
ELSE
form.resTemp1.active = false
msgbox("bail out")
RETURN
ENDIF

function resTemp_canOpen
_app.session.lockRetryCount = 1
return true

function resTemp_onClose
_app.session.lockRetryCount = 0
return

Doesn't setting the Active property to True or False either event to fire?.
It doesn't seem to be with this code. I placed a message in both and neither
is firing. With the code I've posted, if STA1 gets there first, the rowSet
locks, and SAT2 gets the default Retry message. If STA2 cancels the default,
they get my bail out and recover message.

Thanks, Todd.

Regards, Bob
RLB & Associates
dB2K 0.2 b1623
www.rvspacemanager.com



"Todd Kreuter [dBVIPS]" <tkreuter@dbellsouth.net> wrote in message
news:BjtdV5tdFHA.1756@news-server...
> "Bob Buchanan" <rlbuch@compuserve.com> wrote in message
> news:wcG8ijtdFHA.1756@news-server...
> the
>
> You would have to restore the original settings. For any query where you
> want your own dialog, try using the query canOpen and onOpen events to
> change and restore the settings.
>
> function query_canOpen
> _app.session.lockRetryCount = 1
> return true
>
> function query_onOpen
> _app.session.lockRetryCount = 0
> return
>
> Todd Kreuter [dBVIPS]
>
>



Todd Kreuter [dBVIPS]

2005-06-24, 8:23 pm

"Bob Buchanan" <rlbuch@compuserve.com> wrote in message
news:UWwuN0PeFHA.1812@news-server...
>
> I don't understand your onOpen function. Seems I would want the onClose
> event to turn my dialog off and revert to the default.
>
> this.RESTEMP1 = new QUERY()
> this.RESTEMP1.parent = this
> with (this.RESTEMP1)
> left = 54.5
> top = 14.7895
> sql = 'select * from "restemp.DBF"'
> active = false
> endwith
>
> with (this.RESTEMP1.rowset)
> canOpen = class::resTemp_canOp
en
> onClose = class::resTemp_onClo
se
> autoEdit = true
> endwith


Those in the wrong place. They are query events, not rowset events. Move
those 2 lines back up between the with(this.restemp1)/endwith.

Todd Kreuter [dBVIPS]


Bob Buchanan

2005-06-27, 3:23 am

Of course . . . <g>. Thanks, Todd.

"Todd Kreuter [dBVIPS]" <tkreuter@dbellsouth.net> wrote in message
news:F2qqWwReFHA.1756@news-server...
> "Bob Buchanan" <rlbuch@compuserve.com> wrote in message
> news:UWwuN0PeFHA.1812@news-server...
>
> Those in the wrong place. They are query events, not rowset events. Move
> those 2 lines back up between the with(this.restemp1)/endwith.
>
> Todd Kreuter [dBVIPS]
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com