Page 1 of 1

Browse in network environment - how to lock edited row?

Posted: Wed Feb 18, 2009 4:53 pm
by mol
Hi guys!
I want to use browse for view and edit data inline. But I have a problem - I can't open my dbf in exclusive mode, so I need to lock one record - how to do it?

With regards, Marek


PS. I found, that it works good in example hmg\samples\browse_1\browse7.prg
@ 10,10 BROWSE Browse_1 ;
WIDTH 610 ;
HEIGHT 390 ;
HEADERS { 'Code' , 'First Name' , 'Last Name', 'Birth Date', 'Married' , 'Biography' } ;
WIDTHS { 150 , 150 , 150 , 150 , 150 , 150 } ;
WORKAREA Test ;
FIELDS { 'Test->Code' , 'Test->First' , 'Test->Last' , 'Test->Birth' , 'Test->Married' , 'Test->Bio' } ;
VALUE 0 ;
EDIT INPLACE APPEND ;
WHEN { { || Test->Code == 10 } , , { || Test->Last = 'Last Name 10' } , , , } ;
VALID { { || MemVar.Test.Code <= 1000 } , { || !Empty(MemVar.Test.First) } , { || !Empty(MemVar.Test.Last) } , { || Year(MemVar.Test.Birth) >= 1900 } , , } ;
VALIDMESSAGES { 'Code Range: 0-1000', 'First Name Cannot Be Empty', , , , } ;
LOCK ;
NOLINES
but, how to declare this using IDE??
I want to add, that if I edit my *.FMG file manually and add phrase EDIT INPLACE
It causes runtime error...

Re: Browse in network environment - how to lock edited row?

Posted: Fri Mar 20, 2009 1:18 pm
by sudip
Thank you MOL,

I am not answering your query, but I am thanking you for the code you wrote, has solved my query regarding locking in Browse. :) (I skipped that sample ;( )

Can you please tell me how to cancel the addition of a record in browse?

With best regards.

TIA

Sudip

Re: Browse in network environment - how to lock edited row?

Posted: Sat Mar 21, 2009 6:48 pm
by mol
In almost cases I define my own form for adding records to database. So I haven't to delete record, because I add it at the end...
But...
I think if record is added by pressing ALT-A, you can delete it using delete, remember to lock records if databese is opened in shared mode.
Marek

Re: Browse in network environment - how to lock edited row?

Posted: Mon Mar 23, 2009 12:32 am
by esgici
mol wrote:Hi guys!
... but, how to declare this using IDE??
I want to add, that if I edit my *.FMG file manually and add phrase EDIT INPLACE
It causes runtime error...
Hi Marek

Sorry for delay in answering your question (and I hope that you could be tolerant as usually for my VERY broken English ).

As you (and I guess all HMG users) know, except a few DEFINE only controls, almost all HMG controls ( including BROWSE) have two syntax: @ <row>,<col> command and DEFINE ... END structure. Perhaps a missed point is, some keywords may vary between two syntax, such as EDIT, APPEND and DELETE clauses of browse.

In other hand IDE use only DEFINE ... END structure. So, you have use ( by assigning a logical value ) to AllowAppend, AllowEdit, AllowDelete properties when working in IDE instead of EDIT, APPEND and DELETE keywords (as explained in my IDE Sample : Browse page). That is all.

Regards

--

Esgici