Data driving forms problem 
Author Message
 Data driving forms problem

I am attempting to use tables to define my main forms
pageframe tabs and buttons.

It's working really well - I can change the number of tabs
depending on what the customer has access to,
resize/reposition the buttons by amending the tables etc.

The one thing I have a problem with is getting code into
the methods from the table e.g. a button's click event.
Replacing the click event gives a read-only error. I tried
defining a button class using the definitions from the
table but again defining PROCEDURE CLICK with eval
(myfield) etc doesn't work.

Has anyone tried this before and got it working?

Bernie



Thu, 01 Sep 2005 16:12:52 GMT  
 Data driving forms problem
Bernie,

Methods are readonly at runtime, ie once a class has been instantiated it's
methods can no longer be changed.

If you are using VFP7 or later you can use the ExecScript() function. In
VFP6 you can issue runtime COMPILE commands to compile the memo to an fxp
that the button click has already be programmed to call.


Quote:
> I am attempting to use tables to define my main forms
> pageframe tabs and buttons.

> It's working really well - I can change the number of tabs
> depending on what the customer has access to,
> resize/reposition the buttons by amending the tables etc.

> The one thing I have a problem with is getting code into
> the methods from the table e.g. a button's click event.
> Replacing the click event gives a read-only error. I tried
> defining a button class using the definitions from the
> table but again defining PROCEDURE CLICK with eval
> (myfield) etc doesn't work.



Fri, 02 Sep 2005 02:41:47 GMT  
 Data driving forms problem
On Sun, 16 Mar 2003 00:12:52 -0800, "Bernie Beattie"

Quote:

>I am attempting to use tables to define my main forms
>pageframe tabs and buttons.

>It's working really well - I can change the number of tabs
>depending on what the customer has access to,
>resize/reposition the buttons by amending the tables etc.

>The one thing I have a problem with is getting code into
>the methods from the table e.g. a button's click event.
>Replacing the click event gives a read-only error. I tried
>defining a button class using the definitions from the
>table but again defining PROCEDURE CLICK with eval
>(myfield) etc doesn't work.

>Has anyone tried this before and got it working?

>Bernie

I am working in VFP 5, so have none of the features mentioned by
David. I have built data collection based on a table, allowing easy
configuration as each site needs different things, and requirements
change periodically.

What I have done is build classes for each type of field I want on my
forms. Typical features of the classes are picture clauses / formats
and especially valid events. The latter tend to refer to lookup tables
where ranges for dates / times and numbers are stored. e.g. for a
date, there will be the name of a date on which the earliest possible
date will be based, together with (+/-) maximum deviation. Same for
latest possible date. I have been surprised how few classes I really
need. I mainly use four - Y/N/dk; dates; numbers; drop down list with
fixed list of options. Options are stored in tables, so can readily be
modified.

For making tabs and even fields accessible, the table containing the
list of tab and field definitions contains two extra fields, base_var
and base_val. Base_var contains the name of a field which has to be
tested to see whether the data should be collected. Base_val contains
rules about the contents of that field governing whether the tab /
field is accessible. These rules can include !, e.g. !empty(), !Y.

These rules for enabling items are applied at the pageframe level
(i.e. only the current pageframe is updated) :
1. when building the form;
2. when changing pageframe;
3. when validating data;
4. when reverting data;
5. when changing record including add / delete / recover a record.

Perhaps this system is made easier by the fact that all data directly
edited by a user including date and numeric is actually stored as
character data.

Any fields that are blocked are filled with * when a record is saved
(tableupdate) to ease data management.

HTH,
        Mike.



Fri, 02 Sep 2005 16:34:10 GMT  
 Data driving forms problem
Thanks David. The execscript works.

The only problem I now have is most of the memo fields I
am running via execscript call a form e.g DO FORM
S_PROP.SCX. These forms are physically in another folder
but are built into the exe. The button when clicked says
File S_PROP.SCX not found. I've had this problem before in
VFP7 if you go into our application immediately after
building but this was ok on exiting VFP and coming back
in. In this case I can't get it to work by exiting or
running the exe from Explorer or Start Run so I'm not sure
what I can do. The screen files are not distributed to end
users so I can't hard code the path.

Any ideas?

Bernie  

Quote:
>-----Original Message-----
>Bernie,

>Methods are readonly at runtime, ie once a class has been
instantiated it's
>methods can no longer be changed.

>If you are using VFP7 or later you can use the ExecScript
() function. In
>VFP6 you can issue runtime COMPILE commands to compile
the memo to an fxp
>that the button click has already be programmed to call.


message

>> I am attempting to use tables to define my main forms
>> pageframe tabs and buttons.

>> It's working really well - I can change the number of
tabs
>> depending on what the customer has access to,
>> resize/reposition the buttons by amending the tables
etc.

>> The one thing I have a problem with is getting code into
>> the methods from the table e.g. a button's click event.
>> Replacing the click event gives a read-only error. I
tried
>> defining a button class using the definitions from the
>> table but again defining PROCEDURE CLICK with eval
>> (myfield) etc doesn't work.

>.



Fri, 02 Sep 2005 22:25:25 GMT  
 Data driving forms problem
Bernie,

It sounds like a SET PATH problem.

--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro


Quote:
> Thanks David. The execscript works.

> The only problem I now have is most of the memo fields I
> am running via execscript call a form e.g DO FORM
> S_PROP.SCX. These forms are physically in another folder
> but are built into the exe. The button when clicked says
> File S_PROP.SCX not found. I've had this problem before in
> VFP7 if you go into our application immediately after
> building but this was ok on exiting VFP and coming back
> in. In this case I can't get it to work by exiting or
> running the exe from Explorer or Start Run so I'm not sure
> what I can do. The screen files are not distributed to end
> users so I can't hard code the path.



Sat, 03 Sep 2005 00:51:56 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. converting form driven input to code driven input

2. Problem putting data from a form into a table

3. Foxpro 7.0 data concurency on mapped drive

4. Program on hard drive, Data on Internet

5. Report Form FPW2.6 - data grouping problem

6. developing for data access on mapped drive

7. Determining the '\\server\drive\' data

8. Connection problem with Remote Views in a Data Environment of a Form

9. Data Env. / Form Navigation Problem

10. VFP 5.0 Form,Data Environment, Data Session

11. FPW26: Cannot read from drive <drive>

12. exe wont run on net drive, works fine on local drive

 

 
Powered by phpBB® Forum Software