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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help on modifying class

Status
Not open for further replies.

VFP602

Programmer
Jan 23, 2002
41
MP
Hi there! I've been trying to use the built-in wizbtns.vcx of VFP to save me time on creating my own class (btw, i'm still starting to use class). I've been trying to add my own code in the add button of wizbtns to automatically create a customer id but can't get it right. Can somebody show how to do this....with a sample code inserted in the wizbtns class. Thanks for the help.
 
In whatever method/property just add your code

assumming you are using the txtbtns class

code here
...
...
* this next line executes any code already in this class
dodefault()
* finally refresh the field that contains the id
thisform.id.refresh()
Michael Ouellette
mouellette@compuserve.com
 
I did what you told me. I was able to insert my code to the click event of the add button of the wizbtns class. But what is happening is that when I run the form and clicked on the add btn, the new id is not displayed on the id field. What I did was:

set proc to accproc
gcOldExc = SET('EXCLUSIVE')
SET EXCLUSIVE OFF
sele acccust &&customer table
if rlock()
append blank
repl cno with incr_id() &&function to create new id
endif
UNLOCK IN acccust
set proc to
dodefault()
thisform.cno1.text1.refresh()

What I want to happen is that when I click on the add button, it should display the automatically created id and set focus to the next field which is the customer name. I will not allow user to go to id field to edit.
 
Instead of your code.. put the following code.. in the click event of the add button..

DODEFAULT()
SET PROCEDURE TO accproc
REPLACE acccust.cno WITH incr_id()
SET PROCEDURE TO
ThisForm.Refresh()

Also.. In the id text box... When Event add the code..
RETURN .f.
This will stop the user from editing Id code.

Hope this helps :) ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
I've tried that already Ramani but still what's happening is that when I clicked on Add button the created id was not displayed. By the way, I'm adding starting from an empty table. To display the id, I tried :
thisform.cno1.text1.value=cno
This one works fine but I noticed if I continue adding records I encounter the ff: message: 'but the problem is when I clicked on 'save' button I got a 'Record is not locked' message'. So i put the rlock() before repl cno with incr_id().
 
Sorry about my statement there. It should be ...message is:
'Record is not locked.'.
 
I already made my automatic id working but I'm encountering a new problem. When I add a new record clicked on Save button, table is properly appended but on the form when issuing refresh(), it automatically displays the succeeding ID no. which should not be unless the user clicks on the Add button again. Also, when adding a new record from a blank table, I can't use reccount() that is, I want to force the program to save a value as starting id ,
for ex.
if rlock()
if reccount()=0 && blank table
repl acccust.id with '10001'
endif
unlock
endif
When I open the table using the command window so as not to be influenced by the program and issue reccount(), it finds reccount()=0 but in the program before the execution of the above code it detects that reccount() has a value of 1 already. Really do not know, what's causing this. Pls. help. Thanks.
 
I am using Microsoft Foxpro 7.0 to create a parent - child table relationship, with the link key: Seqno ( 10 character long ). For screen, I use the foxpro wizard and it point out to wizbtns.vcx.

I want the seqno to be generated automatically by looking up the last seqno in the table. However, the screen created by Foxpro 7.0 wizard can not do that and it also prompt me to enter the seqno with blank default.
I try to add a program to check the last seqno in the table and create a new seqno. I insert that program in the "cmdadd"/valid but the it does not work. The screen only add new record to the parent screen but it disables the child screen (grid ).

My question is: How we can manipulate the wizbtns.vcx to accommodate to our needs ?

 
risingfire

My suggestion would be that if you have a question that is unrelated to the original question, please start a new thread.

How we can manipulate the wizbtns.vcx to accommodate to our needs ?

The wizbtns library, is located in your VFP directory, I would strongly suggest you make a copy of it, and put it in your own application directory, and go through the classes to modify the code to suit your need. A word of warning that class is also "related" to other classes in the VFP directory. I would then suggest you either copy them all if you need to change the code, or create your own navigational button class.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top