dbTalk Databases Forums  

Form Designer (vfp8)

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss Form Designer (vfp8) in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
El Krbaccha
 
Posts: n/a

Default Form Designer (vfp8) - 12-29-2003 , 05:17 AM







(DField - database file field)
(SField - screen field (only on screen))

DField1: 1111985330153

I wont take from DField1 birth date:

SField1: 11/11/1985

Q: - how to open (in Form Designer, vfp8) field which has only
function to display data information.
(In FoxPro 2.6 - I did that on way that I use '@ ... get' command then
'clear gets' rather then '@ ... say'

So, in vfp8 I tried with creating 'text box' from Form Controls
menu, then point to this Text1 field, right click and go to Code. )I
rather prefer something like "get - clear get (inverse)" then text,
but...

Sol, code is:

jmbg=left(DField1,7)

IF SUBSTR(jmbg,5,1)= "0"
ss = "2"
ELSE
ss = "1"
ENDIF

datum=ss+datrodj

*************** German form **************
* ? right(datum,2)+'.'+SUBSTR(datum,5,2)+'.'+LEFT(datu m,4)+'.'
*********************************************


and the second Q

D1Field7 is a key from first base,
D2Field7 is a key from relational base,
D2Field11 interesting field.

I want to read D1Field7, then from the second (relation) base read
D2Field11 to pick up the name, and display on screen. Similar like
first Q goes.


Thanks.

Reply With Quote
  #2  
Old   
Michael Collins
 
Posts: n/a

Default Re: Form Designer (vfp8) - 12-29-2003 , 08:31 AM






El Krbaccha wrote:
Quote:
(DField - database file field)
(SField - screen field (only on screen))

DField1: 1111985330153

I wont take from DField1 birth date:

SField1: 11/11/1985

Q: - how to open (in Form Designer, vfp8) field which has only
function to display data information.
(In FoxPro 2.6 - I did that on way that I use '@ ... get' command then
'clear gets' rather then '@ ... say'

So, in vfp8 I tried with creating 'text box' from Form Controls
menu, then point to this Text1 field, right click and go to Code. )I
rather prefer something like "get - clear get (inverse)" then text,
but...

Sol, code is:

jmbg=left(DField1,7)

IF SUBSTR(jmbg,5,1)= "0"
ss = "2"
ELSE
ss = "1"
ENDIF

datum=ss+datrodj

*************** German form **************
* ? right(datum,2)+'.'+SUBSTR(datum,5,2)+'.'+LEFT(datu m,4)+'.'
*********************************************


and the second Q

D1Field7 is a key from first base,
D2Field7 is a key from relational base,
D2Field11 interesting field.

I want to read D1Field7, then from the second (relation) base read
D2Field11 to pick up the name, and display on screen. Similar like
first Q goes.


Thanks.
For your 1st question, there are some things I don't understand:
- Why is the date string only 7 char? Why not 8 (2+2+4)?
- What does using 'clear gets' have to do with your question?
- What is datrodj and where did it come from?

If I understand your 2nd question, try this:

* Get the current key field value.
lcField7 = D1Field7

* Use SQL Select to retrieve desired field from table D2 into lcField11.
SELECT D2Field11 ;
FROM D1, D2 ;
WHERE D1Field7 = D2Field7 ;
AND D1Field7 = lcField7 ;
INTO ARRAY lcField11

? lcField11

Hope That Helps,
Mike Collins



Reply With Quote
  #3  
Old   
El Krbaccha
 
Posts: n/a

Default Re: Form Designer (vfp8) - 01-05-2004 , 02:27 AM



On Mon, 29 Dec 2003 09:31:59 -0500, "Michael Collins"
<mike (AT) nospam (DOT) com> wrote:

Quote:
El Krbaccha wrote:
(DField - database file field)
(SField - screen field (only on screen))

DField1: 1111985330153

I wont take from DField1 birth date:

SField1: 11/11/1985

