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!

change standard buttons form (wizard) 1

Status
Not open for further replies.

yellowke

Programmer
Nov 5, 2002
48
BE
Hi,

if you make a form with the wizard you get a standard button set.
The problem is that you can't see any code in it.

Now if I want to make the same button set with my own code, what is the code then for the buttons:
next record
prev record
top
bottom
add
save
revert
find ?

The form is based on a table.

Thanx in advance guys
 
cmdNext.Click
** next record command button
IF !EOF()
SKIP
ENDIF
IF EOF()
GO BOTTOM
ENDIF

cmdPrevious.Click
** prev record
IF !BOF()
SKIP -1
ENDIF
IF BOF()
LOCATE
ENDIF

cmdTop.Click
** top
LOCATE

cmdBottom.Click
** bottom
GO BOTTOM

cmdAdd.Click
** Add a record
** Here it depends on your form and your methods..
APPEND BLANK

cmdSave.Click
** You have to trap errors also
TABLEUPDATE()
** If that is a failure .. warn user and do whatever

cmdRevert.Click
TABLEREVERT()

cmdFind.Click
** create a procedure for your search
** and call that function from here..
=ThisForm.DoFind()

The above are quick examples.. of your own VCR buttons class.

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
Happy New Year [bigears] [party] [2thumbsup]

 
cmdAdd.Click
** Add a record
** Here it depends on your form and your methods..
APPEND BLANK

the only thing I know to add a record is append, but that's not the way to do this I think.
The only thing it has to do is add a record and display it in the form (all fields are empty or have default values).

What is the code for the edit button?

Thank you for all the help. All this helps me very much.
[thumbsup]

Yellowke
 
Hi
It is too much to explain here.
I suggest take a look in the following link..
Make a Search for 'Navigation Button Set' in the following Link.


Listing 15.3 and a study of this chapter should guide you thru.. :) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
Happy New Year [bigears] [party] [2thumbsup]
 
ok thanks I'll do that.

1 additional question.
All the textboxes are write protected (read only) on the form (I can't put anything in it).
Which is the command to give acces to everything??

Last question ;)

Yellowke
 
yellowke

1 additional question.
All the textboxes are write protected (read only) on the form (I can't put anything in it).
Which is the command to give acces to everything??


In the edit button, you may try:
THISFORM.SETALL("READONLY",.F.,"textbox")

P.S. This may or may not work, since you used the wizard to create your form. The base class of your textboxes may not be the "default" textbox class. It may be the "embossedfield" class, in the case you would use :
THISFORM.SETALL("READONLY",.F.,"embossedfield")

And also you may have to determine if they are read-only or disabled. In that case you may have to use:
THISFORM.SETALL("ENABLED",.T.,"textbox")



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I found the option lockscreen.
If i put: thisform.LockScreen=.F. it works.
Is this way good to solve this?
 
Hi

1. You can also set the cmdSave Enabled and cmdAdd disabled.. while you are in addMode by keeping a form level property..
lAddMode

You can put the code.. in the buttons..
cmdAdd.Enabled = !ThisForm.lAddMode
cmdSave.Enabled = ThisForm.lAddMode

2. You can use these in the cmdAdd.Click
ThisForm.SetAll("ReadOnly",.f.,"TextBox")
ThisForm.SetAll("ReadOnly",.f.,"EditBox")
ThisForm.SetAll("ReadOnly",.f.,"ComboBox")
ThisForm.SetAll("ReadOnly",.f.,"CheckBox")
ThisForm.SetAll("ReadOnly",.f.,"OptionGroup")
ThisForm.lAddMode = .t.

3. You can set them all in the reverse way in the SaveButton click event.

4. You can also.. selected buttons enabled or disabled property the same way.

:)
ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
Happy New Year [bigears] [party] [2thumbsup]

 
Hi,

I get an error:
property ReadOnly is not found
error 1734
property ReadOnly is not found
method: form1.setAll
line 0

weird isn't it?

Yellowke
 
HI Yellowke

ThisForm.SetAll("ReadOnly",.f.,"OptionGroup")

this line will show the above error. Remove this line.

Sorry.. I just wanted to show how you have to do for all various controls.. and in the process.. slipped the error.

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
Happy New Year [bigears] [party] [2thumbsup]

 
when I do:
tableupdate()
I get this error: function requires row or table buffering

How can I make Use of rowbuffering?

I think it's important for the reverse option.

TNX
Yellowke
 
HI
In your DataEnvironment, select the table and in the properties for that table set the BufferModeOverride value.

This is the best place to set the BUffers.
You can also set the BUfferMode by code..
CURSORSETPROP(). Read on this in help.

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
Happy New Year [bigears] [party] [2thumbsup]

 
Hi,

everything works now,
but the only thing I can't get right is the find button.

Can anyone give me a clue what's the best way to make a find button, what's the easiest code?

Thanx
 
In it's simplest form

select myTable
browse noedit nodelete noappend nomenu
thisform.refresh()

Otherwise you would have to create a lookup form. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Is it difficult to make such al lookup form?

No, either create it visually (CREATE FORM) and call it in the Find button, or coding it with something like:
Code:
oLookup=CREATEOBJECT("form")
oLookup.Caption = "Locate Value"
oLookup.AddObject("text1","textbox")
oLookup.text1.Visible = .t.
oLookup.AutoCenter=.t.
oLookup.Height = 50
oLookup.Width = 70
oLookup.Show()


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I have created a find form.
but I have a few questions:

1) How can I give the table that the find form has to use to the find form (I mean how can I tell the find form to use the table that the main form uses)
2) What is the best way to lookup the record number (lookup?) of the record I seek.
3) How can I give back the record number that I found to the main form, so the main form can refresh on the record number I found?


I already have this for the code of the findform, but it doesn't work :(
As you can see I put the table I use in the code, but I want to use this find forum with other forms aswell.

if empty(thisform.txtSearchName.value) then
messagebox("You have to fill in a name")
ThisForm.txtSearchName.SETFOCUS()
else
lookup(naam, thisform.txtSearchName.value, naam)
u218sub8handtek.refresh
Endif
 
yellowke

1) How can I give the table that the find form has to use to the find form (I mean how can I tell the find form to use the table that the main form uses)

You will notice that when you load your second, the tables from the first form are still opened, so you can still access them.

2) What is the best way to lookup the record number (lookup?) of the record I seek.

Normally, if you have index on the field that you are looking for, the SEEK() command is the quickest way to find a record. Otherwise you would use a LOCATE() which does not require an index.

3) How can I give back the record number that I found to the main form, so the main form can refresh on the record number I found?


[ul][li]In the click event of the button of the locate form use: Public cValue
STORE Thisform.text1.value to cValue
Thisform.release()
[/li]
[li]In the find button of the first form use:
do form locate.scx
SELECT myTable
SET ORDER TO TAG name && Your index
IF SEEK(cValue)
Messagebox("Value found")
ELSE
Messagebox("Value not found!!")
ENDIF[/LI][UL]
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
do form locate.scx
SELECT myTable
SET ORDER TO TAG name && Your index
IF SEEK(cValue)
Messagebox("Value found")
ELSE
Messagebox("Value not found!!")
ENDIF

If I try this,
de main form doesn't wait for the CValue --> it gives an error because I hadn't the time to fill it in.
 
yellowke

Make you locate form modal, and make sure you put the code (as suggested above) :
Public cValue
STORE Thisform.text1.value to cValue
Thisform.release()

In the click event of the "Process" button of your locate form. 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