Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to know how to fill in text box automatically 2

Status
Not open for further replies.

decemberprashant

Technical User
Dec 23, 2015
8
IN
Guys sorry I'm new and I'm no programmer! I have done visual basic in college but thats about it.
There is something i need to know
this is a part of the full coding

*-- PROCEDURE HEART.PRG

PROC HEART
@ 7,3 CLEA TO 21,78
@ 8,3 SAY "N A M E :"
@ 10,5 SAY "INITIALS :"
@ 10,34 SAY "SUR NAME :"
@ 12,3 SAY "A D D R E S S :"
@ 14,5 SAY "Line 1"
@ 15,5 SAY "Line 2"
@ 17,5 SAY "SCHEME"
@ 10,17 GET W_NAME PICT "@!"
@ 10,44 GET W_SUR PICT "@!"
@ 14,18 GET W_ADD1 PICT "@!"
@ 15,18 GET W_ADD2 PICT "@!"
@ 17,18 GET W_SCHEME PICT "@!" [highlight #73D216]this where it says w_scheme, it stays blank. I tried to change it to Maayaa Dreams but the alphabets "A and Y" are never shown! What it displays is "M Dre ms" it shows like this! please help :( [/highlight]
READ
RETU
*-- END PROCEDURE HEART.PRG

thanks in advance!
 
From the code and the look, this appears to be FoxPro DOS. You might get a better response posting the question here.

The short answer, though, is the code as presented will display whatever is conained in W_SCHEME. If that's a field (not recommended), it'll display the contents of the field. If it's a memory variable, you'll have to set its contents before running this code.
 
Hi,
1) Did you inherit a FoxPro for DOS app ?
2) ... Picture "!" converts the first character of the field to uppercase
3) ... Picture "@!" should convert all the characters of the field to uppercase - but seems NOT to do it in your case. You might simply try to @ 17,18 GET W_SCHEME in order to check what is in that field and then tune the picture clause.
hth
MK
 
mjcmkrsr I'm not aware of it as I'm not the author! I got this program made for me it runs with a bat file! And it stays blank. It's empty where i can add whatever i want to write! but it does it everytime! i need it be auto filled when the form opens! is it possible? or shall i send the whole thing
 
By what dan already said, the GET lines show what's in the fields or variables. But the code does neither open a DBF nor populate variables, so it will show an empty form. To fill the form with already entered data is not solved in this code part, it simply depends on what is done before calling the heart procedure in terms of having fields or variables with the names.

You better ask the person who wrote this for you on how to use this code and what to do previous and afterwards.

Overall you better learn anything else but FoxPro, especially not legacy FoxPro, if you're new to development and want to become a developer.

Bye, Olaf.
 
It would help us if you could give us two pieces of information:

1. Is W_Scheme a field in a table (that is, in a DBF, sometimes called a database)? Or is it a variable?

2. What do you see if you execute ? W_Scheme[tt][/tt] in the Command Window?

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
it's a variable i think! here's from the start, if you can look at it please do

CH="T"
DO WHILE CH ="T"
CHOICE=0
CLEAR
SET COLO TO GR+*
@ 20,30 SAY "MAAYAA LAND DEVELOPERS"
SET COLO TO
@ 19,29 TO 21,51 DOUBLE

MENUOUT=0
@ 2,5 PROMPT "REGISTRATION"
@ 2,25 PROMPT "RECEIPTS"
@ 2,45 PROMPT "QUEIRIES"
@ 2,65 PROMPT "EXIT"
@ 1,3 TO 3,77 DOUBLE
MENU TO CHOICE


DO CASE
CASE CHOICE = 1
DO REGISTER
CASE CHOICE = 2
CLEAR
DO RECEIPT

CASE CHOICE = 3
SAVE SCREEN TO QRYSAV
DO QUEIRY
RESTORE SCREEN FROM QRYSAV
CASE CHOICE = 4
CLOS ALL
CLOS DATA
QUIT
ENDCASE

ENDDO

*-- END OF MAIN PROGRAM



*-- PROCEDURES -**-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**

*-- PROCEDURE REGISTER
PROCEDURE REGISTER
PUBL PHASE, PLOT, PHASEPLOT
REGOUT="F"
DO WHILE REGOUT="F"
CCHOICE=0
@ 4,5 PROMPT "REGISTRATION"
@ 5,5 PROMPT "CANCELLATION"
@ 6,5 PROMPT "CHANGE ADDRESS"
@ 7,5 PROMPT "EXIT"
@ 3,4 TO 8,19 DOUBLE
MENU TO CCHOICE
DO CASE
CASE CCHOICE = 1
SAVE SCREEN TO REGSAV
CLEAR
DO ADDING
DO REPLACE
USE
CLOS DATA
REST SCREEN FROM REGSAV
CASE CCHOICE = 2
SAVE SCREEN TO REGSAV
DO CANCEL
CLOS DATA
USE
REST SCREEN FROM REGSAV
CASE CCHOICE = 3
SAVE SCREEN TO REGSAV
DO CHANGES
CLOS DATA
USE
REST SCREEN FROM REGSAV
CASE CCHOICE = 4
CLOS ALL
CLOS DATA
REGOUT="T"
ENDCASE

