Browse in network environment - how to lock edited row?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
mol
Posts: 3409
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 268 times
Been thanked: 173 times
Contact:

Browse in network environment - how to lock edited row?

Post 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...

User avatar
sudip
Posts: 1446
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India
Has thanked: 5 times
Been thanked: 2 times

Post 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
With best regards,
Sudip

User avatar
mol
Posts: 3409
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 268 times
Been thanked: 173 times
Contact:

Post 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

User avatar
esgici
Posts: 4538
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 410 times
Been thanked: 118 times
Contact:

Post 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
Viva INTERNATIONAL HMG :D

Post Reply