How to Pass Pre-defined field values in EDIT

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
swapan
Posts: 242
Joined: Mon Mar 16, 2009 4:23 am
Location: Kolkata, India
Contact:

Re: How to Pass Pre-defined field values in EDIT

Post by swapan »

Czarny_Pijar wrote:If I can suggest for the contributors the way for solving this problem...

Suppose we've to deal with with my_base.dbf database. In my opinion the easiest way for both programmers/users is:

1) check the existence of defaults/my_base.dbf
2) if exists, read 1st record to get the default values.
I wishes to pass the default values programtically like the way we are able to pass the "field captions" through coding in EDIT. One more parameter through which we can pass such values, and if not passed then it should be handled in the same way as it is handled now by Edit/ Edit extended.
Thanks & Regards,
Swapan Das

http://www.swapandas.com/
User avatar
Czarny_Pijar
Posts: 172
Joined: Thu Mar 18, 2010 11:31 pm
Location: 19.2341 E 50.2267 N

Re: How to Pass Pre-defined field values in EDIT

Post by Czarny_Pijar »

swapan wrote:I wishes to pass the default values programtically like the way we are able to pass the "field captions" through coding in EDIT.
IMHO this is the hard way, because changing the default value will force you to the recompile/reinstall process, instead of change only the value in the database.
User avatar
gfilatov
Posts: 1116
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: How to Pass Pre-defined field values in EDIT

Post by gfilatov »

swapan wrote: I wishes to pass the default values programtically like the way we are able to pass the "field captions" through coding in EDIT. One more parameter through which we can pass such values, and if not passed then it should be handled in the same way as it is handled now by Edit/ Edit extended.
Hello,

I've attached an updated sources and sample of command EDIT with the following changes:
- added new parameter INIT <aInitArray> to i_edit.ch
- added support for init value at adding record to h_edit.prg
- updated sample with using a new parameter (look at screenshot below)

How to usage:
- just copy these three files to corresponding folders per folder's structure of attached archive
- recompile library libedit.a by command source\edit\MakeLib.bat
- start sample by command build demo

I hope that helps :idea:
Attachments
Sample Edit.1 screenshot
Sample Edit.1 screenshot
edit-screen.jpg (46.04 KiB) Viewed 2403 times
edit-upd.zip
Updated sources for EDIT command
(13.13 KiB) Downloaded 215 times
Last edited by gfilatov on Mon Mar 29, 2010 12:28 pm, edited 1 time in total.
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
Czarny_Pijar
Posts: 172
Joined: Thu Mar 18, 2010 11:31 pm
Location: 19.2341 E 50.2267 N

Re: How to Pass Pre-defined field values in EDIT

Post by Czarny_Pijar »

Many thanks - dziękuję - Велика подяка за зусиль до цієї справи. ;)

Though somewhat pity the things are going this way... One objection I've posted befere, yet another:
Suppose you've created the application for many of your clients, and they have the different defaults. Now you should keep the different copy of the program for every of your client... Headache guaranteed. :?
There's the bright side too: you have to keep contact with your clients and bill them periodically :twisted:
User avatar
cdsaenz
Posts: 58
Joined: Sun Jul 11, 2010 4:02 am

Re: How to Pass Pre-defined field values in EDIT

Post by cdsaenz »

If you want to pass some default hardcoded values I think what you should use is the VALUE property of textboxes for example.

But as Czarny_Pijar indicated, it is not very tidy. I would try something like reading the values on form startup, from an INI File.
Charly
Argentina, Hobbyist developer, Clipper/Delphi/PHP/Progress
Post Reply