ENDDO
CLEAR
RETURN

*-- END PROCEDURE REGISTER


*-- PROCEDURE ADDING.PRG

PROCEDURE ADDING

CLEA
CLOSE ALL

USE CUSTOMER
INDE ON CUST_PLOT TO CUSTOMER
USE "CUSTOMER" INDEX "CUSTOMER"
PUBL PHASE,PLOT,PHASEPLOT
PUBL W_NAME,W_SUR,W_ADD1,W_ADD2,W_SCHEME

Choice = 1
DO WHILE CHOICE = 1
CHOICE = 0
DO INITIAL
ENTRY = "INVALID"
DO WHILE ENTRY = "INVALID"
@ 1,1 TO 23,79 DOUBLE
@ 5,3 SAY "ENTER PHASE (1/2/3) : "
@ 5,30 SAY "ENTER PLOT NUMBER : "
@ 5,25 GET PHASE PICT "!"
@ 5,50 GET PLOT PICT "!!!"
@ 12,20 SAY "ENTER PHASE=9 TO EXIT WITHOUT REGISTRATION"
READ
IF PHASE ="9"
RETURN
ENDIF
IF .NOT. ISALPHA(PLOT) .AND. .NOT. ISALPHA(PHASE) .AND.;
VAL(PHASE)>0 .AND. VAL(PHASE)<4

ENTRY = "VALID"

PHASEPLOT=PHASE+PLOT
SEEK PHASEPLOT

IF FOUND()
@ 9,12 SAY "PLOT ALREADY ALLOTTED TO ..."
@ 11,5 SAY "NAME : " + TRIM(CUST_NAME) + " " + CUST_SUR
@ 13,5 SAY "ADDRESS : " + CUST_ADD1
@ 14,16 SAY CUST_ADD2
@ 19,5 SAY " PLEASE TRY AGAIN. PRESS ANY KEY TO CONTINUE..."
@ 23,1 SAY ""
WAIT ""
ELSE
DO HEART
ENDIF

ELSE
ENTRY = "INVALID"

@ 12,15 SAY "INVALID PHASE/PLOT NUMBER...PLEASE TRY AGAIN..."
@ 13,15 SAY "PRESS ANY KEY TO CONTINUE..."
WAIT ""
@ 7,3 CLEA TO 21,78
ENDIF
ENDDO
ENDDO
RETU

*-- END PROCEDURE ADDING.PRG


*-- PROCEDURE HEART.PRG

PROC HEART
@ 7,3 CLEA TO 21,78
@ 8,3 SAY "N A M E :"
@ 10,5 SAY "INITIALS :"
@ 10,34 SAY "SUR NAME :"
@ 12,3 SAY "A D D R E S S :"
@ 14,5 SAY "Line 1"
@ 15,5 SAY "Line 2"
@ 17,5 SAY "SCHEME"
@ 10,17 GET W_NAME PICT "@!"
@ 10,44 GET W_SUR PICT "@!"
@ 14,18 GET W_ADD1 PICT "@!"
@ 15,18 GET W_ADD2 PICT "@!"
@ 17,18 GET W_SCHEME pict "@!"
READ
RETU
*-- END PROCEDURE HEART.PRG
 
Well, you alwas start heart without data, because it's only called for not yet allotted plots:

Code:
SEEK PHASEPLOT
IF FOUND() && if a record is found It is shown here with several @SAY
   * code cut out...
ELSE
   * No record found here, you're asked to enter a new one
   DO HEART 
ENDIF

So there is no wonder why you always see this HEART "form" empty, you only go there when no record is found by the SEEK.

Bye, Olaf.
 
Olaf said:
But the code does neither open a DBF nor populate variables, so it will show an empty form.

Actually it will throw an error if the value doesn't exist somewhere. It would only display as empty if the @...GET had a DEFAULT clause on it.

Since the code uses @...PROMPT, it may actually predate Foxpro. That's from the Foxbase+ era. (And the Default clause of @...Get is Foxpro era.)

From the code there is a public variable named W_SCHEME, but it wouldn't be used here. This code would show the contents of that field in the current workarea since that would take precedence over a declared (but not populated) public var.
 
Hi,

