Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: George Kelly
  Where is George Kelly?
 Dromore
 United Kingdom
 George Kelly
 To: tushar
  Where is tushar?
 Kolhapur, Maharastra
 India
 tushar
 Tags
Subject: RE: Taking advantage of larger screen resolutions
Thread ID: 83768 Message ID: 120237 # Views: 32 # Ratings: 0
Version: Visual FoxPro 7 Category: General VFP Topics
Date: Tuesday, January 30, 2007 1:34:06 PM         
   


> > > > > "This looks like a very good idea for new projects..."
> > > > >
> > > > > George,
> > > > >
> > > > > When you have the sizer that you want, why not retrofit your old forms. Create your new form class (inlcuding the sizer) and then open your form as a table and change the form's classlib and class name:
> > > > >
> > > > > USE [Path2\MyForm.SCX] IN 0 EXCL ALIAS MyForm
> > > > > SELECT MyForm
> > > > > LOCATE FOR BaseClass = [Form]
> > > > > REPLACE Class WITH [MySizerFormClassName], ;
> > > > >         ClassLoc WITH [FulPath2\MyBaseClassLib.VCX]
> > > > > USE IN SELECT([MyForm])
> > > > > 

> > > > >
> > > > > With VFP, just about everything is a table. Using ADIR() you could write a little program that looped through all of the forms in you Forms directory and change the class and classlib to your new new sizerform class.
> > > > >
> > > > >
> > > > > Ken
> > > > > You shall know the truth - and the truth shall set you free. (John 8:33)
> > > >
> > > > This is real good for application wide changes Ken!
> > > > Question:
> > > > Is it OK to insert "records" e.g. Command buttons
> > > > If yes, What are the rules for assigning values for UniqueID and timestamp.
> > > >
> > > > George
> > >
> > > Unique IDs sys(2015)
> > > TimeStamp I use seconds()*1000
> > >
> > > Regards
> > > Tushar
> >
> > Thanks Tushar!
> > I'm still experimenting.
> >
> > Ive written a small program which scans through a table of forms, opening each form in the file as a table, looks for a "marker" in INIT code, and inserts a new block of code immediately before the location of that "marker" code.
> > Problem is:
> > When I view the updated table (i.e. the form opened as a table) I can see my changes - perfectly. My block of code has been inserted at the correct position.
> >
> > However, When I open the form using
> > modify form myform
> > I DONT see the NEW code!!!
> >
> > EDITED LATER: I FOUND THE REASON FOR ABOVE BEHAVIOR
> > After making changes to the form's table you must do this:
> > compile FORM myform
> >
> > May be of interest to others (and save hairloss!)
> >
> > George
>
> I forgot to tell you that yesterday. By today you had already found that out for yourself. Hope there wasn't too much hairloss :).
>
> Some other things that may not be immediately apparent
> In the record with class='form' , the field reserved3 has a list of methods / properties that you declare. Methods start with '*'. All properties seem to be listed first.
> In the record with class='dataenvironment' , the field reserved2 has the Number of Tables + Number of Relationships +1.
>
> Hope this prevents hairloss during your experiments.
>
> Also check out http://www.foxite.com/archives/0000119235.htm
>
> Regards
> Tushar

Thanks for the link. Ive saved that code by Eric (thanks Eric).
One niggly problem remains, Tushar.

(When things are easy, nothing is learned. When a bit of code doesnt work, you explore, and learn a LOT. Hairloss caused by brain expansion?)

Heres the latest status
Background to my exercise:
When you add Labels to forms, they default to Name= like Label1, Label2 etc.
When you add Command buttons to a forms, they default to Name= Command1, Command2 etc.
I usually rename them to something more meaningful. However, many remain set at the default.
I'm making my apps multi-lingual. Anything with captions needs to be bi-lingual.
In referring to Labels and Command buttons, I wanted their names to relate in some way to their purpose.

What I did:
Using Ken Murphys tip in the thread, I developed a program to scan all the forms in my folder, and added them to a table= Formlist. Then I processed each form in formlist and wrote exceptions to a table which I call Fixlist - its an exception table of labels and command buttons which have the default names.

I then browse the Fixlist table (a few hundred records, from a hundred or so forms), and type in a value in a NEWobjname field.

Changing the Name property in my forms:
I developed a program to update the "Name" in the Myform.scx table

I change the value in the field Myform.objname to NEWobjname

and

In the myform.properties field I search for the old, find and replace:
Name= "Label1" to Name= "Newobjname".

(More hairloss to figure out what to change, and to develop that code)

Same for Command buttons.

Then when the form is processed, (objnames changed in myform.sct TABLE) I do a
Compile form myform

Then I keep my fingers crossed, and do:
modify form myform

The niggly problem. I get a series of error messages, telling me that Name is incorrect, one message for each field changed.
Fortunately the form opens!! The Name values have changed to my new values, as expected.
I SAVE the form.
I modify form again, and it opens with NO errors.

Looks like the "Compile form" code executed when the form is saved is doing a little bit more than when I execute the "compile form" command in my Conversion program.

Have you experienced that before? Looks like you have done some work in this field?

George

COMPLETE THREAD