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: 120385 # Views: 25 # Ratings: 0
Version: Visual FoxPro 7 Category: General VFP Topics
Date: Wednesday, January 31, 2007 3:41:42 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
> > > > > > >
> > > > > > > Those are the two places where I put the value of the name. Can you upload the form giving errors. I don't actually use the compile form command. I rebuild the project with recompile. If this goes thru, I will also be using the compile form command as it will be faster.
> > > > > > >
> > > > > > > Regards
> > > > > > > Tushar
> > > > > >
> > > > > > I'm not at my development computer at present, but I'll try the project recompile and see how it workd for me.
> > > > > > Shall I upload a form as an attachment?
> > > > > >
> > > > > > George
> > > > >
> > > > > Zip it and upload it here.
> > > > >
> > > > > Regards
> > > > > Tushar
> > > >
> > > > File attached Tushar
> > > > Instructions:
> > > > Open the program: applyfixes
> > > > Theres a readme at the beginning of the code, and credits at the end.
> > > >
> > > > George
> > > > http://www.foxite.com/uploads/dbac0634-d73c-4f1d-bfd6-a78c16dca827.zip
> > >
> > > I think you need a space after the =
> > > Name = "cmdNewName"
> > >
> > > Which version are you using. VFP7 refused to open the form.
> > >
> > > Regards
> > > Tushar
> >
> > I dint incluse the program which created the table FIXLIST Tushar.
> > I'll upload that later.
> >
> > I'm using VFP9
> >
> > For a test, Ive switched to VFP7 and re-run the program.
> > As you say, it does NOT open the amended form. However it returns additional ERROR message info:
> > .name: expression is invalid. Use a valid expression for NAME property
> > Note the . before Name
> > When you open the file as a table, you'll find no . before Name
> >
> > RE: I think you need a space after the =
> > Yes, The position of the = (and spaces) is important.
> > However, the format of the replacement text is exactly the same format as the original.
> > Note how the program starts with a RAT() looking for Name, and builds the original string up one character at a time, to get the exact original format.
> > As per comments in the program, I found the the format was slightly different between Command and Label
> > In development, I did a RAT() for Name =
> > I got the program to work for one, but it failed in the other.
> > Hence I went back a few characters and did a RAT() for Name
> >
> > I'm planning to use the program in LIVE forms today. I'll let you know how it goes.
> >
> > George
>
> I think there is something wrong in your program. When I tried it, it updated it without the space after the =. Why don't you use STRT()
>
> replace properties with strt(properties,'Name = "OldName"','Name = "NewName"')
>
> Regards
> Tushar

GOTTIT!
It now works perfectly in VFP7 and 9
The program was not including that space between = and "
I'll wrap up the programs, plus the additional ones to create the file FORMLIST and FIXLIST, and upload later

P.S. Ive never used strt (= strtofile) in my programs.
Any advantages?

George

COMPLETE THREAD