Q: - how to open (in Form Designer, vfp8) field which has only
function to display data information.
(In FoxPro 2.6 - I did that on way that I use '@ ... get' command then
'clear gets' rather then '@ ... say'

Well, I wrote a small prggy which described what I want. This is for
FoxBase, FoxPro 2.6 (DOS, Unix).

So, if someone have some suggestions (or code, example) how to get the
same thing but in vfp8 or even better - how to get the same thing with
screen wizard (Form Designer), well, I'll be so gratefull

bases:

************************************************** **********************
FBSTREET.dbf

Record# ADR_KEY NAME

1 001010 FIRST STREET
2 001111 SECOND STREET
3 001100 3rd STREET
4 077777 ROAD 66
5 088888 SESAME STREET
6 099999 WALL STREET
7 011111 42nd STREET
8 055555 TURK STREET
9 044444 110th STREET
10 022222 ELM STREET
11 033333 CLOSED ROAD
12 001011 ALASKA HIGHWAY
************************************************** **********************
FBBASE.DBF

Record# FNAME LNAME ID ADR_KEY HOUSE

1 WILLIAM HENRY GATES 2810955335261 11111
111
2 ROY BUCHANAN 1312954335116 22222
12
3 LOUISE VERONICA CICCONE 1608958335004 33333 345
4 CARL LEWIS 0107961335055 44444
5 NICHOLAS COPPOLA 0701964335078 55555
1472
6 MARLON BRANDO 0304924335169 01011 90
7 NAOMI CAMPBEL 2205970335027 77777 116
8 NICOLE MARY KIDMAN 2006967335135 88888
72
9 BJORN BORG 0606956335301 99999 88
10 PHILIP DAVID CHARLES COLLINS 3001951335061 01010 55
11 CATHERINE ZETA JONES 2509969335203 01011
637
12 DYLAN MICHAEL DOUGLAS 0808000335044 01011
637
13 BEYOCE GISELLE KNOWLES 0409981335183 01011 69
14 CHRISTOPHER ANTON REA 0403951331114 77777 117
************************************************** ************************************************

prggy.prg

set talk off
clear
close all
public mBD, lk

sele 2
* inde on adr_key to key
use fbstreet inde key

sele 1
use fbbase
set rela to adr_key into B

do mask


*do whil .t.
*wait
*lk = lastkey()
*? lk
*if lk = 27
* return
*endi
*endd


do whil .T.

do getty
read
lk = lastkey()
do case
case lk = 60 .or. lk = 19
if recno() > 1
skip -1
else
?? chr(7)
endif
case lk = 62 .or. lk = 4
if recno() < recc()
skip
else
? chr(7)
endif
case lk = 116.or. lk = 84
go top
case lk = 98 .or. lk = 66
go bott
case lk = 27
return
endcase
endd




*wait
*return
*quit

proc mask
@ 2,2 to 20, 77 double
@ 4, 4 say "First Name:"
@ 5, 4 say "Last Name:"
@ 4,41 say "ID:"
@ 5,41 say "BD:"
@ 7, 4 say " Street:"
@14,24 say "+---------------+ +---+"
@15,24 say "¦ T ¦ < ¦ > ¦ B ¦ ¦ESC¦"
@16,24 say "+---------------+ +---+"

retu

proc getty
@11,30 say trim(str(recno()))+"/"+ltrim(str(recc()))
@ 4,16 get fname
@ 5,16 get lname
@ 4,45 get id

*****************************************
@ 5,45 say onetwo(mBD) color i

* because "get" with function not works;
* for instance *@ 5,45 GET onetwo(mBD)*
* well, never mind.
* BUT this is the WHOLE question - how, in
* vfp8 screen wizard, (mask, form, I don't
* know ) put memory variable...and fill
* it like here. (code is for FP26)
*****************************************

@ 7,16 get Adr_key
@ 7,22 get b->name
@ 7,45 get House
clear gets
retu

proc onetwo
parameters what
if subs(ID,5,1) = '0'
what=left(ID,2)+'.'+subs(ID,3,2)+'.2'+subs(ID,5,3) +'.'
else
what=left(ID,2)+'.'+subs(ID,3,2)+'.1'+subs(ID,5,3) +'.'
endi
return what
************************************************** ******************





Reply With Quote
  #4  
Old   
Michael Collins
 
Posts: n/a

Default Re: Form Designer (vfp8) - 01-05-2004 , 09:08 PM



It seems to me llike you have a couple issues to me:
1. Doing your basic data display/input using form fields.
2. Calling desired functions for getting some data like you want it.
3. Using related tables.

For #1, in VFP you do most of that just by setting properties rather than in code. Like setting the textbox ControlSource property.
For #2, try using form or control methods, depending on what you want to achieve. For example, to do a one time thing when a form starts up, try using the form's Init method (right click on form, choose Properties, click Methods tab, double click on Init Event). If you want to do control level validation, use the control's Valid event (right click on control, choose Properties, click Methods tab, double click on Valid Event). Etc. etc. depending on when you want your code to run.
For #3, I would use views (create the view in the View Designer, then add it to the form's Data Environment by right clicking on the form, choose Data Environment, right click in Data Environment, choose Add). (Any tables or views in the form's Data Environment get automatically opened and closed with the form, and are available from any form or form control methods).

I would suggest if you are totally new to VFP to start with an example using just #1 concepts, then add #2 when everything works, then add #3 concepts.

HTH,
Mike


El Krbaccha wrote:
Quote:
On Mon, 29 Dec 2003 09:31:59 -0500, "Michael Collins"
mike (AT) nospam (DOT) com> wrote:

El Krbaccha wrote:
(DField - database file field)
(SField - screen field (only on screen))

DField1: 1111985330153

I wont take from DField1 birth date:

SField1: 11/11/1985

Q: - how to open (in Form Designer, vfp8) field which has only
function to display data information.
(In FoxPro 2.6 - I did that on way that I use '@ ... get' command
then 'clear gets' rather then '@ ... say'


Well, I wrote a small prggy which described what I want. This is for
FoxBase, FoxPro 2.6 (DOS, Unix).

So, if someone have some suggestions (or code, example) how to get the
same thing but in vfp8 or even better - how to get the same thing with
screen wizard (Form Designer), well, I'll be so gratefull

bases:

************************************************** **********************
FBSTREET.dbf

Record# ADR_KEY NAME

1 001010 FIRST STREET
2 001111 SECOND STREET
3 001100 3rd STREET
4 077777 ROAD 66
5 088888 SESAME STREET
6 099999 WALL STREET
7 011111 42nd STREET
8 055555 TURK STREET
9 044444 110th STREET
10 022222 ELM STREET
11 033333 CLOSED ROAD
12 001011 ALASKA HIGHWAY
************************************************** **********************
FBBASE.DBF

Record# FNAME LNAME ID ADR_KEY HOUSE

1 WILLIAM HENRY GATES 2810955335261 11111
111
2 ROY BUCHANAN 1312954335116 22222
12
3 LOUISE VERONICA CICCONE 1608958335004 33333 345
4 CARL LEWIS 0107961335055 44444
5 NICHOLAS COPPOLA 0701964335078 55555
1472
6 MARLON BRANDO 0304924335169 01011 90
7 NAOMI CAMPBEL 2205970335027 77777 116
8 NICOLE MARY KIDMAN 2006967335135 88888
72
9 BJORN BORG 0606956335301 99999 88
10 PHILIP DAVID CHARLES COLLINS 3001951335061 01010 55
11 CATHERINE ZETA JONES 2509969335203 01011
637
12 DYLAN MICHAEL DOUGLAS 0808000335044 01011
637
13 BEYOCE GISELLE KNOWLES 0409981335183 01011 69
14 CHRISTOPHER ANTON REA 0403951331114 77777 117
************************************************** ************************************************

prggy.prg

set talk off
clear
close all
public mBD, lk

sele 2
* inde on adr_key to key
use fbstreet inde key

sele 1
use fbbase
set rela to adr_key into B

do mask


*do whil .t.
*wait
*lk = lastkey()
*? lk
*if lk = 27
* return
*endi
*endd


do whil .T.

do getty
read
lk = lastkey()
do case
case lk = 60 .or. lk = 19
if recno() > 1
skip -1
else
?? chr(7)
endif
case lk = 62 .or. lk = 4
if recno() < recc()
skip
else
? chr(7)
endif
case lk = 116.or. lk = 84
go top
case lk = 98 .or. lk = 66
go bott
case lk = 27
return
endcase
endd




*wait
*return
*quit

proc mask
@ 2,2 to 20, 77 double
@ 4, 4 say "First Name:"
@ 5, 4 say "Last Name:"
@ 4,41 say "ID:"
@ 5,41 say "BD:"
@ 7, 4 say " Street:"
@14,24 say "+---------------+ +---+"
@15,24 say "¦ T ¦ < ¦ > ¦ B ¦ ¦ESC¦"
@16,24 say "+---------------+ +---+"

retu

proc getty
@11,30 say trim(str(recno()))+"/"+ltrim(str(recc()))
@ 4,16 get fname
@ 5,16 get lname
@ 4,45 get id

*****************************************
@ 5,45 say onetwo(mBD) color i

* because "get" with function not works;
* for instance *@ 5,45 GET onetwo(mBD)*
* well, never mind.
* BUT this is the WHOLE question - how, in
* vfp8 screen wizard, (mask, form, I don't
* know ) put memory variable...and fill
* it like here. (code is for FP26)
*****************************************

@ 7,16 get Adr_key
@ 7,22 get b->name
@ 7,45 get House
clear gets
retu

proc onetwo
parameters what
if subs(ID,5,1) = '0'
what=left(ID,2)+'.'+subs(ID,3,2)+'.2'+subs(ID,5,3) +'.'
else
what=left(ID,2)+'.'+subs(ID,3,2)+'.1'+subs(ID,5,3) +'.'
endi
return what
************************************************** ******************

Reply With Quote
  #5  
Old   
El Krbaccha
 
Posts: n/a

Default Re: Form Designer (vfp8) - 01-07-2004 , 02:47 AM



On Mon, 5 Jan 2004 22:08:23 -0500, "Michael Collins" <mike (AT) nospam (DOT) com>
wrote:

Quote:
It seems to me llike you have a couple issues to me:
1. Doing your basic data display/input using form fields.
2. Calling desired functions for getting some data like you want it.
3. Using related tables.

For #1, in VFP you do most of that just by setting properties rather than in code. Like setting the textbox ControlSource property.
For #2, try using form or control methods, depending on what you want to achieve. For example, to do a one time thing when a form starts up, try using the form's Init method (right click on form, choose Properties, click Methods tab, double click on Init Event). If you want to do control level validation, use the control's Valid event (right click on control, choose Properties, click Methods tab, double click on Valid Event). Etc. etc. depending on when you want your code to run.
For #3, I would use views (create the view in the View Designer, then add it to the form's Data Environment by right clicking on the form, choose Data Environment, right click in Data Environment, choose Add). (Any tables or views in the form's Data Environment get automatically opened and closed with the form, and are available from any form or form control methods).
Yes.

Quote:
I would suggest if you are totally new to VFP to start with an example using just #1 concepts, then add #2 when everything works, then add #3 concepts.
Yes Mike, thank you very much.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.