Jim,
I also agree. The code can be expanded to do reports and labels too.
Since my reports an labels depend on views, which depend on 'X'
variables, I redefine those at the start of step 2. I modified the
code to ignore my variables starting with 'x'
Actually, I modified it a lot. Now I run the code, it asks me about
which objects to list. I respond and it gives me the proper choose.
After the choose it automatically brings up the object in the designer.
I minimize the designer, and run the code again and it brings up the
list in rbedit.
Interesting side effect is that the designer is automatically closed
after the second run when I do this.
This was done for a client with RB6.5+ since that version does not
support the clipboad command and some others in your code.
Dennis McGrath
--- "David M. Blocker" <[EMAIL PROTECTED]> wrote:
> Thanks for sharing this little gem Jim!
>
> David Blocker
> [EMAIL PROTECTED]
> 781-784-1919
> Fax: 781-784-1860
> Cell: 339-206-0261
> ----- Original Message -----
> From: "Jim Limburg" <[EMAIL PROTECTED]>
> To: "RBASE-L Mailing List" <[EMAIL PROTECTED]>
> Sent: Friday, November 21, 2003 8:19 AM
> Subject: [RBASE-L] - Re: RB6.5++ Memory Problems
>
>
> > Steven
> >
> > I have written a little cmd file that makes setting of variables
> before
> > running a form a bit easier..
> >
> > It will work with version 6.5++ or 7. Because of the ability that
> when
> > we open a form in design mode Rbase declares all the vars behind
> the
> > scenes I wanted to take advantage of this. To run this file on a
> 6.5++
> > form type RUN frmvrlst.c2r at R:> and it will prompt you for the
> forms
> name.
> > Then pick '1. Run Step One' in the Choose menu. After this it
> should
> > prompt you to open the form in design mode, and then rerun by
> typing
> > RUN frmvrlst.c2r at R:> and pick '2. Run Step Two' after this close
> the
> > form in design mode and you can just ('PASTE', Crtl-V,
> Right-single-click
> > and choose Paste) to get the results of my code. What it will do is
> > get a list of all var listed in the 'Var List' for the form and
> then
> > alter then presetting them to NULL
> > Let's say you have a var declared as vf_myvar = (This - that) in
> the
> > form. Then it will write the var command out as SET VAR vf_myvar
> TEXT =
> NULL
> >
> > Check it out.
> >
> > Oh, P.S. To run this on version 7 you don't have to open the form
> in
> > design mode. RBTI was kind enough to enable this option to be able
> to
> > do it in code.
> >
> > *(
> >
>
--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
> > PROGRAM NAME: frmvrlst.c2r
> >
> > AUTHOR: Jim Limburg
> > Tuftco Corporation
> > 2318 Holtzclaw Ave, Chattanooga, TN 37404
> > Voice: 423-698-8601 Fax: 423-698-0842
> > email: [EMAIL PROTECTED] --business
> > [EMAIL PROTECTED] --business
> > [EMAIL PROTECTED] --home
> >
> > PURPOSE: Capture the variables needed to run a form.
> > Will set the clipboard to a list of SET VAR
> > statements that a form needs to have preset
> > before running
> >
> > IS RUN BY: Be connected to the database you are working
> > with and then type at R> prompt: RUN
> frmvrlst.c2r
> > This will prompt you for a form name from the
> list
> > of forms in the database. If running Rb7 at this
> > point it will then open this form in design
> mode.
> > Do it's work behind the scenes and copy the
> > variable list to the clipboard.
> > Then all you have to do is hit Ctrl-V to paste
> it
> > into a file.
> > If you are running RB6.5++ then you have to run
> > this in a two step process and open the form in
> > design mode when prompted between the two stages
> > of this process.
> >
> > RETURNS: Sets the Clipboard to a list of variables
> > that can be pasted into your code before a form
> call.
> >
> > MODIFICATION HISTORY
> > Created: 11/18/2003
> > RB Vers: Works with RB7, and with 6.5++
> >
> >
>
--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
> > )
> > SET CLIPBOARD ' '
> > SET VAR vm_instepprocess TEXT
> > IF vm_instepprocess <> 'Y' THEN
> > CLEAR ALL VARIABLES
> > ENDIF
> > SET VAR vm_dbname TEXT = NULL
> > SET VAR vm_dbname = (CVAL('database'))
> > IF vm_dbname IS NOT NULL THEN
> > CLEAR VAR vm_dbname
> > SET VAR vm_formname TEXT = NULL
> > SET ERROR MESSAGES OFF
> > SET MESSAGES OFF
> > SET ERROR VARIABLE errvar
> > CHOOSE vm_formname FROM #FORMS
> > IF vm_formname IS NOT NULL AND vm_formname <> '[Esc]' THEN
> > SET VAR vm_rbver = (CVAL('version'))
> > SET VAR vm_sloc = (SLOC((LUC(.vm_rbver)),'V7'))
> > IF vm_sloc > 0 THEN
> > SET VAR vm_mscmd TEXT = ('forms ' + ' ' + .vm_formname)
> > &vm_mscmd
> > CLS
> > CLEAR VAR vm_ms%
> > ELSE
> > --If we get here then we are in another version 6.5 likely
> > --but had better check
> > SET VAR vm_sloc = (SLOC((LUC(.vm_rbver)),'V6.5'))
> > IF vm_sloc > 0 THEN
> > SET VAR vm_action TEXT = NULL
> > CHOOSE vm_action +
> > FROM #LIST '1. Run Step One,2. Run Step Two,3. Quit' +
> > AT CENTER CENTER TITLE 'Choose Next Action' +
> > CAPTION 'Run Options...' LINES 5 FORMATTED
> > IF vm_action IS NOT NULL AND vm_action <> '[Esc]' THEN
> > SWITCH (.vm_action)
> > CASE '1. Run Step One'
> > SET VAR vm_msg1 TEXT = ('Open' + ' ' + .vm_formname)
> > SET VAR vm_msg TEXT = +
> > (.vm_msg1 + ' ' + +
> > 'form in design mode, leave it open, and then run
> step
> two.')
> > PAUSE FOR 11 USING .vm_msg CAPTION 'Instructions'
> > CLEAR ALL VAR EXCEPT vm_formname
> > SET VAR vm_instepprocess = 'Y'
> > CLEAR VAR vm_action
> > GOTO lbexit
> > BREAK
> > CASE '2. Run Step Two'2
> > CLEAR VAR vm_action
> > GOTO stp2
> > BREAK
> > CASE '3. Quit'
> > CASE '[Esc]'
> > CLEAR ALL VAR EXCEPT vm_formname
> > GOTO lbexit
> > BREAK
> > ENDSW
> > ENDIF
> > ELSE
> > PAUSE 2 USING 'This is only designed for version 6.5 or 7'
> +
> > CAPTION 'Runtime error'
> > ENDIF
> > ENDIF
> > LABEL stp2
> > CLEAR VAR errvar
> > CLEAR VAR vm_rbver,vm_sloc
> > OUTPUT formvars.lst
> > SHOW VAR
> > OUTPUT SCREEN
> > SET ERROR MESSAGES 2038 OFF
> > DROP TABLE frmvars
> > SET ERROR MESSAGES 2038 ON
> > CREATE TABLE frmvars +
> > (varname TEXT 20, varvalue TEXT 42, vartype TEXT 10)
> > LOAD frmvars FROM formvars.lst +
> > AS FORMATTED USING varname 1 18, varvalue 22 61, vartype 62 72
> > CLS
> > *(This is where it parses the information it has gathered from
> the
> > table and creates the file to hold the SET VAR
> statements.)
> > SET VAR vm_vars NOTE = NULL
> > SET ERROR MESSAGES 2077 OFF
> > ERASE frmvars.txt
> > SET ERROR MESSAGES 2077 ON
> > SET ERROR MESSAGES 705 OFF
> > DROP CURSOR curs1
> > SET ERROR MESSAGES 705 ON
> > DECLARE curs1 SCROLL CURSOR FOR SELECT varname, vartype FROM
> frmvars
> > OPEN curs1
> > FETCH FIRST FROM curs1 INTO vm_vname IND vm_v1, vm_vtype IND
> vm_v2
> > SET VAR vm_vnameshort TEXT = (SGET(.vm_vname,5,1))
> > WHILE SQLCODE <> 100 THEN
> > SWITCH (.vm_vnameshort)
> > CASE '#DATE'
> > CASE '#TIME'
>
=== message truncated ===