Code:
PROC HEART
	@ 7,3 CLEA TO 21,78
	@ 8,3 SAY "N A M E :"
	@ 10,5 SAY "INITIALS :"
	@ 10,34 SAY "SUR NAME :"
	@ 12,3 SAY "A D D R E S S :"
	@ 14,5 SAY "Line 1"
	@ 15,5 SAY "Line 2"
	@ 17,5 SAY "SCHEME"
	@ 10,17 GET W_NAME PICT "@!"
	@ 10,44 GET W_SUR PICT "@!"
	@ 14,18 GET W_ADD1 PICT "@!"
	@ 15,18 GET W_ADD2 PICT "@!"
	@ 17,18 GET W_SCHEME pict "@!"
	[highlight #FCE94F]READ[/highlight]
RETU

Procedure HEART [highlight #FCE94F]should[/highlight] allow you to enter NEW data and save them - hence the READ. The public variables are declared at the beginning of procedure ADDING but unfortunately not [highlight #FCE94F]initiated[/highlight] e.g. W_NAME = Space(25). They are all initiated to .F. . They [highlight #FCE94F]might then[/highlight] be saved through procedure REPLACE - although this one is absent, as are several others.

I got this program made for me

Well I hope you did not spend too much money on it!
hth

MK
 
Procedure HEART should allow you to enter NEW data and save them - hence the READ. The public variables are declared at the beginning of procedure ADDING but unfortunately not initiated e.g. W_NAME = Space(25). They are all initiated to .F. . They might then be saved through procedure REPLACE - although this one is absent, as are several others.

The screen shot posted earlier clearly shows a value in the W_SCHEME "thing" -- we don't know whether it's a field or a variable because the GET is not properly scoped.

But as presented here, it HAS to be a field because it is showing a value other than .f.

There may be other code that has not been presented, but this is what has been presented so far.
 
danfreeman sorry i dont know how to quote :p
the thing is the screen shot i posted earlier is what i was trying to do. otherwise it stays empty as a text box so that i can enter any value. I want the program to have something written in the textbox by default so that when a receipt is printed it prints with it! the screen shot from earlier is the result of me messing around with the code :D

shall i provide the whole code? like from start to end?
 
hi Dan

The screen shot posted earlier clearly shows a value in the W_SCHEME "thing"

Well NO! The screen shot posted shows a value in the field next to the label SCHEME. Whether the underlying object is a field or a variable - you/we simply don't know.

USE CUSTOMER
INDE ON CUST_PLOT TO CUSTOMER
USE "CUSTOMER" INDEX "CUSTOMER"
PUBL PHASE,PLOT,PHASEPLOT
PUBL W_NAME,W_SUR,W_ADD1,W_ADD2,W_SCHEME

If you read the posted code however it becomes obvious that W_SCHEME is a PUBLIC variable.

Remains the question what decemberprashant tries to achieve and if the app worked fine before he messed up the code

the screen shot from earlier is the result of me messing around with the code

Merry XMas

M
 
danfreeman sorry i dont know how to quote :p

Select the text you want to quote and click the "Quote" button on the toolbar above the message editing box.

the thing is the screen shot i posted earlier is what i was trying to do. otherwise it stays empty as a text box so that i can enter any value. I want the program to have something written in the textbox by default so that when a receipt is printed it prints with it! the screen shot from earlier is the result of me messing around with the code :D

OK, so what did you do to get to the screen shot you posted? It shows a value. Where did that value come from?

In general terms, you need to get a value into W_SCHEME (whatever that is) before you issue @...GET. We already know you have a public variable by that name. To make sure you are always displaying/editing that variable you need to add the memory variable alias to the @...GET like this:

Code:
   @ x,y GET [b]m.[/b]W_SCHEME

To get a value into that variable when it displays you need to store the value before issuing @...GET, like this:

Code:
W_SCHEME = "My Default Value"

If your intent instead is to use a field in a table, you use the table's alias instead of the memory variable alias, and REPLACE W_SCHEME With "Default Value" before the @...GET.

shall i provide the whole code? like from start to end?

Not really. We're more than happy to help you learn the programming language and give tips. If you want someone to analyze your code, you should hire someone.
 
I don't say the following with any intent to be rude, but you begin this thread by saying: I'm new and I'm no programmer.

That is no problem, we welcome newbies.
But, in general, the recipients of our advice/suggestions have to have some background in programming so that they might be able to understand and/or implement our comments.

From where you are in the process it seems likely that whatever advice/suggestions we give you will likely do you little or no good, since you will likely not have any idea what we are talking about and/or what to do with the information.

With that in mind, I have 2 suggestions:
1. Since the code you are posting is obviously not Visual Foxpro code, you should be posting in the other language-specific forum area:
Microsoft: FoxPro (old versions 1 to 2.6) Forum ( )
2. However even if you did that the other comments that I have said would still be true, so you should contact a Contractor/Consultant who works with Foxpro (the older versions) and get them to assist you.

Again, I, in no way, intend to be rude. If I come across as that I sincerely apologize.
And we do not want to discourage you from stepping up onto the learning curve.
But this application seems like it might be BUSINESS CRITICAL for you and, if so, you need to get it attended to in the most effective manner.

Good Luck,
JRB-Bldr
 
Danfreeman. Thanks bro that last post about giving it a default value worked :D now i gotta check if it will be shown while printing or not! :D thanks bro

and Jbbldr, i said i knew a little bit of visual basic! So im not hardcore programmer but i get what people say. thanks though!
 

Hats off man, it worked like a miracle! The value is being shown perfectly and even being printed properly! Thanks man, Thanks a ton!
 
Good to hear it's working.

Programming is a lot like cooking. A really fantastic recipe can still fail badly if you leave out a step or an ingredient.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top